New Tool Radar

AI for Data & Spreadsheets

How to Use IFNA So a Lookup Not-Found Shows a Message but Other Errors Stay Visible

Wrap a lookup in IFNA so a missing code shows Not found, while a broken formula still shows its real error.

Schematic with three steps: Wrap the lookup with IFNA; Test a code that is on the; Break the formula on purpose and confirm.

IFNA works like IFERROR but only replaces #N/A, the not-found error of lookups. That is usually what you want: a missing code is a normal answer, while any other error means the formula itself is wrong and should stay visible.

What you need

  • Excel with the lookup table and the lookup column
  • A note of which codes should be found
  • Excel 2013 or later, for IFNA

Step 1: Wrap the lookup with IFNA

Enter =IFNA(VLOOKUP(A2,$H$2:$I$10,2,FALSE),’Not found’) and fill it down. Codes on the list return their value; a code that is not on the list shows Not found instead of #N/A.

Step 2: Test a code that is on the list and one that is not

Look up a code you know is on the list and confirm it returns its value, then look up a code that is not on the list and confirm it shows Not found. A readable message beats a blank, because a blank price on an invoice line is easy to miss.

Step 3: Break the formula on purpose and confirm the error shows

Change the column number to one beyond the table and confirm the cell shows #REF! instead of Not found. IFERROR would have hidden that mistake; IFNA lets it through, so you see the formula is broken.

Worked example: synthetic price lookup

The table below is a synthetic example. It shows the expected result of using IFNA; no workbook was opened.

Lookup Formula used Result
Pear IFNA VLOOKUP 1.50
Kiwi IFNA VLOOKUP Not found
Pear, bad column number IFERROR VLOOKUP Not found – error hidden
Pear, bad column number IFNA VLOOKUP #REF! – error visible

Expected result (UNTESTED). Pear returns 1.50 and Kiwi shows Not found; with a bad column number, IFERROR hides the #REF! as Not found while IFNA lets the #REF! show. Use IFNA for lookups so broken formulas stay visible. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • IFNA needs Excel 2013 or later; IFERROR exists since Excel 2007.
  • XLOOKUP has the not-found message built in as its fourth argument, so IFNA is not needed there.
  • A lookup that returns an empty cell shows 0, which is not an error; test the result with IF to catch it.

Sources

See all