How to use IFERROR in Excel
IFERROR returns the result of a formula — or a value of your choice if the formula produces an error (#N/A, #DIV/0!, #VALUE!, #REF!, #NAME?…). It keeps reports clean, especially around lookups and division.
Syntax
=IFERROR(value, value_if_error)
value | The formula to try. |
value_if_error | What to show instead of an error: 0, "", "Not found"… |
Examples
=IFERROR(B2/C2, 0)No #DIV/0! when C2 is empty or zero.=IFERROR(VLOOKUP(E2, A2:C100, 3, FALSE), "Not found")Friendly message when a code doesn't exist.=IFERROR(INDEX(C:C, MATCH(E2, A:A, 0)), "")Blank instead of #N/A.IFERROR or IFNA?
IFERROR catches every error. IFNA catches only #N/A, the "not found" error of lookups, and lets real mistakes like #REF! through. For lookups, IFNA is the safer choice.
=IFNA(VLOOKUP(E2, A2:C100, 3, FALSE), "Not found")A message for missing codes, while a broken range still shows its error.=IFERROR(VLOOKUP(E2, A2:C100, 3, FALSE), "Not found")Hides every error, including the ones that point at a real bug.Try a second table when the first lookup fails
The fallback value can be another formula. Chain two lookups: search this year's list first and the archive only if the code isn't there.
=IFERROR(VLOOKUP(E2, Current!A:C, 3, FALSE), VLOOKUP(E2, Archive!A:C, 3, FALSE))The price from the current list, otherwise from the archive.A blank instead of an error
An empty string "" keeps the cell looking empty. Use it in reports people read, not in columns that other formulas add up.
=IFERROR(B2/C2, "")A blank instead of #DIV/0! while C2 is still empty.Common mistakes
- Hiding real mistakes
- IFERROR hides every error, including typos. Build and test the formula first, then wrap it.
- Only want to catch #N/A
- Use
IFNAso other errors still show. - Returning text where numbers are expected
"Not found"in a numeric column breaks later SUMs — prefer 0 or "".
Frequently asked questions
Which errors does IFERROR catch?
All of them: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? and #NULL!. What each one means: Excel errors explained.
Is it bad to use IFERROR?
Not by itself, but it hides every error, so a broken formula can look fine. Use it on formulas you've already checked, prefer IFNA for lookups, and don't use 0 as the fallback in a column someone will add up.
Why does IFERROR still show an error?
The error comes from the fallback itself, for example a second lookup that also fails. Wrap the second part too, or end the chain with a plain value like "Not found".
Which versions of Excel have IFERROR?
Excel 2007 and every version since, plus Google Sheets. IFNA arrived in Excel 2013.
Available in: All versions of Excel, Excel for the web, Google Sheets