1. 程式人生 > >Excel的vlookup函式進行資料合併和絕對地址

Excel的vlookup函式進行資料合併和絕對地址

內容如圖所示,
[img]http://dl.iteye.com/upload/picture/pic/120140/07cae8b7-3ddb-35d3-8af5-a05f473f9c1a.jpg[/img]

現在想把下面那個表裡的卡號按照學號填充到上面那個表的後面,這種情況用到vlookup
在C2裡面輸入=VLOOKUP(A2,A12:B31,2,FALSE)
最後那個FALSE引數的作用在官方文件上解釋如下
Range_lookup
A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match:

If TRUE or omitted, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned.

The values in the first column of table_array must be placed in ascending sort order; otherwise, VLOOKUP may not give the correct value. You can put the values in ascending order by choosing the Sort command from the Data menu and selecting Ascending. For more information, see Default sort orders.

If FALSE, VLOOKUP will only find an exact match. In this case, the values in the first column of table_array do not need to be sorted. If there are two or more values in the first column of table_array that match the lookup_value, the first value found is used. If an exact match is not found, the error value #N/A is returned.

把單元格往下一拖,發現C3的內容變成了=VLOOKUP(A3,A13:B32,2,FALSE)
但是下面這個區域是固定的,所以要用絕對地址,即$A$12:$B$31
這樣C3的內容就是=VLOOKUP(A3,$A$12:$B$31,2,FALSE)
效果如圖所示
[img]http://dl.iteye.com/upload/picture/pic/120142/6789e218-523d-328d-97c8-c359de7bab87.jpg[/img]


其實這個vlookup函式我原來是用過的
[url]http://hi.baidu.com/kabike/item/d73d49cab269413298b498a9[/url]

只是當時沒把最後一個引數的意義弄清楚