INDEX/MATCH is the classic two-function lookup: MATCH finds the row, INDEX returns the value. XLOOKUP does the same in one function with separate lookup and return arrays and a built-in if_not_found argument. An AI assistant may write INDEX/MATCH out of habit, which is fine when the workbook must run in older Excel, but needlessly hard to read when XLOOKUP is available. Check which versions the workbook must support before choosing.
What you need
- The AI-written INDEX/MATCH formula
- The lookup table with its key and return columns labelled
- Which Excel versions the workbook must open in
Step 1: Read what the INDEX/MATCH actually does
Click the formula cell and read the MATCH part first: it finds the position of the lookup value in one column. Then read the INDEX part: it returns the value at that position from the return column. Write down the lookup value, the searched column and the return column.
Step 2: Write the same lookup as one XLOOKUP
In a spare cell, write the XLOOKUP with the same lookup value, the same searched column and the same return column, and add a fourth argument for the value to show when nothing matches. Compare the two results on a known lookup value.
Step 3: Keep the version that fits the workbook
If the workbook must open in Excel 2016 or 2019, keep INDEX/MATCH, because XLOOKUP is not available there. If every reader uses Microsoft 365 or Excel 2021 or later, keep the XLOOKUP version and delete the spare cell.
Worked example: synthetic product price list
The table below is a synthetic example. It shows the expected result of checking an AI-written INDEX/MATCH lookup; no formula was run.
| Check | Value | Result |
|---|---|---|
| Lookup value tested | P-104 | Known product |
| INDEX/MATCH result | 42 | Correct price |
| XLOOKUP result | 42 | Same price |
| Formula kept | XLOOKUP | Shorter, same answer |
Expected result (UNTESTED). both formulas return 42 for P-104, so the lookup is correct either way; the XLOOKUP version is kept because the workbook only needs Microsoft 365. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- XLOOKUP is not available in Excel 2016 or Excel 2019, so a workbook shared with those versions shows #NAME?.
- INDEX/MATCH can look left as well as right, so it is not always the weaker choice; check the direction first.
- A MATCH with match type 0 needs an exact match, while a MATCH with 1 or -1 needs sorted data.
- Both approaches return the first match when the key appears twice, so duplicates still need a separate check.
