The Excel VLOOKUP Function
The Excel VLOOKUP function 'looks up' a given value in the left-hand column of a data array (or table), and returns the corresponding value from another column of the array. The format of the function is:
VLOOKUP( lookup_value, table_array, col_index_num, [range_lookup] )
where the arguments are as follows:
ExamplesVlookup Example 1In the spreadsheet below, columns A and B list an inventory of grocery items, and their prices, and cell E2 of the spreadsheet shows a simple example of the Vlookup function being used to look up the price of an item from the inventory. The above Vlookup function returns the price for "Cornflakes", which is $3.50. In this example:
Vlookup Example 2In the spreadsheet below, columns A-C list the grades that are assigned to examination marks lying within the ranges 0-44%, 45%-54%, etc. Cell F2 shows the score of 52% that was achieved by the student "Anne" in an examination. The Vlookup function in cell G2 looks up this score in column A of the spreadsheet and returns the associated grade from column C. Note that, in this example, if the exact score of 52% is not found in column A, we want, instead, to use the nearest value below this score. The above Vlookup function returns the grade for the score 52%, which is E. In this example:
Further Vlookup ExamplesFor a practical example of the VLOOKUP function being used to create a variable chart, see the Excel Variable Chart page. Also, there is an excellent video tutorial on the Excel Vlookup function on the Brainstorm Inc. website, and several further examples on the Microsoft Office website. Trouble ShootingIf you get an error from the Excel Vlookup function this is likely to be one of the following : Common Errors
Also, the following problems are encountered by some users: You can see the value that you want to look up in your table_array, but your Excel VLOOKUP is returning the #N/A error. Why can't it 'see' the lookup_value in the table_array? Possible Reason No. 1
You may have unseen spaces at the start or end of either the value you are looking up, or in the cells of your table_array. These spaces cause your lookup_value cell and the 'matching' cell in your table_array to have slightly different content. Solution No. 1
Check the contents of the cells that you believe should match.
If there are unseen additional spaces in one or both of the lists, remove these using the
TRIM function:
Possible Reason No. 2
The contents of the cells that are being compared may have different data types.
For example, the cell containing your lookup_value may be stored as a number by Excel,
whereas the values in your table_array may be stored as text even though they look like numbers.
Solution No. 2
Force both sets of data to have the same type. For example, if you want both sets of values to be stored
as text, convert both sets of data to text, using Excel's Text To Columns tool:
The data in your selected cells should now be stored as text within Excel and so the Excel Vlookup function should be able to 'look up' the matching value. Note that you could have chosen to convert the contents of your cells to Excel's 'general' type, by simply selecting the column data format General in the Text To Columns tool.Common Vlookup Problem No. 2
You use the Excel Vlookup function in one cell and it works perfectly. However, when you attempt to copy the function down to other rows, you get the #REF error. Possible Reason
This error will occur if you have referenced the range 1:65536 (a reference to all cells on a worksheet) in your initial cell. Excel automatically increases row references when a cell is copied down to other rows. However, row 65536 is the last row in the spreadsheet, so rows 65537, 65538, ... don't exist. Quick Solution
If your initial cell (in which the function works) references the cell range 1:65536, change this reference to $1:$65536 Note: the $ signs prevent Excel from increasing the row reference as the formula is copied down to other cells. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright © 2008-2010 ExcelFunctions.net |