How IFERROR works
IFERROR runs your formula. If it returns a normal value, IFERROR passes that value through untouched. If the formula returns any Excel error, IFERROR swaps in your fallback instead.
It catches every error type at once: #N/A from a missing lookup, #DIV/0! from dividing by zero, #VALUE! from a type mismatch, #REF! from a deleted column, #NAME? from a typo, #NUM!, #NULL!, even the new #CALC!. One wrapper, all errors handled.
That broad reach is also IFERROR's biggest risk. A typo that should surface as #NAME? gets silently replaced by your fallback string and the bug ships to production. When you only want to handle a missing lookup, reach for IFNA instead so real bugs still bubble up.
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
| value | any | ✓ Required | The formula or expression to evaluate. Typically a VLOOKUP, division, INDEX/MATCH, or any calculation that might error. |
| value_if_error | any | ✓ Required | What to return when value evaluates to an error. Common choices: 0 for math fallbacks, "" for blank, "Not found" for lookups, or another formula for a fallback chain. |
IFERROR around a VLOOKUP: kill the #N/A
VLOOKUP returns #N/A when the lookup value isn't in the range. That ugly red error makes a clean report look broken. IFERROR wraps the lookup so missing IDs return a friendly label instead.
Below: a price lookup against a product catalog. Two of the IDs in column D aren't in the catalog. The bare VLOOKUP throws #N/A. The IFERROR-wrapped version returns "Not found" for the same rows.
=IFERROR(VLOOKUP(D2,A2:B11,2,FALSE),"Not found")- •
VLOOKUP(D2,A2:B11,2,FALSE)-> the risky formula - returns the price or #N/A - •
"Not found"-> the fallback - shown only when VLOOKUP errors - •
Result-> matched IDs return the price; missing IDs return the friendly text - •
Same row count-> IFERROR doesn't change the spill or shape, just swaps errors for fallbacks - •
Pair with FALSE-> exact match VLOOKUP plus IFERROR is the safest production lookup pattern
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Product ID | Price | Lookup ID | Wrapped | Bare VLOOKUP | ||
| 2 | P-1001 | $29.99 | P-1042 | $349.99 | $349.99 | ||
| 3 | P-1042 | $349.99 | P-9999 | Not found | #N/A | ||
| 4 | P-1156 | $129.99 | P-1156 | $129.99 | $129.99 | ||
| 5 | P-2024 | $44.99 | P-2024 | $44.99 | $44.99 | ||
| 6 | P-3301 | $89.99 | P-7777 | Not found | #N/A | ||
| 7 | P-4408 | $19.50 | P-4408 | $19.50 | $19.50 | ||
| 8 | P-5519 | $74.00 | P-1001 | $29.99 | $29.99 | ||
| 9 | P-6622 | $215.00 | P-5519 | $74.00 | $74.00 | ||
| 10 | P-7340 | $11.99 | P-0000 | Not found | #N/A | ||
| 11 | P-8801 | $259.99 | P-3301 | $89.99 | $89.99 | ||
| 12 | |||||||
| 13 | |||||||
| 14 | |||||||
| 15 | |||||||
| 16 | |||||||
| 17 |
Hide division by zero with a 0 fallback
Revenue per unit is revenue divided by units sold. Some products sold zero units this month. Bare division returns #DIV/0! and the column lights up red. Wrap with IFERROR and pass 0 - missing data reads cleanly as zero.
=IFERROR(B2/C2,0)- •
B2/C2-> the division - errors when C2 is zero - •
0-> the fallback - same numeric type as the rest of the column so SUM still works - •
Numeric fallback-> use 0 (not "" or text) when downstream cells will sum or average the column - •
Watch the meaning-> 0 here means "no sales to compute against", not "zero revenue per unit" - your dashboard label needs to be honest
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Product | Revenue | Units sold | Rev / unit | Bare B2/C2 | |
| 2 | Notebook | $1,420 | 284 | $5.00 | $5.00 | |
| 3 | Stapler | $0 | 0 | $0.00 | #DIV/0! | |
| 4 | Pen pack | $840 | 168 | $5.00 | $5.00 | |
| 5 | Highlighter | $0 | 0 | $0.00 | #DIV/0! | |
| 6 | Folder | $675 | 135 | $5.00 | $5.00 | |
| 7 | Tape | $320 | 80 | $4.00 | $4.00 | |
| 8 | Glue stick | $0 | 0 | $0.00 | #DIV/0! | |
| 9 | Whiteboard | $2,100 | 42 | $50.00 | $50.00 | |
| 10 | Marker | $240 | 120 | $2.00 | $2.00 | |
| 11 | Sticky pad | $510 | 170 | $3.00 | $3.00 | |
| 12 | ||||||
| 13 | ||||||
| 14 | ||||||
| 15 | ||||||
| 16 | ||||||
| 17 |
Blank-on-error with "" for clean reports
Sometimes you want missing values to read as blank, not as text and not as zero. Pass "" (an empty string) as the fallback. Stakeholders see an empty cell instead of #N/A or 0, which is the right answer for headcount lists, optional fields, and any report where missing means missing.
=IFERROR(VLOOKUP(A2,$D$2:$E$8,2,FALSE),"")- •
""-> empty string fallback - cell renders blank - •
Fixed range-> $D$2:$E$8 with $ so the lookup range stays put when dragging down - •
Versus 0-> "" reads as blank in the report; 0 reads as a real value and pollutes averages - •
Versus a label-> "" beats "Not found" when downstream tools or pivot tables expect either a value or nothing - •
Trade-off-> blank cells can hide data quality issues - if a missing match should trigger a follow-up, use a visible label
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Employee | Manager | Employee | Manager | ||
| 2 | Sarah Chen | Priya Patel | Sarah Chen | Priya Patel | ||
| 3 | James Miller | Tom Becker | James Miller | Tom Becker | ||
| 4 | Maria Santos | David Brown | Tom Becker | |||
| 5 | David Brown | Tom Becker | Alex Kim | Priya Patel | ||
| 6 | Emma Davis | Jenny Liu | Rita Schmidt | |||
| 7 | Alex Kim | Priya Patel | Mark Reilly | Rita Schmidt | ||
| 8 | Carlos Gomez | Carlos Gomez | ||||
| 9 | Jenny Liu | Rita Schmidt | ||||
| 10 | Mark Reilly | Rita Schmidt | ||||
| 11 | ||||||
| 12 | ||||||
| 13 | ||||||
| 14 | ||||||
| 15 | ||||||
| 16 |
Nested IFERROR: try primary, then fallback list
Some lookups have two sources. Try the primary catalog first; if the SKU isn't there, check the secondary supplier list. Nested IFERROR runs the second lookup only when the first fails - a clean two-tier fallback in one cell.
The pattern extends as deep as you need: IFERROR(A, IFERROR(B, IFERROR(C, "None"))). Each layer is a fresh attempt; the final fallback is the safety net.
=IFERROR(VLOOKUP(A2,$D$2:$E$6,2,FALSE),IFERROR(VLOOKUP(A2,$G$2:$H$6,2,FALSE),"Not stocked"))- •
First VLOOKUP-> checks primary catalog D:E - returns the price if found - •
Second VLOOKUP-> runs only when the first errors - checks supplier list G:H - •
"Not stocked"-> the final catch-all when neither source has the SKU - •
Order = priority-> primary first, fallback second - whatever wins is whatever ships - •
No double evaluation-> if the primary hits, Excel never runs the supplier lookup - faster on big sheets
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | SKU | Price | SKU (Primary) | Price | SKU (Supplier) | Price | |||
| 2 | SKU-A1 | $12.00 | SKU-A1 | $12.00 | SKU-S1 | $45.00 | |||
| 3 | SKU-S1 | $45.00 | SKU-A2 | $8.50 | SKU-S2 | $33.00 | |||
| 4 | SKU-A2 | $8.50 | SKU-A3 | $22.75 | SKU-S3 | $67.50 | |||
| 5 | SKU-Z9 | Not stocked | SKU-A4 | $15.00 | SKU-S4 | $28.00 | |||
| 6 | SKU-S2 | $33.00 | SKU-A5 | $50.00 | SKU-S5 | $19.99 | |||
| 7 | SKU-A3 | $22.75 | |||||||
| 8 | SKU-Q0 | Not stocked | |||||||
| 9 | SKU-S5 | $19.99 | |||||||
| 10 | SKU-A4 | $15.00 | |||||||
| 11 | |||||||||
| 12 | |||||||||
| 13 | |||||||||
| 14 | |||||||||
| 15 | |||||||||
| 16 |
IFERROR vs IFNA: when each one is right
Excel can throw eight different error types: #N/A, #REF!, #VALUE!, #DIV/0!, #NAME?, #NUM!, #NULL!, and #CALC!. Each one means something specific and useful. IFERROR catches all eight. IFNA catches only #N/A. The difference looks small until your dashboard breaks silently in front of a stakeholder.
Think about what each error actually tells you when it shows up in a VLOOKUP. #N/A means "the lookup value is not in the lookup range" - that is the function working correctly, just reporting that nothing matched. Every other error means something else broke: a column was deleted (#REF!), a number got typed as text (#VALUE!), the function name was misspelled (#NAME?), the result is too large (#NUM!). Those are formula bugs, not data outcomes.
When you wrap a VLOOKUP in IFERROR with the fallback "Not found", you tell Excel "replace any error - any of the eight - with the words Not found." That works perfectly when the only error you ever expect is #N/A. The day a teammate deletes a referenced column and your formula starts returning #REF!, IFERROR quietly converts every #REF! to "Not found" too. The dashboard now reads "Not found" everywhere. Looks fine. Numbers are wrong. Nobody notices for a week.
IFNA is the surgical version. It catches only the #N/A - the missing-match case the lookup was designed to produce - and lets every other error display as a red error in the cell. Genuine bugs surface immediately. Missing matches still get a clean fallback. You get the friendly UX without the silent corruption.
=IFNA(VLOOKUP(A2,$E$2:$F$5,2,FALSE),"Not found")- •
IFNA(value, value_if_na)-> catches ONLY #N/A - the "lookup value not in range" error - and replaces it with the fallback. Available since Excel 2013. - •
IFERROR(value, value_if_error)-> catches ALL eight error types and replaces each with the same fallback. Available since Excel 2007. - •
The trade-off-> IFERROR is broader so it accidentally hides bugs. IFNA is precise so bugs stay visible as red errors you can investigate. - •
Rule for production lookups-> use IFNA. The legitimate "no match" case gets handled cleanly, and any future formula breakage shows up as a real error instead of silent bad data. - •
When IFERROR is correct-> rare. Use it when you genuinely want to swallow every error - for example, a calculation column where any failure should display 0 so a SUM keeps working. Document why. - •
XLOOKUP alternative-> the modern XLOOKUP has if_not_found built into its arguments. No wrapper needed at all; same precise behavior as IFNA.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Lookup ID | IFNA | IFERROR | Catalog ID | Price | What's happening | ||
| 2 | P-100 | $12.00 | $12.00 | P-100 | $12.00 | Clean match - both equal | ||
| 3 | P-200 | $8.50 | $8.50 | P-200 | $8.50 | Clean match - both equal | ||
| 4 | P-999 | Not found | Not found | P-300 | $22.75 | Genuinely missing - #N/A. Both hide it. | ||
| 5 | P-300 | #REF! | Not found | P-400 | $15.00 | Bug: a referenced column was deleted. IFNA exposes the #REF!, IFERROR silently hides it. | ||
| 6 | P-400 | $15.00 | $15.00 | Clean match - both equal | ||||
| 7 | P-500 | #VALUE! | Not found | Bug: lookup value is the wrong data type (text vs number). IFNA exposes #VALUE!, IFERROR hides it. | ||||
| 8 | P-888 | Not found | Not found | Genuinely missing - #N/A. Both hide it. | ||||
| 9 | ||||||||
| 10 | ||||||||
| 11 | ||||||||
| 12 | ||||||||
| 13 | ||||||||
| 14 |
Where people go wrong
- IFERROR hides the bug
Wrapping a VLOOKUP that's silently returning #N/A because of a typo in the lookup column means you'll never see the typo. The report looks fine, the data is wrong, and the issue ships unnoticed.
Fix: Use IFNA when you only want #N/A handled. It catches the missing-match case without swallowing #REF!, #VALUE!, or #NAME? - so genuine bugs still surface as visible red errors. - Used inside SUM as a "default zero"
=SUM(IFERROR(A1:A10/B1:B10, 0)) used to require Ctrl+Shift+Enter as an array formula in Excel 2019 and earlier, otherwise it only evaluates the first row. People copy the formula, see one number, and think it works.
Fix: On Excel 365 dynamic arrays just work - the formula evaluates row by row automatically. On older Excel, enter with Ctrl+Shift+Enter or rebuild with SUMPRODUCT(IFERROR(A1:A10/B1:B10,0)). - Wrong fallback type
Returning "N/A" or "Not found" when the next formula expects a number breaks downstream math: =SUM(D:D) chokes on the text and returns #VALUE!, or worse, silently treats the strings as zero and gives a wrong total.
Fix: Match the fallback to what the column needs. If the column is summed, return 0. If the column is text, return the label. If the column feeds another VLOOKUP, return whatever that lookup expects. - Wrapping the entire formula instead of the risky part
=IFERROR(VLOOKUP(A2,table,2,FALSE) * B2 / C2, 0) catches the lookup error, the multiply error, and the divide error all at once. If C2 is zero you get 0 back and have no idea which step actually failed.
Fix: Wrap only the part that can legitimately error. =IFERROR(VLOOKUP(...),0) * B2 / C2 fails loudly on the divide-by-zero so you can debug it, while still handling the missing-lookup case.
Notes
- Available since Excel 2007 - works in every modern version including Excel for Mac and Excel Online.
- Catches every Excel error type: #N/A, #VALUE!, #REF!, #DIV/0!, #NAME?, #NUM!, #NULL!, and the newer #CALC!.
- IFNA is the narrower cousin - it only catches #N/A and is usually the right choice for production VLOOKUP/INDEX-MATCH wrappers.
- Nest IFERROR inside another IFERROR for a fallback chain - try source A, then source B, then a final default string.
- Don't blanket-wrap formulas you haven't tested - debugging a sheet where every cell silently returns 0 is brutal.
- Pair with VLOOKUP, INDEX/MATCH, or HLOOKUP for the classic production lookup pattern - IFERROR catches the missing-match #N/A.
- XLOOKUP has a built-in if_not_found argument that replaces IFERROR for lookups - if you're on Excel 365, prefer XLOOKUP and skip the wrapper.
Now prove it
IFERROR is one of those functions that looks trivial in a tutorial.
Then a stakeholder forwards a report at 4pm with #N/A scattered across three columns and asks for it cleaned up before the 5pm exec sync.
The exercises below put IFERROR in those scenarios.
Here's the catch with IFERROR.
Knowing the syntax is five minutes of reading.
Knowing when to use it, when to use IFNA instead, when to wrap the whole formula or just the risky bit, and when to skip it entirely because XLOOKUP already covers the case - that judgement only comes from doing it on real reports under real deadlines.
That gap between syntax and judgement is what CellSkill closes.
Not with more reading. With practice on the exact decisions you'll face on the job.
Start practicing IFERROR for free →