You are on page 1of 10

Excel Vlookup Tutorial

This Excel Vlookup Tutorial provides a step-by-step guide of how to use the Excel Vlookup
function, providing examples and advice on fixing common Vlookup errors.

The Vlookup is one of the most popular functions in Excel but, until you fully understand it, it
may initially appear complicated.

There are also some users have heard of the Vlookup function in Excel, but don't really
understand what it does.

Therefore this tutorial begins by answering the common question, "What is Vlookup in
Excel?" This is followed by an explanation of how to use the Vlookup function in the two
situations when either an exact match, or a closest match, is required. The tutorial also
provides practical Vlookup examples for each of these cases.

If you feel confident that you understand the Vlookup function, but your Vlookup is not
working as expected, you may want to skip straight to the section on Vlookup errors. This
section will take you through a logical set of steps that will help you to find the cause of your
Vlookup error, and identify a solution.

Part 1: What is Vlookup?

Part 2: Vlookup Syntax & Rules

Part 3: Vlookup Example with an Exact Match

Part 4: Vlookup Example with the Closest Match

Part 5: Fix Your Vlookup Error

- Part 5.1: Vlookup #N/A Error

- Part 5.2: Vlookup #REF! Error


Excel Vlookup Tutorial Part 1 - What is Vlookup?

What is Vlookup?
Many users have heard of the Excel Vlookup function but are not clear about what it does.
Therefore, this page aims to answer the common question "What is Vlookup in Excel?"

Vlookup is one of Excel's built-in functions, that is used when you are working with columns
of data. The function finds (or 'looks up') a value in one column of data, and returns the
corresponding value from another column.

This best explained through the following example.

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 month, the sales team manager sends you a list
of hours worked by each of his staff during the month (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.
The full syntax of the Vlookup formula in the above example is not shown as, for now, we
simply wish to explain what the Vlookup function does. The syntax of the Vlookup function is
explained in a later stage of this tutorial.

However, for those who want to skip ahead, the above Vlookup is described in part 3 of this
tutorial
Excel Vlookup Tutorial Part 2 - Vlookup Syntax & Rules

This part describes how to use Vlookup in Excel, by describing the Vlookup function syntax
and rules of use.

You might find it useful to bookmark this page to refer back to, during later sections of the
tutorial.

This will be followed by practical examples of the Vlookup function to help you to put this
information to use.

Vlookup Syntax
The syntax of the Excel Vlookup function is:

VLOOKUP( lookup_value, table_array, col_index_num, [range_lookup] )

where the function arguments are:

lookup_value - The value that you want to search for.

table_array - The array of data that is to be searched for the lookup_value. The Vlookup function
searches in the left-most column of this array.

col_index_num - An integer, specifying the column number of the supplied table_array, that you want to
return a value from.

[range_lookup] - An optional logical argument, which describes what the function should
return in the event that it does not find an exact match to
the lookup_value.
The [range_lookup] can be set to TRUE or FALSE, meaning:

TRUE - Find the closest match below the lookup_value if the


exact value is not found.
Note: if this option is used, the left-hand column of
the table_array must be in ascending order.
FALSE - Find an exact match to the lookup_value - if an exact is
not found, the function returns an error.

If the [range_lookup] value is omitted, it uses the default value of TRUE.

The next two sections of the Vlookup tutorial describe two Vlookup examples, in which an
exact match is required and a closest match is required.
Excel Vlookup Tutorial Part 3 - Vlookup Example With Exact
Match

This part shows how to use the Excel Vlookup Function when you want an exact match to
your lookup value.

Vlookup Example
In this example, the Excel Vlookup function is used to 'look up' the amount of pay owed to
each member of a sales team during the previous month.

As shown below, the employee hourly rates of pay are stored in one spreadsheet, and a list of
hours worked during the previous month, are stored in a second spreadsheet.

Hourly Pay: Sales Team Hours Worked:

In order to complete the "Sales Team Hours" spreadsheet, so that it shows the pay owed to
each sales team member, you first need to 'look up' each persons rate of pay from the
"Hourly Pay" 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.

Sales Team Hours Worked with Vlookup Functions:

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.

Sales Team Hours Worked with Vlookup Function Results:


Vlookup Example Explained
The first call to the Vlookup function, in C2 is:

=VLOOKUP( A2, 'Hourly Pay'!A:B, 2, FALSE )

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 - This argument tells the 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 - This 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.

Further exact match Vlookup examples are provided on the Microsoft Office website.
Excel Vlookup Tutorial Part 4 - Vlookup Example With
Closest Match

This part shows how to use the Excel Vlookup Function when you want the closest match to
your lookup value (if an exact match is not found).

If the [range_lookup] argument in the Vlookup function is set to TRUE (or is omitted), this tells
the Vlookup function that if it is unable to find an exact match to the lookup_value, then the
closest match below the lookup_value should be used instead.
It is important to remember that, when the [range_lookup] argument is set to TRUE, 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.
The following example shows the use of the Vlookup function with
the [range_lookup] argument set to TRUE.

Vlookup Example
Balance Interest Rate

$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.

Interest Rates: Bank Accounts:

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:

Bank Accounts spreadsheet with Vlookup functions:


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:

Bank Accounts spreadsheet with Vlookup results:

Vlookup Example Explained


The first call to the Vlookup function, in cell C2 is:

=VLOOKUP( B2, 'Interest Rates'!A2:C5, 3, TRUE )

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 - This argument tells the function that the value to be returned should be taken
from column 3 of the supplied table_array (i.e. from column C of the "Interest
Rates" spreadsheet).

TRUE - This tells the Vlookup function that we require a closest match to
the lookup_value.
I.e. if an exact match is not found, then use the closest
value below the lookup_value.
Note that this value could have been omitted from the above formula as, by
default, it takes on the value TRUE.

Further Vlookup examples are provided on the Microsoft Office website.


Excel Vlookup Tutorial Part 5 - Fix Your Vlookup Error

If you get a Vlookup error, the first step is to check that you have followed the Vlookup
Rules correctly.
If you are confident that your formula is correct, use the table below to identify the most
likely cause of your error:

Common Vlookup Errors

#N/A - Occurs if the Vlookup function fails to find a match to the supplied lookup_value.
The cause of this will generally depend on the supplied [range_lookup] argument:

if [range_lookup] = TRUE - the #N/A error is likely to be because the smallest value in the left-hand
(or is omitted) column of the table_array is greater than the supplied lookup_value.

if [range_lookup] = FALSE - the #N/A error is likely to be because an exact match to


the lookup_value is not found in the left-hand column of the table_array.

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.

#VALUE! - Occurs if either:


 The supplied col_index_num argument is < 1 or is not recognised as a numeric value.
or

 The supplied [range_lookup] argument is not recognised as one of the logical values
TRUE or FALSE.

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.

3. Check that the col_index_num argument refers to the required column.


Remember that this is the column number counting from the first column of
the table_array. It is not necessarly the same as the spreadsheet column number.

4. If the [range_lookup] argument is set to FALSE, the Vlookup function requires an exact
match. Check that there is only one match to the lookup_value within the left column
of your table_array. If there is more than one match, the Vlookup function will use the
first match that it encounters.

Further Vlookup troubleshooting tips are provided, in the form of a handy Vlookup Quick
Reference Card, on the Microsoft Office website.

You might also like