What IFERROR does
IFERROR returns a formula’s result when it works, and a value you choose when it gives an error such as #DIV/0! or #N/A. =IFERROR(B2/C2,0) shows 0 in place of #DIV/0! when C2 is 0, and wrapped around a lookup it can show “Not found” instead of #N/A.
It’s most useful where an error is expected and harmless, like a lookup for a code that isn’t in the list yet, or a division where some rows have nothing to divide by. A report full of #DIV/0! looks broken even when nothing is wrong.
It catches every kind of error, which is also its risk. A misspelled function name or a deleted reference gets hidden along with the harmless cases, so wrap only the formulas whose errors you understand. The free lesson When Excel shows an error explains what each error value means and what usually causes it.
Syntax
valueRequired- The formula that might give an error, such as
B2/C2or a whole lookup. When it works, IFERROR shows its result unchanged. value_if_errorRequired- What to show when it gives any error: a number like
0, text like"Not found", or""for an empty-looking cell.
Example: cost per unit when some products have no units
Dividing by a count of 0 gives #DIV/0!. The formula in D3 is filled to D2:D4.
On the Pens row, B3/C3 gives #DIV/0! and IFERROR shows 0 instead. On the other rows the division works and its result passes straight through. You can practice this on a sales report in the free lesson Replace an error with IFERROR.
Example: a lookup that shows “Not found”
A product code typed in B8 isn’t in the list. On its own, VLOOKUP would show #N/A.
With XLOOKUP you can skip IFERROR: its fourth argument already says what to show when nothing matches.
Common mistakes
=IFERROR(VLOKUP(B8,A2:B6,2,FALSE),"Not found")has a typo, so it always says “Not found” and never looks anything up. Get the formula working first, then add IFERROR.- A 0 put in place of an error goes into totals and averages. For an average, an empty-looking
""or a lookup that leaves the row out may be closer to the truth. - When only “not found” is expected, IFNA (Excel 2013 and later) catches
#N/Aand lets every other error show, so a broken reference still gets noticed. - A sheet where nothing can ever show an error is one where mistakes stay invisible. Use IFERROR where an error is part of normal use, and leave other formulas bare.
Frequently asked questions
Which errors does IFERROR catch?
All of them: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? and #NULL!. If you only want to catch #N/A from a lookup, IFNA is the narrower choice.
How do I use IFERROR with VLOOKUP?
Wrap the whole VLOOKUP and give the fallback second: =IFERROR(VLOOKUP(B8,A2:B6,2,FALSE),"Not found"). When the code isn’t in the list, the cell shows Not found instead of #N/A.
How do I show a blank cell instead of an error?
Use two quotation marks as the second argument: =IFERROR(B2/C2,""). The cell looks empty but still holds a formula, so COUNTA counts it.
Why is my IFERROR returning 0?
IFERROR only steps in when there’s an error. A lookup that finds the row but lands on an empty answer cell returns 0, which isn’t an error, so IFERROR passes it through. Check that cell in the table, or whether 0 is the fallback your formula gives.
What is the difference between IFERROR and IFNA?
IFERROR replaces every kind of error. IFNA replaces only #N/A, the “not found” error that lookups give, and leaves the others visible.
What is the difference between IFERROR and ISERROR?
ISERROR only answers TRUE or FALSE, so it needs IF around it and the formula written twice: =IF(ISERROR(B2/C2),0,B2/C2). IFERROR does the same job in one function.