formulastreak

Lookup function

VLOOKUP function in Google Sheets and Excel

VLOOKUP searches the first column of a table for a value and returns the value from a column you name, on the same row.

Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet

Syntax

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

Arguments in [brackets] are optional. Google Sheets writes it VLOOKUP(search_key, range, index, [is_sorted]).

Example

=VLOOKUP(B2,$G$2:$J$8,4,FALSE) reads: Look for B2 in the first column of the price list $G$2:$J$8 and return the 4th column of that row (the stock), exact match only.

Orders and price list · edit D2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultD2 = 12
ABCDEFGHIJ
1OrderSKUQtyIn stockSKUProductPriceStock
22001PL-104212PL-101Fern$9.5040
32002PT-210160PL-104Monstera$34.0012
42003TL-30139PL-107Snake plant$22.0025
52004PL-101140PT-210Terracotta pot$12.5060
62005SL-401480PT-212Ceramic pot$19.0018
72006PL-104112TL-301Watering can$18.009
82007PT-212218SL-401Potting mix$7.2580
92008PL-107125

D2 shows 12: order 2001's SKU PL-104 is the Monstera, and the 4th column of its row in the price list is the stock, 12.

How the spreadsheet calculates it

Looks for B2 in the first column of $G$2:$J$8 and returns the value in column 4 of that row. FALSE means exact match: if the value isn't there, you get #N/A.

  1. 1. VLOOKUP: Looks for B2 in the first column of $G$2:$J$8 and returns the value in column 4 of that row. FALSE means exact match: if the value isn't there, you get #N/A.
    • key = `B2`: what to look for
    • table = `$G$2:$J$8`: the whole table, key column first
    • column = `4`: which column to return, counting the table's first column as 1
    • FALSE = `FALSE`: exact match. Without it VLOOKUP assumes a sorted table and can quietly return a wrong row

More VLOOKUP examples

  • =VLOOKUP(A2,$F$2:$H$50,3,FALSE)The third column of the table for the key in A2, exact match.
  • =IFNA(VLOOKUP(A2,$F$2:$H$50,2,FALSE),"Missing")The same lookup with a message when the key isn't there.
  • =VLOOKUP(D2,$G$2:$H$6,2,TRUE)A band from a sorted table of boundaries (approximate match on purpose).
  • =VLOOKUP(B2,$G$2:$J$8,MATCH("Price",$G$1:$J$1,0),FALSE)The column found by its header, so inserted columns don't break it.

Paste any of these into the formula explainer to see it step by step.

Tips

  • Always end an exact lookup with FALSE, even if it seems to work without it.
  • Put the key column first in the table; if it can't be first, use XLOOKUP or INDEX MATCH instead of rearranging data.
  • Lock the table with $ and widen it when you add columns, so the column number still lands where you expect.

What VLOOKUP is used for

Filling in product names and prices from a price list, pulling a department or salary band into an HR sheet, and reconciling two exports by an ID column. It's still the lookup most shared workbooks use.

Arguments

ArgumentRequiredWhat it is
lookup_valueYesWhat to look for in the table's first column.
table_arrayYesThe table, starting with the column to search. Lock it with $ before filling down.Watch out: Unlocked, it slides down as you copy and lower rows miss their keys.
col_index_numYesWhich column of the table to return, counting the first column as 1.Watch out: A number bigger than the table's width gives #REF!.
range_lookupNoFALSE for an exact match. Left out, it's TRUE: an approximate match that assumes the first column is sorted.Watch out: Leaving it out on unsorted data returns wrong rows without an error.

Common mistakes

  • Leaving off FALSE: wrong rows on an unsorted table, with no error.

  • Forgetting $ on the table: lower rows search a shifted table and show #N/A.

  • Counting the column from A instead of from the table's first column.

  • Expecting it to look left: VLOOKUP only returns columns to the right of the search column.

  • Inserting a column into the table, which shifts what the typed column number points at.

In Google Sheets

Google Sheets' VLOOKUP takes the same arguments. Its help also defaults the last argument (is_sorted) to TRUE, so add FALSE there too.

Errors you may see with VLOOKUP

  • #N/A: The key isn't in the first column, or it differs by a space or type. How to fix it.
  • #REF!: col_index_num is bigger than the number of columns in table_array.
  • #SPILL!: The lookup value is a whole column like A:A in dynamic-array Excel. How to fix it.

Questions

Why does VLOOKUP return the wrong value?

Almost always a missing FALSE: approximate match on unsorted data returns a nearby row. See VLOOKUP returns the wrong value.

Can VLOOKUP use two criteria?

Not directly. Join the keys in a helper column, or use XLOOKUP or INDEX MATCH with multiplied conditions (multiple criteria).

Does VLOOKUP work across sheets?

Yes: point table_array at the other sheet, like VLOOKUP(A2, Prices!$A$2:$C$50, 3, FALSE). Keep the $ so the range doesn't move when you fill down.

Sources

Official documentation the facts on this page were checked against.

Practise VLOOKUP on a live sheet

Lesson 15, VLOOKUP (Unit 4, Lookups), has 5 graded exercises, checked instantly, with steps and hints when you're stuck. Pro