IFERROR in Excel
IFERROR replaces any formula error with a value you choose: =IFERROR(formula, value_if_error). Its most common job is turning #N/A from a failed lookup into a blank or a friendly message โ but for lookups, IFNA is usually the safer choice.
How Do You Wrap a Lookup in IFERROR?
Put the entire lookup as the first argument and the fallback as the second; the fallback only appears when the lookup errors.
=IFERROR(VLOOKUP(A2, Products!A:C, 3, FALSE), "Not found")
' Returns the price, or "Not found" if A2 isn't in the list
=IFERROR(VLOOKUP(A2, Products!A:C, 3, FALSE), 0)
' Returns 0 instead โ useful when the result feeds a SUM
=IFERROR(B2/C2, "")
' Classic divide-by-zero guard: blank instead of #DIV/0!
IFNA vs IFERROR: Which Should You Use?
IFNA only catches #N/A (the "value not found" error), while IFERROR swallows every error โ including #REF!, #NAME?, and #VALUE! that signal a broken formula, not missing data.
' Column got deleted, so the lookup is broken:
=IFERROR(VLOOKUP(A2, Products!A:C, 4, FALSE), "Not found")
' Shows "Not found" โ the #REF! bug is invisible
=IFNA(VLOOKUP(A2, Products!A:C, 4, FALSE), "Not found")
' Still shows #REF! โ you see the real problem
Rule of thumb: use IFNA around lookups so genuine bugs stay visible, and reserve IFERROR for cases where any error genuinely means "no result," like division guards.
How Do You Nest IFERROR With VLOOKUP or XLOOKUP?
Nesting IFERROR lets you fall through to a second lookup table when the first misses; with XLOOKUP you often don't need the wrapper at all because it has a built-in if_not_found argument.
' Try current price list, then archive, then give up
=IFERROR(VLOOKUP(A2, Current!A:B, 2, FALSE),
IFERROR(VLOOKUP(A2, Archive!A:B, 2, FALSE), "Missing"))
' XLOOKUP: fallback is the 4th argument, no wrapper needed
=XLOOKUP(A2, Products!A:A, Products!C:C, "Not found")
Common Pitfalls
- Masking real bugs: IFERROR around everything hides typos like
#NAME?from a misspelled function. Debug the bare formula first, wrap it last. - Returning "" into math: a blank text fallback breaks downstream arithmetic with
#VALUE!. Return 0 when the result feeds calculations. - IFERROR is not IF(ISERROR()): the old
=IF(ISERROR(f), x, f)pattern computes the formula twice. IFERROR evaluates it once. - IFNA availability: IFNA needs Excel 2013 or later; IFERROR works from 2007 onward.
Pro Tip: During development, leave lookups unwrapped so errors surface immediately. Add IFNA as the final polish step before sharing the workbook โ not as a reflex on every formula you write.
โ Back to Excel Tips