IFERROR

IFERROR returns a value you specify when a formula errors out. The fix-it wrapper for VLOOKUP #N/A, division by zero, missing references, and any other error you want to swallow gracefully.

LogicBeginner
Purpose
Catch any formula error and return a fallback value instead of #N/A, #DIV/0!, #VALUE!, etc.
Returns
The original formula's result if it works, otherwise your specified fallback
Syntax
=IFERROR(value, value_if_error)
Excel version
Excel 2007 and later (works in every modern Excel)

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.

= IFERROR(value, value_if_error)

Arguments

ArgumentTypeRequiredDescription
valueany✓ RequiredThe formula or expression to evaluate. Typically a VLOOKUP, division, INDEX/MATCH, or any calculation that might error.
value_if_errorany✓ RequiredWhat 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
E2
fx
=IFERROR(VLOOKUP(D2,A2:B11,2,FALSE),"Not found")
ABCDEFG
1Product IDPriceLookup IDWrappedBare VLOOKUP
2P-1001$29.99P-1042$349.99$349.99
3P-1042$349.99P-9999Not found#N/A
4P-1156$129.99P-1156$129.99$129.99
5P-2024$44.99P-2024$44.99$44.99
6P-3301$89.99P-7777Not found#N/A
7P-4408$19.50P-4408$19.50$19.50
8P-5519$74.00P-1001$29.99$29.99
9P-6622$215.00P-5519$74.00$74.00
10P-7340$11.99P-0000Not found#N/A
11P-8801$259.99P-3301$89.99$89.99
12
13
14
15
16
17
Formula entered in cell E2. Drag down for every ID in column D - missing ones now read "Not found" instead of #N/A.
Column E is the IFERROR-wrapped formula. Column F shows what the bare VLOOKUP would return on the same row - three #N/A errors for IDs that aren't in the catalog (P-9999, P-7777, P-0000). Same data, same lookup, different presentation.
Match the fallback to the column type. For a price column, "Not found" reads fine in a report but breaks any downstream SUM. If the column feeds math, return 0 instead.

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
D2
fx
=IFERROR(B2/C2,0)
ABCDEF
1ProductRevenueUnits soldRev / unitBare B2/C2
2Notebook$1,420284$5.00$5.00
3Stapler$00$0.00#DIV/0!
4Pen pack$840168$5.00$5.00
5Highlighter$00$0.00#DIV/0!
6Folder$675135$5.00$5.00
7Tape$32080$4.00$4.00
8Glue stick$00$0.00#DIV/0!
9Whiteboard$2,10042$50.00$50.00
10Marker$240120$2.00$2.00
11Sticky pad$510170$3.00$3.00
12
13
14
15
16
17
Formula entered in cell D2. Drag down. Rows where Units Sold is 0 now return 0 instead of #DIV/0!.
Three products had zero units sold. Column E shows the bare division spitting #DIV/0! on those rows. Column D wraps with IFERROR and returns 0, keeping the column numeric and summable.

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
B2
fx
=IFERROR(VLOOKUP(A2,$D$2:$E$8,2,FALSE),"")
ABCDEF
1EmployeeManagerEmployeeManager
2Sarah ChenPriya PatelSarah ChenPriya Patel
3James MillerTom BeckerJames MillerTom Becker
4Maria SantosDavid BrownTom Becker
5David BrownTom BeckerAlex KimPriya Patel
6Emma DavisJenny LiuRita Schmidt
7Alex KimPriya PatelMark ReillyRita Schmidt
8Carlos GomezCarlos Gomez
9Jenny LiuRita Schmidt
10Mark ReillyRita Schmidt
11
12
13
14
15
16
Formula entered in cell B2. Employees not in the manager directory show as blank instead of an ugly error.
Maria, Emma, and Carlos have no manager listed in the directory. With "" as the fallback, those rows render blank. The report stays scannable - no error noise and no fake zeros.
A blank from IFERROR isn't the same as a truly empty cell. ISBLANK returns FALSE on it because the cell still contains a formula returning "". If a downstream check uses ISBLANK, swap to LEN(cell)=0.

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
B2
fx
=IFERROR(VLOOKUP(A2,$D$2:$E$6,2,FALSE),IFERROR(VLOOKUP(A2,$G$2:$H$6,2,FALSE),"Not stocked"))
ABCDEFGHI
1SKUPriceSKU (Primary)PriceSKU (Supplier)Price
2SKU-A1$12.00SKU-A1$12.00SKU-S1$45.00
3SKU-S1$45.00SKU-A2$8.50SKU-S2$33.00
4SKU-A2$8.50SKU-A3$22.75SKU-S3$67.50
5SKU-Z9Not stockedSKU-A4$15.00SKU-S4$28.00
6SKU-S2$33.00SKU-A5$50.00SKU-S5$19.99
7SKU-A3$22.75
8SKU-Q0Not stocked
9SKU-S5$19.99
10SKU-A4$15.00
11
12
13
14
15
16
Formula entered in cell B2. Drag down. Each SKU is checked against the primary catalog first, then the supplier list, then falls back to "Not stocked".
Green hits came from the primary catalog. Orange hits came from the supplier fallback (the SKU-S* rows). Two SKUs (Z9, Q0) live in neither list and land on the final "Not stocked" string.
Two layers is comfortable. Three is the practical ceiling - past that, switch to a single source-of-truth table and stop chaining lookups.

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.
B2
fx
=IFNA(VLOOKUP(A2,$E$2:$F$5,2,FALSE),"Not found")
ABCDEFGH
1Lookup IDIFNAIFERRORCatalog IDPriceWhat's happening
2P-100$12.00$12.00P-100$12.00Clean match - both equal
3P-200$8.50$8.50P-200$8.50Clean match - both equal
4P-999Not foundNot foundP-300$22.75Genuinely missing - #N/A. Both hide it.
5P-300#REF!Not foundP-400$15.00Bug: a referenced column was deleted. IFNA exposes the #REF!, IFERROR silently hides it.
6P-400$15.00$15.00Clean match - both equal
7P-500#VALUE!Not foundBug: lookup value is the wrong data type (text vs number). IFNA exposes #VALUE!, IFERROR hides it.
8P-888Not foundNot foundGenuinely missing - #N/A. Both hide it.
9
10
11
12
13
14
Column B wraps the VLOOKUP in IFNA. Column C wraps the SAME VLOOKUP in IFERROR. Watch what happens on the rows where the underlying VLOOKUP throws an error other than #N/A.
Three categories of result: clean matches (rows 2, 3, 6), legitimately missing IDs (rows 4, 8), and broken-formula bugs (rows 5, 7). On the bug rows the IFNA column shows the actual error so you can fix it. The IFERROR column has already filed those bugs under 'Not found' - the report ships looking healthy while the data is wrong.
Default to IFNA for any VLOOKUP, XLOOKUP, or INDEX/MATCH that fetches data. Reach for IFERROR only when you have an explicit reason to suppress every possible error - and write a comment in the cell explaining what bug you're swallowing and why. The two functions read almost identically; the silent risk is what makes IFERROR the wrong default.

Where people go wrong

  1. 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.
  2. 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)).
  3. 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.
  4. 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 →
Free account . No credit card . Cancel anytime
Practice IFERROR
IFERROR in Excel: Handle #N/A and Every Other Error · CellSkill