IFERROR catches errors in your formulas and replaces them with something you choose — a blank, a message, or an alternative calculation. It's the clean way to handle the errors that inevitably show up in real spreadsheets.
The syntax
=IFERROR(value, value_if_error)
- value — the formula that might produce an error.
- value_if_error — what to show instead if it does.
Example — a lookup that might not find a match:
=IFERROR(VLOOKUP(A2, D:E, 2, FALSE), "Not found")
If the VLOOKUP works, you get the result. If it errors (because the value isn't found), you get "Not found" instead of an ugly #N/A.
What it catches
IFERROR catches all Excel error types: #N/A, #VALUE!, #REF!, #DIV/0!, #NAME?, #NULL!, and #NUM!. If the formula produces any of these, the error value is returned instead.
Common uses
Cleaning up lookups. The most frequent use — replacing #N/A from VLOOKUP, INDEX/MATCH, or XLOOKUP with a friendly message or blank.
Avoiding divide-by-zero. Instead of #DIV/0! when a denominator is empty:
=IFERROR(B2/C2, 0)
Showing blanks instead of errors. Use "" to return an empty-looking cell:
=IFERROR(B2/C2, "")
The overuse warning
IFERROR is genuinely useful, but it's easy to misuse: it hides every error, including ones you'd want to know about. If your formula is producing #REF! because a reference is genuinely broken, wrapping it in IFERROR just hides the bug — the underlying problem is still there, now invisible.
Use IFERROR when you expect a specific, harmless error (like a lookup that legitimately won't always find a match). Don't use it to paper over errors you haven't diagnosed. If you're not sure why a formula errors, fix the cause first, then add IFERROR only for the errors you expect in normal use.
IFERROR vs IFNA
Excel also has IFNA, which catches only #N/A errors and lets all others through:
=IFNA(VLOOKUP(A2, D:E, 2, FALSE), "Not found")
This is often the safer choice for lookups, because it handles the expected "not found" case while still letting genuine errors (#REF!, #VALUE!) surface so you can catch real bugs. If you only want to handle not-found results, IFNA is more precise than IFERROR.
The takeaway
IFERROR keeps your spreadsheets clean by replacing errors with sensible values — but use it deliberately. Catch the errors you expect, and let the ones you don't expect show themselves so you can fix them.