Excel VLOOKUP Function Tutorial With Formula Examples
Excel VLOOKUP Function Tutorial With Formula Examples
examples
by Svetlana Cheusheva, updated on August 23, 2023
Today we'll look at how to use VLOOKUP in Excel with many detailed step-by-step examples. You'll learn
how to Vlookup from another sheet and different workbook, search with wildcards, and a lot more.
This article begins a series covering VLOOKUP, one of the most useful Excel functions and at the same
time one of the most intricate and least understood. We will try to explain the basics in a very plain
language to make the learning curve for an inexperienced user as easy as possible. We will also
provide formula examples that cover the most typical usages of VLOOKUP in Excel, and try to make
them both informative and fun.
In its common usage, Excel VLOOKUP searches through your data set based on the unique identifier
and brings you a piece of information associated with that unique identifier.
The letter "V" stands for "vertical" and is used to differentiate VLOOKUP from the HLOOKUP function
that looks up a value in a row rather than column (H stands for "horizontal").
The function is available in all versions of Excel 365 through Excel 2007.
Tip. In Excel 365 and Excel 2021, you can use the XLOOKUP function, which is a more flexible and
powerful successor of VLOOKUP.
VLOOKUP syntax
The syntax for the VLOOKUP function is as follows:
Where:
TRUE or omitted (default) - approximate match. If an exact match is not found, the formula
searches for the largest value that is smaller than the lookup value. Requires sorting the lookup
column in ascending order.
FALSE - exact match. The formula searches for a value exactly equal to the lookup value. If an
exact match is not found, a #N/A value is returned.
Basic VLOOKUP formula
Here is an example of the Excel VLOOKUP formula in its simplest form. Please have a look at the
below formula and try to "translate" it into English:
The 1st argument (lookup_value) clearly indicates that the formula looks up the word "lion".
The 2nd argument (table_array) is A2:B11. Keeping in mind that the search is performed in the left-
most column, you can read the above formula a little further: search for "lion" in the range A2:A11.
So far, so good, right?
The 3rd argument col_index_num is 2. Meaning, we want to return a matching value from column B,
which is second in the table array.
The 4th argument range_lookup is FALSE, which indicates that we are looking for exact match.
With all the arguments established, you should have no problem reading the whole formula: search
for "lion" in A2:A11, find an exact match, and return a value from column B in the same row.
For the sake of convenience, you can type the value of interest in some cell, say E1, replace the
"hardcoded" text with the cell reference, and get the formula to look up any value you input in E1:
The lookup value in most cases should be a relative reference (like E2) or you can lock only the column
coordinate ($E2). When the formula gets copied down the column, the reference will adjust
automatically for each row.
To see how it works in practice, please consider the following example. To our sample table, we have
added one more column that ranks the animals by speed (column A) and want to find the 1st, 5th and
10th fastest sprinter in the world. For this, enter the lookup ranks in some cells (E2:E4 in the
screenshot below), and use the following formulas:
Enter the above formulas in cells F2 and G2, select those cells, and drag the formulas to the below
rows:
If you investigate the formula in a lower row, you will notice that the lookup value reference has
adjusted for that specific row, while the table array is unchanged:
Below, you will have a few more useful tips that will save you a lot of headache and troubleshooting
time.
To Vlookup from a different Excel sheet, put the worksheet's name followed by an exclamation mark
in the table_array argument before the range reference. For example, to search in the range A2:B10 on
Sheet2, use this formula:
=VLOOKUP("Product1", Sheet2!A2:B10, 2)
Of course, you don't have to type the sheet's name manually. Simply, start typing the formula and
when it comes to the table_array argument, switch to the lookup worksheet and select the range using
the mouse.
For instance, this is how you can look up the A2 value in the range A2:A9 on the Prices worksheet and
return a matching value from column C:
Notes:
If the spreadsheet name contains spaces or non-alphabetical characters, it must be enclosed in
single quotation marks, e.g. 'Price list'!$A$2:$C$9.
In case you use a VLOOKUP formula for multiple cells, remember to lock table_array with the $
sign, like $A$2:$C$9.
For example, here's the formula to look up the A2 value on the sheet named Prices in the Price_List.xlsx
workbook:
If either a workbook name or worksheet name contains spaces or non-alphabetical characters, you
should enclose them in single quotes like this:
The easiest way to make a VLOOKUP formula that refers to a different workbook is this:
Once you close the file with your lookup table, the VLOOKUP formula will continue working, but it will
now display the full path for the closed workbook:
For more information, please see How to refer to another Excel sheet or workbook.
To create a named range, simply select the cells and type the name you want in the Name box to the
left of the Formula bar. For the detailed steps, please see How to name a range in Excel.
For this example, we gave the name Prices_2020 to the data cells (A2:C9) in the lookup sheet and get
this compact formula:
Most names in Excel apply to the entire workbook, so you don't need to specify the worksheet's
name when using named ranges.
If the named range is in another workbook, put the workbook's name before the range name, for
example:
If you have converted your lookup range into a fully-functional Excel table, then you can do a Vlookup
based on the table name, e.g. Price_table in the below formula:
Table references, also called structured references, are resilient and immune to many data
manipulations. For instance, you can remove or add new rows to your lookup table without worrying
about updating the references.
When you do not remember the exact text you are looking for.
When you are looking for a text string that is part of the cell contents.
When a lookup column contains leading or trailing spaces. In that case, you may rack your brain
trying to figure out why a normal formula does not work.
To return the last name from column A, use the following Vlookup wildcard formula:
To retrieve the license key from column B, use this one (the difference is only in the column index
number):
You can also enter the known part of the name in some cell, say E1, and combine the wildcard
character with the cell reference:
Get the name that starts with "joh" and ends with "son":
Let's say, you wish to get a name corresponding to a certain license key, but you don't know the whole
key, only a few characters. With the keys in column A, names in column B, and part of the target key in
E1, you can do a wildcard Vlookup in this way:
For a wildcard VLOOKUP formula to work correctly, use an exact match (FALSE is the last
argument).
If more than one match is found, the first one is returned.
The lookup column must be sorted in ascending order, from smallest to largest, otherwise a
correct value may not be found.
If the lookup value is smaller than the smallest value in the lookup array, a #N/A error is returned.
The following examples will help you better understand the difference between an exact match and
approximate match Vlookup and when each formula is best to be used.
For this example, let's take the animal speed table, swap the columns, and try to find the animals that
can run 80, 50 and 30 miles per hour. With the lookup values in D2, D3 and D4, enter the below
formula in E2, and then copy it down to two more cells:
As you can see, the formula returns "Lion" in E3 because they run exactly 50 per hour. For the other
two lookup values an exact match is not found, and #N/A errors appear.
For our sample data, an approximate match Vlookup formula goes as follows:
For a lookup value of "80", "Cheetah" is returned because its speed (70) is the closest match that is
smaller than the lookup value.
For a lookup value of "50", an exact match is returned (Lion).
For a lookup value of "30", a #N/A error is returned because the lookup value is less than the
smallest value in the lookup column.
Standard Vlookup
When the lookup column (Animal) is the leftmost column in the lookup table, a normal VLOOKUP
formula for exact match is inserted:
This tool is our visual and stress-free alternative to Excel's VLOOKUP function, which works this way:
Available downloads
Excel VLOOKUP formula examples (.xlsx file)
Ultimate Suite 14-day fully-functional version (.exe file)