INDEX MATCH and XLOOKUP both find a value in one column and return the matching value from another. They can do almost the same jobs. The real questions are which Excel version your file has to work in, and how readable you want the formula to be. This guide puts the two side by side on the same small dataset, so you can see the differences and pick the right one.
XLOOKUP if everyone who opens the file has Excel for Microsoft 365, Excel 2021 or later, Excel for the web, or Google Sheets. It is shorter, uses exact match by default, and has a built-in "not found" argument. Use INDEX + MATCH when the workbook must also work in Excel 2019 or older.The sample data
All the examples below use this product list in A1:E11:
| SKU | Product | Category | Price | Stock |
|---|---|---|---|---|
| P-1001 | Wireless Mouse | Accessories | $24.99 | 140 |
| P-1002 | USB-C Hub | Accessories | $39.50 | 85 |
| P-1003 | Monitor 27-inch | Displays | $219.00 | 32 |
| P-1004 | Laptop Stand | Accessories | $34.00 | 60 |
| P-1005 | Mechanical Keyboard | Input | $89.90 | 48 |
| P-1006 | Webcam HD | Video | $59.00 | 73 |
| P-1007 | Noise-Cancel Headset | Audio | $129.00 | 27 |
| P-1008 | Monitor 24-inch | Displays | $159.00 | 41 |
| P-1009 | Desk Mic | Audio | $74.50 | 36 |
| P-1010 | Cable Organizer | Accessories | $12.75 | 210 |
1. Basic lookup: find the price of a SKU
To get the price of P-1007:
INDEX MATCH
=INDEX(D2:D11, MATCH("P-1007", A2:A11, 0))
XLOOKUP
=XLOOKUP("P-1007", A2:A11, D2:D11)
Both return 129 ($129.00). The XLOOKUP version reads in plain order: what to find, where to look, what to return.
2. Lookup to the left
A common reason people move away from VLOOKUP is that it can't return a column to the left of the lookup column. Neither of these formulas has that limit. To find the SKU of "Desk Mic" (SKU is in column A, left of Product in column B):
=INDEX(A2:A11, MATCH("Desk Mic", B2:B11, 0))
=XLOOKUP("Desk Mic", B2:B11, A2:A11)
Both return P-1009.
3. Handle "not found" values
If the value doesn't exist, both formulas return #N/A. With INDEX MATCH, you wrap the formula in IFNA. XLOOKUP has a fourth argument for this:
=IFNA(INDEX(D2:D11, MATCH("P-1099", A2:A11, 0)), "Not found")
=XLOOKUP("P-1099", A2:A11, D2:D11, "Not found")
Both return Not found, because there is no SKU P-1099 in the list.
4. Find the last match instead of the first
"Accessories" appears four times. A normal lookup returns the first match (Wireless Mouse). To get the last one, XLOOKUP has a search mode argument, where -1 searches from bottom to top:
=XLOOKUP("Accessories", C2:C11, B2:B11, , 0, -1)
MATCH has no option to search backwards, so older versions need a workaround. The usual one uses LOOKUP:
=LOOKUP(2, 1/(C2:C11="Accessories"), B2:B11)
Both return Cable Organizer. The LOOKUP trick works, but it's hard to read. This is where XLOOKUP clearly wins.
5. Two-way lookup (row and column)
Sometimes the column you need isn't fixed. To get the Stock value for "Webcam HD", with both the row and the column found by name:
=INDEX(A1:E11, MATCH("Webcam HD", B1:B11, 0), MATCH("Stock", A1:E1, 0))
=XLOOKUP("Webcam HD", B2:B11, XLOOKUP("Stock", A1:E1, A2:E11))
Both return 73. In the XLOOKUP version, the inner XLOOKUP returns the whole Stock column (E2:E11), and the outer one finds the row. Many people find the INDEX version with two MATCH functions easier to follow here, so both are reasonable choices.
How it works
- MATCH returns a position.
MATCH("P-1007", A2:A11, 0)returns 7, because P-1007 is the 7th item in the range. - INDEX returns the value at a position.
INDEX(D2:D11, 7)returns the 7th price. - XLOOKUP does both steps in one function. You give it a lookup range and a return range of the same size.
Because both approaches point to the return column directly, not by a column number, inserting or deleting columns in the table won't make them return the wrong column the way a hard-coded VLOOKUP column index can.
Side-by-side comparison
| Feature | INDEX MATCH | XLOOKUP |
|---|---|---|
| Excel versions | All versions | Microsoft 365, Excel 2021 and later, Excel for the web |
| Google Sheets | Yes | Yes |
| Default match type | Approximate (you must type 0) | Exact |
| Built-in "not found" value | No (use IFNA) | Yes (4th argument) |
| Search from last to first | Needs a workaround | Yes (search_mode -1) |
| Lookup to the left | Yes | Yes |
| Case-sensitive | No | No |
Common mistakes
- Leaving out the 0 in MATCH.
MATCH(value, range)without the third argument does an approximate match on sorted data. On an unsorted list, it can return a wrong row without any error. Always type0for an exact match. - Ranges of different sizes. In XLOOKUP,
A2:A11andD2:D12don't line up, and the formula returns#VALUE!. In INDEX MATCH, mismatched ranges may return a value from the wrong row instead. Keep both ranges on the same rows. - Sending an XLOOKUP file to someone on an older version. Excel 2019 and earlier don't have XLOOKUP, so the formula won't work there. If you don't know what version your readers use, INDEX MATCH is the safer choice.
- Forgetting absolute references. When you copy a formula down, lock the ranges:
$A$2:$A$11. Otherwise the ranges shift and lookups near the bottom start failing. - Expecting case-sensitive results. "p-1007" and "P-1007" are treated as the same value by both functions.
FAQ
Is XLOOKUP faster than INDEX MATCH?
For normal-sized sheets, you won't notice a difference. Choose based on version support and readability, not speed.
Should I rewrite my old INDEX MATCH formulas as XLOOKUP?
There's no need if they work. INDEX MATCH is not deprecated. Use XLOOKUP for new formulas if your whole team has a version that supports it.
Does XLOOKUP work in Google Sheets?
Yes. Google Sheets supports XLOOKUP with the same argument order, so the formulas in this article can be used there as written.
Can XLOOKUP return more than one column?
Yes. If the return range is several columns wide, for example B2:E11, XLOOKUP spills the whole matching row into the cells to the right. INDEX MATCH needs a separate formula for each column, or a column number that changes as you copy across.
Summary
Use XLOOKUP when every user has Excel for Microsoft 365, Excel 2021 or later, or Google Sheets. It's shorter, uses exact match by default, handles "not found" values, and can search from the bottom. Use INDEX MATCH when compatibility with older Excel matters, or when you like the two-MATCH layout for row-and-column lookups. On the same data, both return the same results: $129.00 for P-1007, P-1009 for Desk Mic, and 73 for the Webcam HD stock.
More lookup guides: Lookup & Reference and XLOOKUP tutorials.
Comments
Post a Comment