A single missing value or stray divide-by-zero can splatter #N/A and #DIV/0! across a whole report. IFERROR wraps a formula and swaps any error for a clean fallback — a blank, a zero, or a friendly message.
The example
Dividing units by hours — one row has zero hours, which would error.
| A | B | C | |
|---|---|---|---|
| 1 | Units | Hours | Per hour |
| 2 | 120 | 8 | 15.0 |
| 3 | 90 | 0 | n/a |
| 4 | 75 | 5 | 15.0 |
The formula
Guarding the division:
How it works
IFERROR runs the formula and only steps in on failure:
- IFERROR first evaluates
A2/B2. - If it returns a normal value (15.0), that’s what you see — IFERROR is invisible.
- If it returns any error (
#DIV/0!,#N/A,#VALUE!…), IFERROR returns the second argument instead —"n/a". - Use
""for a blank,0to keep totals working, or text to explain the gap.
Don’t hide errors you should see. IFERROR catches every error type, so a genuine #REF! from a broken formula gets silently swallowed too. When you only want to handle “not found,” use IFNA — it catches just #N/A and lets real bugs surface.
Try it: interactive demo
Change the hours; see how IFERROR handles a divide-by-zero.
Variations
Catch only "not found" with IFNA
Lets real errors through, hides only #N/A:
Fallback to a second lookup
Try one source, then another:
Keep sums working with 0
So an error doesn’t break a downstream SUM:
Pitfalls & errors
IFERROR masks all errors. A typo that throws #NAME? looks “handled” and you never notice. Use the narrowest catch (IFNA) when you can.
It recalculates the formula twice in the fallback pattern. =IFERROR(big(), big()) runs big() again on error; on heavy formulas that’s slow. Modern XLOOKUP has a built-in if_not_found that avoids this.
IFERROR is Excel 2007+. In Excel 2003 use =IF(ISERROR(x), fallback, x).
Practice workbook
Frequently asked questions
How do I get rid of #DIV/0! and #N/A errors in Excel?
What's the difference between IFERROR and IFNA?
Should I use IFERROR around VLOOKUP or XLOOKUP?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class