IFERROR in Excel: Handle Errors Gracefully
IFERROR Formula is a Excel function that iferror evaluates the first argument. Formula Genius generates and validates this formula automatically from a plain-English prompt.
Stop ugly error messages from appearing in your spreadsheets. IFERROR catches any error and returns a clean fallback value.
The Formula
"Return 0 instead of a #DIV/0! error when dividing"
=IFERROR(A2/B2,0)
IFERROR evaluates the first argument. If it produces any error (#DIV/0!, #N/A, #REF!, etc.), it returns the second argument instead. If no error, it returns the normal result.
Step-by-Step Breakdown
- A2/B2 is evaluated first — the normal calculation
- If B2 is 0 or empty, this produces #DIV/0!
- IFERROR catches the error and returns 0 instead
- Works for ALL error types: #N/A, #VALUE!, #REF!, #DIV/0!, #NAME?, #NULL!, #NUM!
Edge Cases & Warnings
- IFERROR catches ALL errors — this can hide real bugs. Use IFNA for VLOOKUP/XLOOKUP specifically
- Nested IFERROR formulas can mask data quality issues
- Consider IFERROR(formula, "") to return blank instead of 0
- In Excel 2013+, IFNA only catches #N/A errors (more specific)
Examples
"A2=100, B2=0"
0 (instead of #DIV/0!)
"A2=100, B2=5"
20 (normal division result)
Frequently Asked Questions
Should I wrap every formula in IFERROR?
No. Only use IFERROR where errors are expected and acceptable (like VLOOKUP not finding a match). Blanket IFERROR usage hides real problems in your data.
What's the difference between IFERROR and IFNA?
IFERROR catches all errors. IFNA only catches #N/A. Use IFNA with VLOOKUP/XLOOKUP to catch missing matches without hiding other error types.
Can't find what you need?
Describe any formula in plain English and Formula Genius will generate, explain, and validate it — instantly.