How to replace formula errors in Excel with IFERROR

IFERROR in Excel returns a fallback if a formula produces an error. If the formula calculates successfully, it returns the original result. Check what caused the error before deciding what should replace it.

Supply the two IFERROR arguments

Enter a formula or reference as the first argument and a fallback value or formula as the second. Put a text message in double quotes. IFERROR handles several error types, including division by zero, missing lookups, and broken references.

Microsoft Support syntax and return values for IFERROR

Compare results when dividing by zero

In a blank sheet, enter 10 in B1 and 0 in B2. Put this formula in B3.

=B1/B2

B3 shows #DIV/0!. Check whether the zero in B2 is an actual measurement or a sign of missing input.

Wrap the same division in IFERROR. Enter the following formulas in C3, D3, and E3 respectively.

=IFERROR(B1/B2,"")
=IFERROR(B1/B2,0)
=IFERROR(B1/B2,"Check calculation inputs")

C3 looks blank, D3 displays 0, and E3 displays “Check calculation inputs.” Change B2 to 2 and all three formulas return 5.

Choose between blank text, zero, and a message

An empty string is text with zero length. The formula is still in the cell. Use a message when readers need to know the calculation failed. Use zero only when your rules treat the failed calculation as a true zero.

For example, a range containing 10 and a fallback of 0 averages to 5. If the second cell returns an empty string, a formula averaging the range ignores that text and returns 10.

Handle only the condition you expect

If a zero denominator is the only expected condition, check B2 explicitly with IF. Other calculation errors can remain visible.

=IF(B2=0,"Check calculation inputs",B1/B2)

For a lookup that cannot find a match, use IFNA if you only need to replace #N/A. Other errors, including broken references, still surface.

Microsoft Support guide to IFNA

Run the original formula first when building a report. Repair bad references and incorrect inputs, then handle the expected exceptions you want readers to see differently.