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

  • Use IFERROR to handle errors in a formula. For example, if you are working with data where a valid value for cell D1 is 0, the formula =B1/D1 would result in an error (division by 0). This error can be prevented by using a formula such as =IFERROR(B1/D1, 0), which returns the actual division if D1 is not 0; otherwise it returns 0.

Examples

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

=IFERROR(B1/D1, 0) returns 0 because division by 0 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 return an error and the IFERROR function returns FALSE; otherwise it returns 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 returns the if-false expression "Not all numbers"; otherwise it returns the if-true expression "All numbers".

Morty Proxy This is a proxified and sanitized view of the page, visit original site.
Helpful?
Character limit: 250
Maximum character limit is 250.
Thanks for your feedback.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.