IFERROR Function - Excel
Overview
The IFERROR function in Excel is a useful tool for handling errors in a formula. This function allows you to provide an alternative result, whether a number or a statement, whenever an error occurs in any of your formulas. Other functions can be nested into the IFERROR function.
Example:
=IFERROR(C2/0, "Cannot divide by 0")
Syntax:
=IFERROR(value, value_if_error)
value: The formula or expression that you want to evaluate.
value_if_error: The value to be returned if the value results in an error.
Examples
In the example above, we intentionally create an error by dividing by 0, which is not possible. Instead of displaying the #DIV/0! error message, like we have in the #DIV/0! Example, we use the IFERROR function to handle the error in a more effective way by having it return a statement that says “Cannot divide by 0”.
Instead of a statement we can also provide a number, a cell or another function as an alternative result. Here under the Number Return Example you can see that we have the same divide by 0 error as before but this time instead of a statement we have it return the number 999.
In the Cell Return Example we reference a different cell when the error occurs. We tell the IFERROR function that we want to return cell F2 when we have an error and in this example you can see that we return the word “Plant” because that is what is in cell F2.
#DIV/0! Example
Number Return Example
Cell Return Example
Nested Example
In this example, I'll demonstrate how you can nest a function into the IFERROR function. When the error occurs we then have the IF function trigger to tell us whether it is larger than 10 or less than 10.