Professional Documents
Culture Documents
13 Vlookup
13 Vlookup
13 Vlookup
html
What is Vlookup?
Vlookup (short for 'vertical' lookup) is a built-in Excel function that is designed to work with data
that is organised into columns.
For a specified value, the function finds (or 'looks up') the value in one column of data, and
returns the corresponding value from another column.
Vlookup Example
Imagine that your company keeps a spreadsheet of employee hourly rates of pay (see 'Hourly
Pay' spreadsheet below). At the end of each week, the sales team manager sends you a list of
hours worked by each of his staff during the week (see 'Sales Team Hours' spreadsheet below).
It is your job to complete the 'Sales Team Hours' spreadsheet, to show the pay owed to each
member of the sales team.
In order to calculate the pay owed to each sales team member, you first need to look up the hourly
rate of pay for each person and insert this into column C of the 'Sales Team Hours' spreadsheet. This
can be done using the Excel Vlookup function.
As illustrated below, if the Vlookup function is entered into cell C2 of the 'Sales Team Hours'
spreadsheet, this can look up the name "Benson, Paul" in column A of the 'Hourly Pay'
spreadsheet and return the corresponding rate of pay from column B. Therefore, in this example,
the Vlookup function returns the value $32.00.
Exact Match vs. Closest Match
n the above example the Vlookup function is used to find an exact match to the lookup value
(which is the text string "Benson, Paul").
The Vlookup function can also be used to return a closest match to the lookup value if an exact
match is not found.
Vlookup Syntax
The syntax of the Excel Vlookup function is:
Rules for the Vlookup Using an Exact Match Rules for the Vlookup Using the
Closest Match
If the [range_lookup] argument is set to FALSE,
the Vlookup searches for an exact match to If the [range_lookup] argument is
the lookup_value. If an exact match is not set to TRUE (or omitted),
found, the function returns the #N/A error. the lookup_value is matched to
In this case, the following rules apply: the closest value below or equal
If the lookup_value is duplicated in the left- to this value.
hand column of the table_array, the function In this case, the following rules
uses the first match that it encounters. apply:
If the lookup_value is a text string, you can use
wildcard characters, where the character ? The left hand column of the
matches any single character and the asterix, * supplied table_array must be in
matches any set of characters. ascending order. If it isn't, the
For example, a lookup_value "t*" would match function may return
any text string beginning with the character unpredictable results.
"t". If the lookup_value is smaller
than all of the values in the left-
hand column of the table_array,
the Vlookup function returns the
#N/A error.
As shown below, the employee hourly rates of pay are stored in one spreadsheet, and a list of
hours worked during the previous week, are stored in a second spreadsheet.
In the spreadsheet below, cells C2-C4 of the "Sales Team Hours" spreadsheet have been updated
with the Vlookup function, which looks up the hourly pay rates for each of the sales team
members.
The results of these Vlookup functions are shown in the spreadsheet below. As expected, each
team member's hourly rate of pay has been inserted into the corresponding cell in column C.
The table below explains the arguments that are supplied to this function:
A2 - Cell A2 is the lookup_value (i.e. the value to be searched for).
The lookup_value is therefore the text string "Benson, Paul".
'Hourly Pay'!A:B - The table_array is made up of columns A-B of the "Hourly Pay" spreadsheet.
The Vlookup function will search down the leftmost column (i.e. column A) of this
array, when searching for the text string "Benson, Paul".
2 - The col_index_num argument is set to the value 2, which tells the Vlookup function
that the value to be returned should be taken from column 2 of the
supplied table_array (i.e. from column B of the "Hourly Pay" spreadsheet).
FALSE - The [range_lookup] argument is set to FALSE, which tells the Vlookup function
that we require an exact match to the lookup_value.
If an exact match is not found, then the Vlookup function should return an error.
This page shows how to use the Excel Vlookup Function when the [range_lookup] argument is
set to TRUE (or is omitted).
When the [range_lookup] is set to TRUE, this tells the Vlookup function that, if an exact match to
the lookup_value is not found, then the closest match below the lookup_value should be
returned instead.
It is important to remember that, when using this option, the left-hand column of
the table_array must be in ascending order. If it isn't, the results from the Vlookup function may
be unpredictable.
$0 - $999.99 1%
$1,000 - $4,999.99 3%
$5,000 - $19,999.99 4%
Over $20,000 5%
Imagine a bank account has a variable interest rate that depends upon its balance, as shown in
the table on the right. These interest rate categories are stored in the "Interest Rate" spreadsheet
below.
The "Bank Accounts" spreadsheet below shows several bank accounts, along with their current
balances.
Column C of the "Bank Accounts" spreadsheet is currently blank, but this column needs to be
updated with the interest rate that is to be applied to each bank account, depending on the
account's current balance. This can be done using the Vlookup function, as shown below:
For each of the bank accounts in the above spreadsheet, the Vlookup function finds the closest
value below the current balance, in column A of the "Interest Rates" spreadsheet. The function
then returns the corresponding value from column C of this spreadsheet.
The results of the Vlookup functions are shown below:
The table below explains the arguments that are supplied to this function:
B2 - Cell B2 is the lookup_value (i.e. the value to be searched for).
The lookup_value is therefore the value 5.69.
'Interest Rates'!A2:C5 - The table_array is the range A2-C5 of the "Interest Rates" spreadsheet.
The Vlookup function will search down the left column (i.e. column A) of this array, when
searching for the closest match equal to or below the lookup_value 5.69.
3 - The col_index_num argument is set to the value 3, meaning that the value to be returned
by the Vlookup function should be taken from column 3 of the supplied table_array (i.e.
from column C of the "Interest Rates" spreadsheet).
TRUE - The [range_lookup] argument is set to TRUE, which tells the Vlookup function to find
the closest match to the lookup_value.
I.e. if an exact match is not found, then the function should return the closest
value below the lookup_value.
Note that this value could have been omitted from the above formula as, by default, it uses
the value TRUE.
#N/A - Occurs if the Vlookup function fails to find a match to the supplied lookup_value.
The cause of this generally depends on the supplied [range_lookup] argument:
if [range_lookup] = TRUE - the #N/A error is likely to be because the smallest
(or is omitted) value in the left-hand column of the table_array is
greater than the supplied lookup_value.
The #N/A error could also arise if the left column of
the table_array is not in ascending order.
If you still can't understand why you are getting this Vlookup error, check out the Vlookup
#N/A Error page.
#REF! - Occurs if either:
The supplied col_index_num argument is greater than the number of columns in the
supplied table_array.
or
The formula has attempted to reference cells that do not exist.
This can be caused by relative referencing errors when the Vlookup is copied to other
cells.
If you need further help with this Vlookup error, check out the Vlookup #REF! Error page.
Incorrect - If your Vlookup function is simply returning the wrong value, check the following:
Value
Returned 1. Are the values you are searching in the left column of the table_array?
For the Vlookup function to work, the values that you are searching must be in the left
column of the table_array.
2. If the [range_lookup] argument is set to TRUE (or omitted), the function will return
the closest match below the lookup_value. For this to work correctly, the left column
of the table_array must be in ascending order.
Study the screenshot given below representing the marks of students along with grading scheme
and answer the following questions by writing formulae in MS-Excel:
a) Write down the formulae for printing the final grade of the student against their marks with
respect to the grading scheme given.
b) Write down the formulae for counting the frequency of different grades awarded (starting from
A+ to F) in the class.
c) Write down the formulae for calculating Max Marks, Minimum Marks and Mean.