Skip to content
AnIntent

How to Use IFERROR in Excel to Replace Errors With Your Own Value

Wrap any Excel formula in IFERROR so it shows your own message or value instead of an error, and know what that hides.

AnIntent Editorial · · 3 min read

Hands typing on a laptop displaying a data spreadsheet
Photo by Gorilla ROI Data Connector on Unsplash
In this article
  1. How the IFERROR formula is built
  2. Wrap an existing formula in IFERROR
  3. IFERROR with array formulas
  4. The common mistake: hiding errors you needed to see
  5. Which Excel versions support IFERROR
Share this article

IFERROR lets you wrap an Excel formula so that, if it produces an error, the cell shows a value you choose instead, such as a short message, a zero or a blank. This guide covers the syntax, a worked example, and the main way IFERROR can work against you.

The details below come from Microsoft's IFERROR help page. This article covers IFERROR only. It does not explain how IFNA differs, because that page was not part of the research for this piece.

How the IFERROR formula is built

According to Microsoft, the syntax is:

IFERROR(value, value_if_error)
  • value is the formula you want to check.
  • value_if_error is what Excel returns if that formula evaluates to an error.

If there is no error, IFERROR returns the formula's normal result. Microsoft's page also says that if either argument points to an empty cell, IFERROR treats it as an empty string ("").

Wrap an existing formula in IFERROR

  1. Click the cell that contains the formula showing an error.
  2. In the formula bar, put IFERROR( after the equals sign, before the existing formula.
  3. At the end of the formula, type a comma, then the value you want shown instead of the error, then a closing bracket.
  4. Press Enter.
  5. Copy the cell down or across to apply the same formula to the rest of the range.

Microsoft's example divides one cell by another and supplies a text message as the fallback:

=IFERROR(A2/B2, "Error in calculation")

With 210 in A2 and 35 in B2, the page shows the formula returning 6. If the division produced an error, the cell would show "Error in calculation" instead.

To show a blank cell rather than a message, use an empty string as the second argument:

=IFERROR(A2/B2, "")

The same wrapping works around lookup formulas. If you are building one from scratch, see How to Use VLOOKUP in Excel or How to Use XLOOKUP in Excel, then wrap the finished formula in IFERROR the same way.

IFERROR with array formulas

If the first argument is an array formula, Microsoft says IFERROR returns an array of results, one for each cell in the range. You do not need to wrap each cell separately.

The common mistake: hiding errors you needed to see

IFERROR returns your fallback for any error the formula produces. That is convenient, but it also means a typo in a cell reference or bad source data gets the same friendly message as an expected miss. You lose the clue that something is broken.

Two habits help:

  • Get the formula working first. Add IFERROR only once the unwrapped formula gives correct results on known data.
  • Pick a fallback you will notice. A message like "Check" is easier to spot than a blank cell when you are scanning a sheet for problems.

If your errors come from numbers stored as text, fix the data rather than masking it. How to Convert Text to Numbers in Excel walks through that.

Which Excel versions support IFERROR

Microsoft's page lists Excel for Microsoft 365 (Windows and Mac), Excel 2024, 2021, 2019, 2016 and Excel Web App as applicable versions.

If you would rather hide errors without changing formulas, Microsoft has a separate help page on hiding error values and error indicators in cells.

Common questions

What does IFERROR return if there is no error?

It returns the formula's normal result. Microsoft's example =IFERROR(A2/B2, "Error in calculation") returns 6 when A2 is 210 and B2 is 35.

How do I make IFERROR show a blank cell?

Use an empty string as the second argument, for example =IFERROR(A2/B2, "").

What happens if an IFERROR argument is an empty cell?

Microsoft's help page says IFERROR treats an empty cell as an empty string ("").

Does IFERROR work with array formulas?

Yes. According to Microsoft, if the first argument is an array formula, IFERROR returns an array of results, one for each cell in the range.

laptop computer on glass-top table
How-to

How to Convert Text to Numbers in Excel (Green Triangle, VALUE, and Paste-Back)

Fix numbers stored as text in Excel with Convert to Number, turn the green triangle back on, or use VALUE and paste the results back.

· 3 min

More in Cloud & Productivity Software