FxFormula Drills

INDEX and MATCH vs XLOOKUP

INDEX/MATCH and XLOOKUP both return a value from a column you name, including a column to the left of the one you search. XLOOKUP is one function and is easier to read in Excel 2021, Microsoft 365, and Google Sheets. INDEX and MATCH remain the pattern that also runs in Excel 2019 and earlier. MATCH finds the position. INDEX uses that position to pick the cell you want.

Syntax

INDEX and MATCH

INDEX(return_range, MATCH(lookup_value, lookup_range, 0))

MATCH with a third argument of 0 returns the position of an exact match, starting at 1 for the first cell of lookup_range. INDEX returns the cell at that position in return_range. The two ranges must be the same length and line up row for row.

XLOOKUP

XLOOKUP(lookup_value, lookup_array, return_array)

The same job in one call. There is no position to pass along, and exact match is the default. Add a fourth argument when a miss should show a label instead of #N/A.

VLOOKUP

VLOOKUP(lookup_value, table_array, col_index_num, FALSE)

Works when the column you search is the first column of table_array. It cannot return a cell to the left of that column. FALSE keeps the match exact.

Comparison

QuestionINDEX/MATCHXLOOKUPVLOOKUP
Shape of the formulaTwo functions, position in the middleOne functionOne function, column number in the middle
Return a column to the leftYesYesNo
Exact matchThird argument of MATCH must be 0DefaultFourth argument must be FALSE
A column inserted in the sheetStill correct if the ranges still line upStill correctThe column index can go stale
Older ExcelYes, including Excel 2016 and 2019No. #NAME? before Excel 2021Yes

Worked examples

Price on the right, the ordinary case

Book is in E2. The name column is A and the price column is B. INDEX/MATCH and XLOOKUP return the same price. VLOOKUP can do this case too because the name is the first column.

Pen 1.5, Book 12, Lamp 24.
RowABCDE
1ProductPriceQtyFind
2Pen1.54Book
3Book122
4Lamp241
  • =INDEX(B2:B4,MATCH(E2,A2:A4,0)) → 12
  • =XLOOKUP(E2,A2:A4,B2:B4) → 12
  • =VLOOKUP(E2,A2:B4,2,FALSE) → 12

MATCH finds Book in position 2 of A2:A4. INDEX then returns position 2 of B2:B4, which is 12. XLOOKUP never shows you the 2. VLOOKUP is told to come back with column 2 of A2:B4. All three are exact matches.

Name from a price, a left lookup

This time you know the price, 24, and you want the product. The product sits to the left of the price. INDEX/MATCH and XLOOKUP search column B and return column A. A VLOOKUP table that starts at the price cannot reach the name.

D2 is the price 24. The name for that price is Lamp.
RowABCD
1ProductPricePrice
2Pen1.524
3Book12
4Lamp24
  • =INDEX(A2:A4,MATCH(D2,B2:B4,0)) → Lamp
  • =XLOOKUP(D2,B2:B4,A2:A4) → Lamp
  • =VLOOKUP(D2,B2:B4,2,FALSE) → #REF!

MATCH locates 24 at position 3 of the price column. INDEX reads position 3 of the name column and returns Lamp. XLOOKUP takes those two ranges directly. VLOOKUP is pointed at B2:B4, a one-column table, and asked for column 2. That column does not exist, so the result is #REF!. Moving the index cannot reach column A, because VLOOKUP only looks to the right of the column it searches.

When to use which

Use XLOOKUP when the file's Excel is new enough

If the readers are on Microsoft 365, Excel 2021 or 2024, or Google Sheets, XLOOKUP is the formula to type. There is no match-type argument to forget, and a missing key has a place to land.

Use INDEX/MATCH when the file must open in older Excel

Excel 2019 and earlier have INDEX and MATCH and do not have XLOOKUP. The pair also shows its work: you can put MATCH in its own cell while you check that the position is the row you expected, then hand that cell to INDEX.

Use VLOOKUP for a simple rightward lookup in a shared template

A two-column list with the key on the left is the case VLOOKUP was built for. Type FALSE. Switch away from it as soon as the return column is to the left or the table gains and loses columns.

Common mistakes

Forgetting the 0 in MATCH

MATCH's default match type is 1, an approximate match on a list sorted ascending. For a product name or an id, the third argument has to be 0. Without it, MATCH can return the position of a different item.

Ranges that do not line up

INDEX(B2:B10, MATCH(E2, A2:A9, 0)) is already wrong if the match falls on the last name, and it is quietly wrong if someone inserts a row in only one of the ranges. Start both ranges on the same row and end them on the same row.

Mixing up the position and the value

MATCH returns a position, not the price. If the cell shows 2 when you wanted 12, you stopped at MATCH. Pass that position into INDEX, or switch to XLOOKUP.

Using a whole column without meaning to

A2:A4 is easier to audit than a whole column on a short exercise sheet. Whole columns are fine in a real model when the data really runs down the sheet. Do not mix A:A in MATCH with B2:B100 in INDEX.

Versions and compatibility

INDEX and MATCH have been in Excel for decades and are in Google Sheets. You can send an INDEX/MATCH workbook to someone on Excel 2016 or 2019.

XLOOKUP needs Excel 2021, Excel 2024, Microsoft 365, Excel for the web, or Google Sheets. In Excel 2019 it returns #NAME?.

A two-way lookup uses two MATCH calls inside INDEX, one for the row and one for the column. That pattern is in the two-way INDEX/MATCH drill. XLOOKUP can be nested the same way when you have it.

Practice on Formula Drills

Free drills are open with no account. Premium drills show the problem to everyone and grade the sheet for subscribers.

Free exercises

Premium exercises

Function pages

FAQ

What does MATCH actually return?

A position, counting from 1 inside the range you gave it. MATCH("Book", A2:A4, 0) is 2 when Book is the second cell of that range. It is not the worksheet row number unless the range starts on row 1.

Is INDEX/MATCH obsolete?

No. It is the lookup that still works in older Excel, and it is the way to check a position in its own cell. XLOOKUP is the shorter formula when every reader has it.

Can I match a number stored as text?

An exact match does not treat the number 24 and the text 24 as the same value. If MATCH or XLOOKUP returns #N/A on a value you can see, check that both sides are numbers or both sides are text. A price typed with a stray space is text.

How do I look across and down?

INDEX can take a row position and a column position: INDEX(grid, MATCH for the row, MATCH for the column). Both MATCH calls use 0 for an exact header. The two-way drill practices that shape.