New Tool Radar

AI for Data & Spreadsheets

How to Check an AI Lookup Formula That Fails on a Missing Value

Fix an AI lookup formula that errors on a missing value by adding a clear not-found message and testing both cases.

Schematic illustration for How to Check an AI Lookup Formula That Fails on a Missing Value: three numbered steps - Find the failing lookup; Add a not-found message; Test present and missing.

A lookup that returns an error on a missing value is doing its job badly: the error hides whether the value is absent or the formula is broken. Adding a not-found message makes the two cases visibly different, and testing both cases proves the fix.

Prerequisites

  • Excel or Google Sheets
  • A lookup formula that returns an error on some rows
  • A copy of the source file, so the original stays untouched.

Steps

  1. Find a row where the lookup returns an error and confirm the lookup value really is absent from the list.
  2. Add a not-found value to the formula, such as Not found in XLOOKUP or IFNA around VLOOKUP.
  3. Test the formula on a value that exists and confirm it still returns the right result.
  4. Test it on a value that is absent and confirm it shows the not-found message, not an error.
  5. Filter the result column for the not-found message and check each one against the source list before acting on it.

Worked example: Fictional stock lookup with a missing item

The practice table below is a fictional five-item stock lookup. The price column is the price found for each SKU, and the total is the sum of the four found prices. The table below is fictional practice material, with fictional values. It is the expected result, worked out by hand, not a run of any tool.

SKU Item Price
ST-201 Notebook 3.50
ST-202 Pen 1.20
ST-203 Folder 2.75
ST-204 Ruler 1.85
ST-209 Not found 0.00
Total 9.30

Expected result. Four prices found, one not-found message, and the found prices add to 9.30. UNTESTED: no AI formula was generated for this guide; the table shows the expected values a check should produce.

Limits

  • A not-found message must never be added into a total, so keep it as text in a separate column.
  • A lookup can also fail because of a trailing space in the lookup value, so check that first.

Sources

See all