XLOOKUP takes three ranges: the value to find, the column to search, and the column to return. An AI assistant can point the return array at the wrong column, often the one next to the right one, and the formula still returns a clean-looking value from the wrong column. The only defence is to read all three ranges and check one returned value by hand.
What you need
- The AI-written XLOOKUP formula
- The lookup table with its columns labelled
- One known lookup value and the answer it should return
Step 1: Read the three ranges in the formula
Click the formula cell and read lookup_value, lookup_array and return_array in order. Check that the lookup array is the column holding the keys and the return array is the column holding the answers you want.
Step 2: Test it with a known lookup value
Pick a lookup value whose correct answer you already know, and work out what the formula returns for it. If the returned value belongs to a different column, the return array is wrong.
Step 3: Point the return array at the right column and re-test
Change the return array to the intended column and re-test with the same known value, then with a second known value from a different row. Both must return the right answers.
Worked example: synthetic product price list
The table below is a synthetic example. It shows the expected result of checking an AI-written XLOOKUP; no formula was run.
| Check | Value | Result |
|---|---|---|
| Lookup value tested | P-104 | Known product |
| Correct answer (price) | 42 | From the price column |
| AI formula return array | Stock column | Wrong column |
| AI formula result | 18 | A stock count, not a price |
| Corrected return array | Price column | Right column |
| Corrected result | 42 | Matches the known price |
Expected result (UNTESTED). the AI formula returns 18, a stock count, because its return array points at the stock column; pointing the return array at the price column returns 42, the known price. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- XLOOKUP returns the first match, so duplicate keys in the lookup column return only the first row’s value.
- XLOOKUP is not available in Excel 2016 or Excel 2019; a workbook using it shows #NAME? there.
- A binary search mode needs sorted data; on unsorted data it returns invalid results.
- If the lookup and return arrays have different sizes, XLOOKUP returns an error instead of a value.
