Sub topic 2
IFERROR or IFNA: Which One to Use
Assume you can enter and copy formulas, use relative and absolute references, and write basic IF and lookup formulas. Excel error values report different problems, so choose an error handler that matches the problem you expect.
IFERROR or IFNA: Which One to Use
IFERROR evaluates a formula and returns a fallback value if the formula produces any error.
=IFERROR(A2/B2, 0)This returns 0 for errors such as #DIV/0!, #N/A, #VALUE!, or #REF!.
IFNA handles only #N/A, which commonly means that a lookup did not find its search value.
=IFNA(VLOOKUP(E2, $A$2:$B$100, 2, FALSE), "Not found")Use IFNA for a lookup when other errors should remain visible. Use IFERROR when every error has the same expected meaning and fallback.
| Function | Handles | Typical use |
|---|---|---|
| `IFERROR` | Every Excel error value | Safe display of a calculation |
| `IFNA` | Only `#N/A` | Missing lookup result |
Handling Missing Lookup Results
For a lookup with one source, use IFNA around the lookup:
=IFNA(VLOOKUP(E2, $A$2:$B$100, 2, FALSE), "Not found")For two possible sources, nest a second IFNA:
=IFNA(VLOOKUP(E2, Sheet1!$A$2:$B$100, 2, FALSE), IFNA(VLOOKUP(E2, Sheet2!$A$2:$B$100, 2, FALSE), "Not found"))If your Excel version supports XLOOKUP, its if_not_found argument avoids a separate error wrapper:
=XLOOKUP(E2, $A$2:$A$100, $B$2:$B$100, "Not found")Choosing a Replacement Value: 0, Blank, or Message
Choose a replacement that matches the meaning of the missing or failed result:
- Use
0when the result truly means zero and should participate in totals. - Use
""when the cell should look blank. It is text, not an empty cell. - Use a message such as
"Not found"when people need to understand what happened.
A text replacement can cause errors in formulas that perform arithmetic directly on the result. A zero can make missing data look like measured data. Test dependent formulas before choosing.
Exercise
Which function should wrap a VLOOKUP when only a missing key should produce "Missing"?
Show answer
Use IFNA, because it handles #N/A while leaving other errors visible.