The Excel IFERROR function returns a user-defined, custom value when the embedded formula generates an error. Otherwise, it returns the standard formula result.
Using IFERROR is an effective method to identify and handle formula errors. However, you must use more complex statements (for example, the IF function) without error-handling functions.
The purpose of using IFERROR and other error-handling functions is to trap and handle errors.
IFERROR Syntax, Arguments, return value
=IFERROR (value, value_if_error)
The value that you use in the case of errors
- value – The formula that you want to check
- value_if_error – A value that you want to display in case of formula errors
How to use the Excel IFERROR function
In most cases, a formula returns with the expected result, and IFERROR provides the result of the embedded formula. IFERROR returns a custom result. We use the IFERROR function to manage errors and return a user-friendly, descriptive message when an error is detected.
IFERROR checks for the following formula errors: #N/A, #VALUE! , #REF! , #DIV/0!, #NUM! , #NAME?, #NULL!
Example: IFERROR and ISERROR function
The IFERROR function (available from Excel 2013) is an improved version of the ISERROR function (available from Excel 2007). ISERROR uses only one argument and has TRUE or FALSE output.
In the example below, we create a division by zero error using the formula below. IFERROR returns with the “Division by zero!” text string. So, the custom message informs us about the error. ISERROR returns TRUE. We know something went wrong, but we don’t have further information.
- IFERROR returns a custom value
- ISERROR returns TRUE because the cell contains the #DIV/0! error.
The second arguments of the IFERROR function enable you to create a custom output in case of errors. ISERROR function indicates only the error using the TRUE value like a logical test.
The IFERROR function is an effective error handling function and manages all errors. For example, if your formula returns #NAME?, IFERROR can handle it and provides an option to add a custom value.
Example: IFERROR and IFNA function
If you are using the IFNA function, keep in mind that it can trap only the #N/A error. In any other cases, you will get Excel’s standard error messages.
Let us suppose that your formula returns with #VALUE! IFERROR can handle the error because we added “0” as a second argument. The “0” output helps us to manage various formula errors uniformly. IFNA gets the #VALUE! error.
Learn more about the Excel error functions:
- ISERR function returns TRUE for any error type except the #N/A error.
- ISNA function returns TRUE (if you have #N/A errors only)
- ERROR.TYPE function returns the numeric error code between 1 and 7.