Skip to content

VLOOKUP Generator

Fill in four fields and copy a working VLOOKUP formula. The formula updates as you type, with a plain-English explanation underneath.

Updated

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 to use the generator

  1. Value to look up. Enter the cell that holds what you are searching for, such as a product code.
  2. Table to search. Enter the range that holds your data. The column you search must be the first column of this range.
  3. Column to return. Count across from the left edge of the table. The first column is 1.
  4. Match type. Leave it on exact match unless you are looking up a number in sorted bands, such as tax brackets or grade boundaries.
  5. Select Copy and paste the formula into your sheet.

The four parts of a VLOOKUP

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
Part Meaning
lookup_value What to search for. Usually a cell reference.
table_array The range to search. VLOOKUP only looks in its first column.
col_index_num Which column of the table to return, counted from 1.
range_lookup FALSE for an exact match. TRUE needs the first column sorted ascending.

Copying the formula down a column

When you fill the formula down, Excel shifts every reference by one row. The lookup value should move; the table should not. Lock the table with dollar signs:

=VLOOKUP(E2, $A$2:$C$6, 3, FALSE)

Press F4 while the cursor is on the range to add the dollar signs. Converting the data to an Excel table (Ctrl+T) is another way: a table reference such as Products never shifts.

Common mistakes

  • Leaving out the last argument. Without FALSE, VLOOKUP assumes sorted data and may return a wrong row with no warning.
  • Counting columns from A. The column number is counted from the first column of the table, not from column A.
  • Looking to the left. VLOOKUP cannot return a column that sits to the left of the search column. Use XLOOKUP or INDEX and MATCH.
  • Numbers stored as text. The code 1001 typed as text does not match the number 1001. Make both sides the same type.

Showing something other than #N/A

Fill in If nothing is found, show and the generator wraps the formula in IFERROR:

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

IFERROR hides every error, including a mistyped range, so add it after the formula is working.

Questions

How do I write a VLOOKUP formula?

Give it four things, in order: the value to find, the table to search, the number of the column to return, and FALSE for an exact match. For example =VLOOKUP(E2, A2:C6, 3, FALSE).

Does the formula work in Google Sheets?

Yes. VLOOKUP takes the same four arguments in Google Sheets, LibreOffice Calc and every version of Excel.

Why does my VLOOKUP return #N/A?

The lookup value is not in the first column of the table. Check for extra spaces, numbers stored as text, and a table range that moved when the formula was copied down.

Should I use XLOOKUP instead?

If you have Excel 2021 or Microsoft 365, XLOOKUP is easier: it can look to the left, defaults to an exact match, and does not break when a column is inserted. VLOOKUP is the better choice when the file must open in older versions.

How do I look up a value on another sheet?

Put the sheet name and an exclamation mark before the table range, for example Prices!A2:C200. Use quotes if the name has spaces: 'Price list'!A2:C200.

Related