Excel function

IFERRORfunction

Returns a value you choose if a formula results in an error; otherwise returns the formula's result.

All versions
=IFERROR(B2/C2, "Check")
A
B
C
D
E
1
2
3
4
5
6
7

Click a cell in the table to change row to calculate. Click the Milk (qty 0), Bread (blank) and Coffee ("TBD") rows. Column D divides without IFERROR, column E uses IFERROR. Try breaking it on purpose to see the errors.

Result

1500

row to calculate
B2You can also click a cell in the table

The row whose Sales ÷ Qty is calculated.

value_if_error

Returned when the calculation is an error. Leave it empty to show a blank.

What is the IFERROR function?

=IFERROR(value, value_if_error)

IFERROR calculates a formula and, if the result is any error (#DIV/0!, #N/A, #VALUE! and so on), returns a value you choose instead. If there is no error, the original result is returned unchanged.

It is commonly wrapped around divisions and lookups so that reports show a blank, 0 or a message instead of error codes.

Arguments

value
The formula to check, such as B2/C2 or a VLOOKUP.
value_if_error
What to return if value is an error. Use "" to show a blank.

IFERROR examples

  1. Example 1. Avoid #DIV/0!

    =IFERROR(B3/C3, 0)

    C3 is 0, so B3/C3 is #DIV/0!. IFERROR returns 0 instead.

  2. Example 2. Message for a missing lookup

    =IFERROR(VLOOKUP(F2, A2:D9, 3, FALSE), "Not found")

    If the code in F2 is not in the table, the cell shows "Not found" instead of #N/A.

Common mistakes

FAQ

What is the difference between IFERROR and IFNA?
IFNA only catches #N/A. IFERROR catches every error type.