IFERROR

The IFERROR function returns a value that you specify if a given value evaluates to an error; otherwise it returns the given value.

IFERROR(any-expression, if-error)

any-expression: The expression to be tested. any-expression can contain any value.

if-error: The value returned if any-expression evaluates to an error. if-error can contain any value.

Notes

Examples

If B1 is a number value and D1 evaluates to 0, then:

=IFERROR(B1/D1, 0) returns 0 because division by zero results in an error.

=IF(ISERROR(B1/D1), 0, B1/D1) is equivalent to the previous IFERROR example, but requires the use of both IF and ISERROR.

=IF(IFERROR(OR(ISEVEN(B4+B5), ISODD(B4+B5)), FALSE), “All numbers”, “Not all numbers”) returns the text “All numbers” if both cells B4 and B5 contain numbers; otherwise the text “Not all numbers.” This is accomplished by testing to see if the sum of the two cells is either even or odd. If the cell is not a number, the EVEN and ODD functions will return an error and the IFERROR function will return FALSE; otherwise it will return TRUE because either EVEN or ODD is TRUE. So if either B4 or B5 is not a number or a boolean value, the IF statement will return the if-false expression, “Not all numbers”; otherwise it will return the if-true expression “All numbers.”

See also
ISBLANK
ISERROR