
The IFERROR function in Excel shows a value you choose when a formula returns an error, such as #N/A, #DIV/0! or #VALUE!. It keeps your sheet clean, but it can also hide real problems if you use it too early. This guide shows how to use IFERROR, with made-up data, and when you should not.
IFERROR syntax
IFERROR takes the formula to try and the value to show if it fails:
=IFERROR(formula, value_if_error)
If the formula works, you see its result. If it returns any error, you see the second value instead.

Fix #DIV/0! with IFERROR
Dividing by zero or an empty cell gives #DIV/0!. If B2 holds sales and C2 holds the number of orders, the average per order is:
=IFERROR(B2/C2, 0)
When C2 is zero or empty, the cell shows 0. You can also show text, such as "No orders", but then the cell holds text and cannot be added up.

Hide #N/A in lookups
A lookup that finds nothing returns #N/A:
=IFERROR(VLOOKUP(A2, $F$2:$G$100, 2, FALSE), "Not found")
Use this only after you have checked why a value might be missing. Our guide to VLOOKUP returns #N/A lists the common causes.
Show an empty cell instead of an error
Use empty quotes to leave the cell looking blank:
=IFERROR(B2/C2, "")
The cell holds empty text, which can cause problems in later math, so test any formula that uses it.

IFERROR or IFNA?
IFERROR catches every error type. IFNA catches only #N/A:
=IFNA(VLOOKUP(A2, $F$2:$G$100, 2, FALSE), "Not found")
IFNA is the safer choice for lookups, because other errors, like a wrong range, still show and warn you.

When not to use IFERROR
- While you build a formula. Errors help you find mistakes. Add IFERROR at the end.
- When an error means bad data. Hiding it can make wrong totals look fine.
- On very large ranges where you do not check the results.
Common IFERROR mistakes
- Hiding every error. A typo in a range also shows your friendly message.
- Text where numbers are needed. "Not found" cannot be summed.
- Wrong bracket placement. The whole formula goes inside IFERROR, before the comma.
IFERROR in Excel: common questions
Does IFERROR work in Google Sheets?
Yes, with the same arguments. IFNA is available too.
Does IFERROR slow down my workbook?
We have not measured it, so we will not claim an effect. Use it where it is needed.
Can I use IFERROR with INDEX MATCH?
Yes. See the INDEX MATCH guide.
Related guides on Sheets AI Hub
Read IF with AND and OR and the FILTER function.
