Sunday, 23 April 2017

Excel - Microsoft Excel Vlookup Function

Description

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: 

Vlookup Examples
Vlookup Example 1
In 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 2
In 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: 
Using Vlookup in VBA
Although there is no VBA Vlookup function, you can call the Excel Worksheet Vlookup Function from VBA. See the VBA Vlookup page for more details. 

Vlookup Function Errors
If you get a Vlookup error this is likely to be one of the following : 

Common Errors 


No comments:

Post a Comment