XLOOKUP is the simpler starting point for most new exact-match lookups. INDEX MATCH is useful when another person needs to open the workbook in Excel 2016 or 2019. Both can return values from either side of the lookup column.
The key difference is their default: XLOOKUP looks for an exact match, while
MATCH needs an explicit 0 to do that. Microsoft’s
XLOOKUP reference
and MATCH reference
document these behaviours.
XLOOKUP and INDEX MATCH compared
| Requirement | XLOOKUP | INDEX MATCH |
|---|---|---|
| Microsoft 365, Excel 2021 or Excel 2024 | Supported | Supported |
| Perpetual Excel 2016 or 2019 | Not available | Supported |
| Exact match on an unsorted list | Default behaviour | Set MATCH’s third argument to 0 |
| A message when no record matches | Use if_not_found |
Handle #N/A, for example with IFNA |
| Find the last matching row | Set search_mode to -1 |
Requires a different formula approach |
| Return adjacent columns | One formula can spill multiple results | Often separate INDEX formulas |
| Find a row-and-column intersection | Nest two XLOOKUP functions | Use INDEX with two MATCH functions |
Check the versions used by everyone receiving the workbook. The examples below use English function names and commas; your regional settings may use semicolons between arguments.
Worked example: find a department by employee ID
Enter this fictional data in D1:F5, including the headers. Type E103 in
A2.
| Row | D — ID | E — Department | F — Manager |
|---|---|---|---|
| 2 | E101 | Operations | Priya |
| 3 | E102 | Finance | Alex |
| 4 | E103 | Sales | Jordan |
| 5 | E104 | Finance | Mina |
In an empty cell, try XLOOKUP:
=XLOOKUP(A2,$D$2:$D$5,$E$2:$E$5,"Not found")
The result is Sales. Excel searches D2:D5 for the ID and returns the department from the matching position in E2:E5.
The equivalent INDEX MATCH formula is:
=IFNA(INDEX($E$2:$E$5,MATCH(A2,$D$2:$D$5,0)),"Not found")
MATCH returns 3, the position of E103 in the four-row ID range. INDEX
returns the third department. IFNA
handles #N/A; unlike IFERROR, it does not hide every type of formula error.
Check the result before copying the formula into a real report:
| Value in A2 | Expected result from either formula |
|---|---|
| E101 | Operations |
| E103 | Sales |
| E104 | Finance |
| E999 | Not found |
The dollar signs keep the source ranges fixed when the formula is copied. For an expanding dataset, convert the source to an Excel Table and use its column names so that new records can become part of the lookup range.
Why the 0 in MATCH matters
For an ID lookup, use:
=MATCH(A2,$D$2:$D$5,0)
Omitting 0 selects approximate matching, which expects ascending data. That
can return an incorrect position or an error when the data or intended match
does not meet those rules. A plausible department is not proof that the formula
found the correct employee.
Exact-match MATCH also recognises * and ? in text lookup values. To search
for a literal wildcard character, escape it with ~. Do not silently remove
punctuation from product codes or identifiers to make a match succeed.
Return two columns with XLOOKUP
Using the same sample, put this formula in an empty area outside an Excel Table, with two adjacent cells available:
=XLOOKUP(A2,$D$2:$D$5,$E$2:$F$5,"Not found")
With E103 in A2, it returns Sales and Jordan. If #SPILL! appears,
check whether another value or merged cell blocks the output area.
Find the last matching record
Suppose you append a fifth record in D6:F6: E103, Support, Taylor.
This formula searches from the bottom:
=XLOOKUP(A2,$D$2:$D$6,$E$2:$E$6,"Not found",0,-1)
It returns Support, while a first-to-last lookup over the same range returns Sales. Last in the range only means latest in time if your data is arranged that way. If a date defines the required record, state that rule explicitly.
Two-way lookup: match a department and a month
On a new sheet, enter this fictional table in K1:N4. Put Sales in H2
and Feb in I2.
| Department | Jan | Feb | Mar |
|---|---|---|---|
| Operations | 120 | 135 | 150 |
| Finance | 80 | 100 | 90 |
| Sales | 160 | 175 | 200 |
INDEX MATCH makes the two positions explicit:
=INDEX($L$2:$N$4,MATCH(H2,$K$2:$K$4,0),MATCH(I2,$L$1:$N$1,0))
A nested XLOOKUP reaches the same cell:
=XLOOKUP(H2,$K$2:$K$4,XLOOKUP(I2,$L$1:$N$1,$L$2:$N$4))
Both return 175. Change H2 to Finance: the result should become 100.
Use the version that the people maintaining the workbook can check reliably.
Fix common lookup problems
| Symptom | What to check |
|---|---|
#NAME? or _xlfn.XLOOKUP |
Whether the Excel version supports XLOOKUP; also check spelling and named ranges |
#N/A or an unexpected not-found message |
Missing ID, spaces, text-versus-number differences, or a range that omits the record |
| Correct-looking but wrong record | Approximate matching, duplicate IDs, or a first-versus-last rule that differs from your intention |
#VALUE! in XLOOKUP |
Whether lookup and return arrays have compatible dimensions |
#SPILL! |
Whether the output cells are clear and the spill formula is outside an Excel Table |
| New records are missed | Whether fixed ranges need expanding or should become Table references |
Performance and replacing VLOOKUP
Do not choose solely on claims that one function is always faster. Microsoft’s Excel performance guidance explains how lookup design, ranges and matching affect calculation. Test the actual workbook if calculation time is a problem.
A VLOOKUP with a hard-coded return-column number can become fragile when the table layout changes. That is a reason to review it, rather than evidence that every VLOOKUP is wrong. When migrating, compare known matches, missing values, duplicates and boundary cases before replacing the original.
Practise formulas with an instructor
Use the free practice pack to change the lookup code, try a missing ID and compare first versus last duplicates. Its Lookups sheet includes working formulas and fixed original answers. The workbook uses labelled areas at different cell coordinates from the blank-sheet example above; follow the formulas supplied in the file when using that layout.
For conditional logic and calculations using tables and named ranges, compare the Excel Advanced Functions course. For modern spill and lookup functions, read the Excel Expert Functions outline and its starting-skill requirements. The Excel course comparison helps you choose the level; each outline links to current dates and fees.
For a related worked example, use the Excel IFS guide to compare formula conditions with thresholds stored in a lookup table.
Work through the same example yourself: download the practice workbook. No sign-up required.
Common questions
- Is XLOOKUP better than INDEX MATCH?
- XLOOKUP is usually simpler for a single lookup and offers exact matching by default, a not-found argument and reverse search. INDEX MATCH remains useful for Excel 2016 or 2019 compatibility and for calculations with separate row and column matches. Choose for the workbook's requirements rather than a universal ranking.
- Which Excel versions support XLOOKUP?
- Microsoft documents XLOOKUP for Microsoft 365 and Excel 2021 and 2024, including their Mac versions. It is also available in Excel for the web. It is not available in perpetual Excel 2016 or 2019.
- Is XLOOKUP faster than INDEX MATCH or VLOOKUP?
- There is no reliable speed ranking for every workbook. Excel version, range size, search mode, sorted data and repeated calculations affect performance. Check representative results and time the actual workbook before changing formulas for speed.
- Can XLOOKUP and INDEX MATCH look left?
- Yes. Both can use a return range to the left of the lookup range. With INDEX MATCH, use MATCH with 0 for an exact match on unsorted data.
- Should I replace every VLOOKUP formula?
- No. First check compatibility and whether the existing formula is correct and maintainable. XLOOKUP can simplify new formulas; INDEX MATCH can preserve older-version compatibility. Compare outputs before replacing a working formula, especially if its existing match is approximate.
