Skip to content

Guides

VLOOKUP vs XLOOKUP vs INDEX-MATCH: which to use and when

How the three lookup formulas differ, where each one breaks, and which to use in Excel 365, older Excel and Google Sheets, with copy-ready examples.

By Ketan ·

Every spreadsheet eventually needs a lookup: bring the price from the product list, the region from the customer table, the manager from the staff list. Excel offers three ways to do it, and the one most people learn first is the one most likely to quietly return the wrong answer.

Short version: use XLOOKUP if everyone who opens the file has Excel 365, Excel 2021 or Google Sheets. Otherwise use INDEX-MATCH. Use VLOOKUP only for quick, throwaway work.

The same lookup three ways

Find the price (column C of the Products sheet) for the product code in A2 (codes in column A):

=VLOOKUP(A2, Products!A:C, 3, FALSE)
=XLOOKUP(A2, Products!A:A, Products!C:C, "Not found")
=INDEX(Products!C:C, MATCH(A2, Products!A:A, 0))

All three return the same price when the code exists. The differences show up when something changes or goes wrong.

VLOOKUP: familiar, but fragile

VLOOKUP(value, table, column_number, FALSE) searches the first column of the table and returns the value from the column number you give.

Where it breaks:

  • The last argument defaults to an approximate match. Leave out FALSE and VLOOKUP assumes the first column is sorted, then returns the nearest match, which looks perfectly plausible and is wrong. It’s the single most common lookup bug I find in other people’s workbooks.
  • The column number is hard-coded. Insert a column into the table, and 3 now points at the wrong column. Nothing warns you.
  • It can only look to the right. The value you search for must be in the first column, so you can’t look up a code that sits to the right of the result.
  • Missing values give #N/A, which you have to wrap in IFERROR yourself.

From experience: when a VLOOKUP report “suddenly” shows wrong numbers, check two things before anything else: a missing FALSE, and a column inserted into the lookup table since the formula was written.

XLOOKUP: the modern default

XLOOKUP(value, lookup_range, return_range, [if_not_found], [match_mode], [search_mode]) takes the column to search and the column to return separately.

Why it’s better:

  • Exact match by default. No silent approximate matches.
  • No column numbers. You point at the return column itself, so inserting columns doesn’t break anything.
  • Looks left or right. The return column can be anywhere.
  • Built-in “not found” value. The fourth argument replaces IFERROR.
  • Can return several columns at once. =XLOOKUP(A2, Products!A:A, Products!B:D) spills name, category and price into three cells.
  • Can search from the bottom. Set search_mode to -1 to get the latest match, for example the most recent price change.

The catch: it only exists in Excel 365, Excel 2021 and later, and Google Sheets. Open the file in Excel 2019 or older and every XLOOKUP shows #NAME?.

INDEX-MATCH: works everywhere

INDEX(return_range, MATCH(value, lookup_range, 0)) splits the job in two: MATCH finds the row number, and INDEX returns the value from that row.

It has most of XLOOKUP’s strengths. It looks left or right, doesn’t use column numbers and survives inserted columns, and it works in every version of Excel and in Google Sheets. The 0 in MATCH means exact match. Don’t leave it out, for the same reason as VLOOKUP’s FALSE.

It’s wordier, and missing values still need wrapping:

=IFERROR(INDEX(Products!C:C, MATCH(A2, Products!A:A, 0)), "Not found")

Side by side

VLOOKUP XLOOKUP INDEX-MATCH
Exact match by default No Yes No (needs 0)
Survives inserted columns No Yes Yes
Looks left No Yes Yes
“Not found” value Needs IFERROR Built in Needs IFERROR
Returns several columns No Yes One per formula
Last match instead of first No Yes Awkward
Excel 2019 and older Yes No Yes
Google Sheets Yes Yes Yes

Lookups with two conditions

To find the price for a product and a region:

=XLOOKUP(1, (Prices!A:A=A2)*(Prices!B:B=B2), Prices!C:C, "Not found")

Each comparison gives TRUE or FALSE for every row, and multiplying them leaves 1 only where both match. In older Excel, the INDEX-MATCH version is the same idea, entered with Ctrl + Shift + Enter:

=INDEX(Prices!C:C, MATCH(1, (Prices!A:A=A2)*(Prices!B:B=B2), 0))

On large sheets, use exact ranges like A2:A5000 rather than whole columns for these. Array comparisons over a million rows are slow.

When a formula isn’t the right tool

If you’re matching two whole files, say every order against the customer list, a lookup formula copied down 100,000 rows makes the workbook slow and fragile. Joining the files once gives you a clean result: the Merge CSV files tool does that in your browser and brings across every column at once.

And if you’d rather not remember any of the syntax, describe what you need to the Excel formula helper, for example “look up the price in Sheet2 by the code in A2, show Not found if missing”. It returns the formula for your Excel version, with each part explained.