IFERROR — The Protective Clause
The natural companion to IF. Where IF checks a condition you write, IFERROR checks whether a formula produced an error and swaps it for your fallback. Catches all 7 Excel error types. The single most important function for building resilient dashboards, lookup-heavy sheets, and any workbook you'll share with humans.
REF error because you deleted a row, IFERROR silently returns your fallback instead of flagging the problem. Use IFERROR for expected errors (missing lookup, zero denominator, optional cell). Never as a catch-all bug hider. When in doubt, wrap the specific inner formula, not the whole expression — or prefer IFNA which only catches the "not found" case.Syntax breakdown
IFERROR takes just two arguments. Both are required.
| Argument | Type | What it does |
|---|---|---|
value |
REQUIRED | The formula or expression to try. Anything that might error: a division, a lookup, a math operation, a nested calculation. IFERROR evaluates this first. |
value_if_error |
REQUIRED | What to return if value produced ANY of the 7 error types. Text (in quotes), number, cell reference, or another formula — including another IFERROR for cascading. |
value first. Only if value returns an error does IFERROR evaluate value_if_error. This is short-circuit behavior — critical when your fallback is itself expensive (like another lookup).
Five working examples
Every example uses the same 24-row sales log as the IF and IFS family pages. Same Q1 2026 data, plus supplementary tables for quota and product-code demonstrations.
01 DIV/0 guard — the classic use case
Commission attainment = sales ÷ quota. Some quotas are $0 (new reps, unassigned territories). Division breaks. IFERROR fixes it.
| Salesperson | Quota | Sales | Naive: =D/C | IFERROR wrapped |
|---|---|---|---|---|
| Emma Thompson | $50,000 | $26,319.60 | 52.6% | 52.6% |
| David Kim | $0 | $28,749.40 | DIV/0 error | — |
| Sofia Rodriguez | $40,000 | $7,749.50 | 19.4% | 19.4% |
| Michael Chen | $45,000 | $32,649.55 | 72.6% | 72.6% |
| Aisha Patel | $30,000 | $16,179.35 | 53.9% | 53.9% |
| James Wilson | $0 | $21,024.75 | DIV/0 error | — |
The wrapped column stays clean — a mix of percentages and "—" that a dashboard can render, a SUM can skip, and a human can read. The naive column breaks any downstream aggregation that touches it.
02 VLOOKUP fallback — turn N/A into a message
When a lookup fails, VLOOKUP returns #N/A. IFERROR turns that into text users can understand.
Simple fallback
Formatted fallback (helps the operator)
| Code | Qty | Naive VLOOKUP | IFERROR wrapped |
|---|---|---|---|
| W-A | 12 | Widget A | Widget A |
| G-P | 5 | Gizmo Pro | Gizmo Pro |
| W-C | 8 | N/A error | Unknown code |
| B-X | 3 | Bundle X | Bundle X |
| G-Z | 15 | N/A error | Unknown code |
N/A error propagates. Any downstream SUMIF, COUNTIF, or reference that touches the N/A cell will ALSO error. Wrapping VLOOKUP keeps the value cell "clean" (text or number), so aggregations and dashboards stay working.
03 Cascade chain — try this, then that, then default
Nested IFERROR lets you try multiple lookup strategies in order, falling through until one works. The killer use case.
Reads: try table 1. If that errors, try table 2. If THAT errors, return "Not found". Progressive fallback through as many strategies as you need.
Common real-world cascades:
- Cache → main → default. Local cache table first (fastest), main table second (authoritative), text default last.
- Current year → prior year → default. Lookup this year's data first; if missing, use last year's; if that's missing, "N/A".
- Exact match → approximate match → default. Try
VLOOKUP(...,FALSE); if that fails,VLOOKUP(...,TRUE); if that fails, default.
The cascade pattern, visualized
Nested IFERROR is the pattern most beginners struggle with. Here's exactly how Excel reads a 2-level cascade — one attempt at a time, falling through on error:
How Excel reads the cascade
04 IFERROR vs IFNA — which one to use?
Excel 2013 added IFNA, a stricter cousin of IFERROR that catches ONLY the N/A error. Sometimes stricter is better.
The problem with IFERROR: it catches everything, including bugs. If you delete a row and a formula gets a REF error, IFERROR silently swaps in your fallback. You never learn the reference is broken.
What IFNA does differently: it catches ONLY N/A — the "not found" outcome. If your formula produces any OTHER error, IFNA lets it surface. Perfect for lookup-heavy work where "not found" is the only expected failure.
The 7 Excel error types, side-by-side
Excel has exactly 7 error types. Here's what each one means, what causes it, whether IFERROR/IFNA/ISERROR catch it, and whether wrapping is even the right response:
| Error | What it means | Wrap it? | IFERROR | IFNA | ISERROR |
|---|---|---|---|---|---|
| #DIV/0! | Division by zero | Yes, when 0 is possible | ✓ | ✗ | ✓ |
| #VALUE! | Wrong data type | No — usually a bug | ✓ | ✗ | ✓ |
| #REF! | Broken reference | No — always a bug | ✓ | ✗ | ✓ |
| #NAME? | Unknown function or range | No — always a bug | ✓ | ✗ | ✓ |
| #N/A | Lookup found no match | YES — the main case | ✓ | ✓ | ✓ |
| #NULL! | Empty range intersection | No — always a bug | ✓ | ✗ | ✓ |
| #NUM! | Invalid number (sqrt of negative, non-convergent IRR) | Yes, for optional calcs | ✓ | ✗ | ✓ |
IFERROR vs IFNA vs ISERROR — a three-way comparison
Three functions in the "check for errors" family. Same problem, different tools. When to reach for which:
| Aspect | IFERROR | IFNA | ISERROR |
|---|---|---|---|
| Introduced | Excel 2007 | Excel 2013 | Excel 1.0 |
| Catches | All 7 errors | N/A only | All 7 (returns TRUE/FALSE) |
| Returns | Value or fallback | Value or fallback | TRUE or FALSE |
| Evaluates value... | Once | Once | Once (with IF: twice) |
| Typical use | Wrap fragile calc, keep math clean | Wrap VLOOKUP, let bugs surface | Legacy Excel 2003 pattern |
| Best for | Multi-cause failures | Lookup-only work | Legacy or when you need TRUE/FALSE |
Interactive playground
Try it Live IFERROR demonstration
Mirrors live cells from the workbook. Edit the yellow input, watch the blue result update.
Download the workbook to try the cascade sheet and IFERROR vs IFNA comparison live.
The IFERROR cheat sheet — 10 patterns for daily use
Copy any of these, adapt the ranges to your data, and you're covered for the most common IFERROR scenarios:
10 patterns you'll use every day
From basic DIV/0 guards to cascades and IFNA alternatives. Every one is a copy-paste starting point.
Common IFERROR pitfalls
IFERROR itself rarely errors — but the way people use it does. Six scenarios to avoid:
| Problem | Why it happens | Broken → Fix |
|---|---|---|
| Bug swallower | Wrapped too much — an inner REF bug looks like "Not found." | =IFERROR(SUM(A:A)/VLOOKUP(...), 0)
=SUM(A:A)/IFERROR(VLOOKUP(...), 1) // wrap only the fragile part |
| Silent 0 | Fallback of 0 makes empty matches look like real zeros in aggregations. | =IFERROR(VLOOKUP(...), 0) // sums include phantom zeros
=IFERROR(VLOOKUP(...), "") // blank instead — safer for aggregations |
| Wrong function | Used IFERROR when only N/A was expected — hid a legitimate REF bug. | =IFERROR(VLOOKUP(...), "Not found")
=IFNA(VLOOKUP(...), "Not found") // lets REF/VALUE surface |
| Missing 2nd arg | IFERROR needs BOTH arguments. Excel doesn't accept a one-arg version. | =IFERROR(VLOOKUP(...)) // returns TRUE/FALSE (wrong)
=IFERROR(VLOOKUP(...), "") // always give the fallback |
| Legacy pattern | Still using IF+ISERROR out of habit. Evaluates the formula twice. | =IF(ISERROR(D/C), "—", D/C) // D/C runs twice
=IFERROR(D/C, "—") // D/C runs once |
| Wrapped constant | IFERROR around a value that can't error. Just dead code. | =IFERROR("Hello", "fallback") // never errors
="Hello" // remove the wrapper |
IFERROR is IF, specialized for errors
A2>100) and picks one of two branches. IFERROR takes a formula and picks the value OR the fallback based on whether the formula errored. Both are conditional; IFERROR just automates the "did this thing break?" check. Legacy Excel used =IF(ISERROR(x), fallback, x) — literally IF + a "did it error" boolean. IFERROR compressed that pattern into one function and evaluates the inner formula only once.Companion functions worth knowing
Natural wrap targets — functions IFERROR commonly guards
Excel version compatibility
IFERROR shipped in Excel 2007. For older versions, use the IF+ISERROR pattern:
| Platform | Supports IFERROR? | Notes |
|---|---|---|
| Excel 365 (Windows & Mac) | ✓ Yes | Full support |
| Excel 2021 / 2019 / 2016 / 2013 / 2010 / 2007 | ✓ Yes | Full support |
| Excel 2003 and earlier | ✗ No | Use IF+ISERROR pattern |
| Excel for the web | ✓ Yes | Full support |
| Excel on iPad & iPhone | ✓ Yes | Full support |
| Google Sheets | ✓ Yes | Same syntax |
| LibreOffice Calc | ✓ Yes | Full support |
| Apple Numbers | ✓ Yes | Full support |
When to use IFERROR vs. alternatives
Use IFERROR when…
- Multiple error types are expected. A formula that could DIV/0 AND miss a lookup.
- You want compact syntax. Cleaner than IF+ISERROR.
- Cross-version compatibility matters. Works in Excel 2007+ everywhere.
Use IFNA instead when…
- You're wrapping a VLOOKUP, XLOOKUP, MATCH, or INDEX/MATCH.
- The ONLY expected failure is "not found."
- You want other bugs (REF, VALUE, NAME) to surface as they should.
Use XLOOKUP's built-in fallback instead when…
- You're on Excel 365 or 2021 and using XLOOKUP anyway.
- The 4th argument of XLOOKUP is a native "if not found" — no wrap needed.
Use IF+ISERROR (legacy) when…
- You must support Excel 2003 or earlier.
- The success and error branches need genuinely different logic (like multiplying success by 2, or logging errors somewhere).
Don't wrap at all when…
- The error indicates a real bug (REF, VALUE, NAME) — fix the bug instead.
- The formula can't produce an error (wrapping a constant is pointless).
How IFERROR actually works
The algorithm
IFERROR evaluates the first argument. If the result is any of the 7 error values (#DIV/0!, #VALUE!, #REF!, #NAME?, #N/A, #NULL!, #NUM!), IFERROR discards it and evaluates the second argument instead. Otherwise, it returns the first argument's value.
Short-circuit evaluation
The second argument is only evaluated if the first errors. This matters when the fallback is expensive — like another VLOOKUP or a complex calculation. In a cascade like IFERROR(A, IFERROR(B, C)), C is only computed when both A and B fail.
The value once — vs the legacy pattern
IFERROR evaluates value exactly once. The legacy IF(ISERROR(x), fallback, x) pattern evaluates x twice — once for the ISERROR check, once for the return value. For complex formulas (large VLOOKUPs, nested SUMIFS), this doubles the calculation cost. IFERROR is measurably faster on real workbooks.
What "error" means to IFERROR
- Excel errors: the 7 hash-prefixed values are all caught.
- Empty cells: NOT errors. IFERROR passes empty results through.
- Zero: NOT an error. Only DIV/0 is; a legitimate 0 result is returned as-is.
- Text where number expected: depends — some functions coerce, some return VALUE.
Performance notes
IFERROR is fast — comparable to any two-argument function. Two considerations:
- Deep cascades. Nested IFERROR calls compound. A 5-level cascade is 5 potential formula evaluations, though short-circuit keeps most cases at 1-2.
- Volatile fallbacks. If your fallback is
NOW()orTODAY(), the whole IFERROR becomes volatile-triggered, recomputing on every recalc. Prefer static fallbacks or reference cells that hold volatile values.
Faster than the legacy pattern
IFERROR runs the inner formula ONCE. IF+ISERROR runs it TWICE. On a workbook with 100,000 IFERROR-wrapped VLOOKUPs, that's a real difference — often 30-40% faster recalc times when migrating from IF+ISERROR.
How to write an IFERROR from scratch
-
Identify the fragile formula
Ask: "What could break here?" Division by an empty cell, a VLOOKUP against a table that might not contain the key, a SUM over cells that might be text.
-
Wrap it as the first argument
Copy the fragile formula into
=IFERROR(...). Nothing else changes about the formula itself. -
Choose your fallback deliberately
Number for aggregations, text for display, empty string for "act blank." Not a random value — pick one that makes sense downstream.
-
Prefer IFNA if it's a lookup
If N/A is the only expected failure, use IFNA. This is often the right call — you WANT to know if you get a REF error.
-
Chain for cascades, not for safety
Nested IFERROR is for progressive fallback (try this, then that). It's NOT for wrapping "just in case" — that path leads to bug-swallowing.
Functions used with IFERROR
Frequently asked questions
What errors does IFERROR catch?
All 7 Excel error types: #DIV/0!, #VALUE!, #REF!, #NAME?, #N/A, #NULL!, and #NUM!. If you want to catch ONLY N/A (leaving other bugs visible), use IFNA instead.
What's the difference between IFERROR and IFNA?
IFERROR catches all 7 error types. IFNA catches only #N/A. IFNA is stricter and preferred for lookup-heavy work because it lets other bugs (REF, VALUE, NAME) surface as they should. IFNA shipped in Excel 2013; older versions must use IFERROR.
Why is my IFERROR returning the wrong value?
Almost always because it's swallowing a bug you didn't mean to catch. Delete a row, get a REF error, IFERROR silently returns your fallback. Debug by temporarily removing the IFERROR wrap to see the underlying error, then decide whether to fix it or wrap it deliberately.
Does IFERROR work in Google Sheets?
Yes, identically. Google Sheets, LibreOffice, and Apple Numbers all implement IFERROR with the same syntax and semantics as Excel.
Can I nest IFERROR statements?
Yes — that's the cascade pattern. =IFERROR(A, IFERROR(B, C)) tries A, falls back to B, falls back to C. Common for progressive lookups: try local cache, then main table, then default text.
Should I always wrap VLOOKUP in IFERROR?
Not always. If missing values are expected (partner data, optional lookups), yes. If VLOOKUP failing means your data is corrupted, no — let it error so you SEE the corruption. For most cases, prefer IFNA over IFERROR when wrapping lookups.
Is IFERROR faster than IF+ISERROR?
Yes, typically 2x faster. IFERROR evaluates the inner formula once. IF+ISERROR evaluates it twice — once for the ISERROR check, once for the return value. On heavy workbooks (10,000+ IFERROR wraps), this compounds to significant recalc time savings.
Does IFERROR require both arguments?
Yes. Both value and value_if_error are required. Excel does NOT accept a one-argument version. If you want "return value or empty string on error," use =IFERROR(formula, "").
How do I catch only some errors and not others?
Use ERROR.TYPE with IF: =IF(ERROR.TYPE(A2)=2, "DIV/0 caught", A2). ERROR.TYPE returns 1-7 for each error type (or #N/A if there's no error). Rarely needed — IFNA usually handles the "just this one" case.
Can IFERROR return a formula instead of a value?
Yes — the second argument can be a formula, cell reference, or another function call. That's how cascade chains work. Just be aware the fallback formula ONLY runs when the first argument errors.
What's the difference between IFERROR and XLOOKUP's fallback argument?
XLOOKUP has "if not found" as its 4th argument — a built-in fallback that avoids needing IFERROR at all. =XLOOKUP(A2, keys, vals, "Not found") is cleaner than =IFERROR(XLOOKUP(...), "Not found"). Prefer the built-in when using XLOOKUP.
Which templates use IFERROR?
Most templates that involve lookups. Invoice (customer lookup), Sales Dashboard (product master), KPI Dashboard (ratio calculations that could divide by zero), Budget Tracker (category totals), Expense Report, Loan Calculator, Inventory Tracker (SKU lookup), and Project Timeline (task-to-owner lookup) all use IFERROR to keep the display clean when inputs are missing.
Templates that use IFERROR
8 of our 10 templates use IFERROR — anywhere lookups or ratios might fail on missing data:
Skip the syntax. Ask in plain English.
The Sheets & Cells AI Add-in writes IFERROR wraps, IFNA guards, and cascade chains — right inside Excel. Type "wrap this VLOOKUP so missing codes show 'not in master'" and get the working formula, ready to paste.
Try the AI Add-in →