Skip to content

VLOOKUP Function in Excel

Lookup · Updated

Purpose
Find a value in the first column of a table and return a value from the same row.
Returns
The matching value, or #N/A if nothing matches.
Syntax
fx=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
Works in
Every version of Excel · Microsoft 365 · Google Sheets · LibreOffice Calc

Arguments

ArgumentRequiredWhat it is
lookup_valueYesThe value to search for in the first column of the table.
table_arrayYesThe range that holds the data. The search column must be its first column.
col_index_numYesThe number of the column to return
range_lookupNoFALSE (or 0) for an exact match. TRUE (or 1, or left out) for the closest match in sorted data.

Example: find the price for a product code

The code in E2 is searched for in column A. When it is found, the value from the third column of the table, the price, is returned.

F2fx=VLOOKUP(E2, A2:C6, 3, FALSE)
ABCDEF
1CodeProductPriceFind codePrice
2P-101Desk lamp24.00P-10461.50
3P-102Monitor arm48.90
4P-103USB hub19.75
5P-104Keyboard61.50
6P-105Webcam39.00

Build your VLOOKUP formula

Fill in the fields with your own cells. The formula updates as you type.

The cell holding the code or name you are searching for.
The first column must contain the lookup values.
Counted from the left of the table.
Your formula
F2fx=VLOOKUP(E2, A2:C6, 3, FALSE)

Looks for E2 down the first column of A2:C6 and returns what is in column 3 of that row, only if it matches exactly.

Paste the formula into cell F2 or any empty cell. The coloured parts match the coloured fields. Using a different list separator? Replace the commas with semicolons.

How VLOOKUP works

VLOOKUP does three things in order. It takes the lookup value, walks down the first column of the table until it finds that value, then moves across the same row to the column number you gave and returns what is there.

Two rules follow from that:

  • The value you search for must be in the first column of the range you pass.
  • The column you want back must be to the right of it.

Exact match and approximate match

The fourth argument decides how the search is done.

range_lookup Behaviour Use it for
FALSE or 0 Finds only an identical value. Returns #N/A otherwise. Codes, names, IDs. This is what you want most of the time.
TRUE, 1, or left out Finds the largest value that is less than or equal to the lookup value. The first column must be sorted ascending. Bands: tax rates, commission tiers, grades.

Leaving the argument out is the most common cause of wrong results, because the default is TRUE.

Approximate match example

With score boundaries 0, 60, 70, 80, 90 in column A and grades F, D, C, B, A in column B:

=VLOOKUP(84, A2:B6, 2, TRUE)

returns B, because 80 is the largest boundary that does not exceed 84.

More examples

Look up on another sheet

=VLOOKUP(A2, Prices!$A$2:$C$500, 3, FALSE)

Show a message when nothing is found

=IFERROR(VLOOKUP(E2, $A$2:$C$6, 3, FALSE), "Not found")

Return several columns at once (Excel 365)

=VLOOKUP(E2, A2:C6, {2,3}, FALSE)

The array {2,3} returns the second and third columns into two cells side by side.

Tips

  • Lock the table with dollar signs ($A$2:$C$6) before copying the formula down, or the range slides out of position.
  • Inserting a column inside the table changes which column number you need. XLOOKUP does not have this problem.
  • VLOOKUP returns the first match only. If the search column has repeats, later rows are never reached.
  • Numbers and text that look like numbers do not match each other. Convert one side so both are the same type.

VLOOKUP or XLOOKUP

XLOOKUP replaces VLOOKUP in Excel 2021 and Microsoft 365. It takes separate search and return ranges, so it can look in any direction, defaults to an exact match, and has a built-in “if not found” argument. Use VLOOKUP when the workbook must also open in Excel 2019 or earlier, where XLOOKUP shows #NAME?.

Errors and fixes

ErrorWhy it happensFix
#N/ANo exact match in the first column of the table.Check spelling, extra spaces and numbers stored as text. Make sure the search column is the first column of the range.
#REF!The column number is larger than the number of columns in the table.Widen the table range or lower the column number.
#VALUE!The column number is less than 1 or is not a number.Use 1 or higher.
Wrong resultThe last argument is TRUE or missing and the data is not sorted.Add FALSE as the fourth argument.

Questions

What does VLOOKUP stand for?

Vertical lookup. It searches down a column. Its sibling HLOOKUP searches across a row.

What is the difference between TRUE and FALSE in VLOOKUP?

FALSE returns a result only when the value matches exactly. TRUE returns the closest value that is not larger than the lookup value, and it requires the first column to be sorted from smallest to largest.

Can VLOOKUP look to the left?

No. It always searches the first column of the table and returns a column to its right. Use XLOOKUP or INDEX with MATCH to return a column on the left.

Is VLOOKUP case-sensitive?

No. "ABC" and "abc" are treated as the same value.

Can VLOOKUP return more than one match?

No, it returns the first match from the top. To return every match, use the FILTER function in Excel 365 or Excel 2021.

Can I use wildcards?

Yes, with an exact match. =VLOOKUP("Desk*", A2:C6, 3, FALSE) finds the first product whose name starts with "Desk". An asterisk matches any text; a question mark matches one character.

Related