Going Stellar

Home/Google Sheets reference

Google Sheets function · Lookup

VLOOKUP in Google Sheets: syntax and examples

VLOOKUP searches the first column of a range for a key and returns the value from another column in the same row. Use FALSE as the last argument for codes, emails and IDs, where only an exact match makes sense.

Syntax

VLOOKUP(search_key, range, index, [is_sorted])

Arguments

ArgumentTypeRequiredWhat it does
search_keyanyyesThe value you look for. It is compared with the first column of range only.
rangerangeyesThe table to search. The key column must be its leftmost column.
indexnumberyesWhich column of range to return, counted from 1 at the key column.
is_sortedbooleannoFALSE for an exact match. TRUE, or leaving it out, means approximate match on a sorted first column.

Examples

The examples use this table, starting in A1:

SKUProductPriceStock
A-100Desk lamp79.912
A-200Office chair5490
B-300Monitor stand129.57
B-400Cable tray3440
=VLOOKUP("B-300", A2:D5, 3, FALSE)

Result: 129.5

Price of one SKU. FALSE forces an exact match, which is what you want for codes.

Run in a Google Sheet (English US locale) on .

=VLOOKUP("A-200", A2:D5, 4, FALSE)

Result: 0

Stock for a SKU: same table, fourth column.

Run in a Google Sheet (English US locale) on .

=IFERROR(VLOOKUP("C-999", A2:D5, 2, FALSE), "not found")

Result: not found

A code that is not in the table. IFERROR replaces #N/A with your own text.

Run in a Google Sheet (English US locale) on .

=ARRAYFORMULA(VLOOKUP({"A-100"; "B-400"}, A2:D5, 3, FALSE))

Result:

79.9
34

Several keys at once: ARRAYFORMULA returns one price per key, one under the other.

Run in a Google Sheet (English US locale) on .

=VLOOKUP("b-300", A2:D5, 2, FALSE)

Result: Monitor stand

Lowercase key, uppercase data: the match ignores case, so it still finds the row.

Run in a Google Sheet (English US locale) on .

Common errors

  • It only looks to the right. If the key sits in column B and range starts at A, you get #N/A. Start range at the key column, or use XLOOKUP or INDEX with MATCH.
  • An index larger than the number of columns in range returns #REF!, for example 5 on a four-column table.
  • Leaving out is_sorted means TRUE: approximate match on a sorted column. On unsorted data it returns a wrong row without any error, so write FALSE explicitly.
  • A number stored as text ("100") does not match the number 100. Clean the column with VALUE or TO_TEXT so both sides have the same type.

Compared with Excel

Same syntax as Excel VLOOKUP. Excel 365 also has XLOOKUP, which Google Sheets has too.

Questions and answers

Why does VLOOKUP return #N/A when the value is clearly there?

Usually the key is not in the first column of range, there are trailing spaces, or one side is a number and the other is text. TRIM and VALUE fix the last two.

Sources

  1. VLOOKUP (Docs Editors Help)

Markdown version · All functions