IFERROR Function

The Excel IFERROR function provides a custom value if the formula contains an error; otherwise, it returns the formula’s normal 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

Syntax:

=IFERROR (value, value_if_error)

Arguments:

  • value – The formula that you want to check
  • value_if_error – A value that you want to display in case of formula errors

Return value:

The value that you use in the case of 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.
iserror-iferror-1

The second argument of the IFERROR function enables you to create a custom output in case of errors. The ISERROR function only indicates 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 use the IFNA function, remember 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.

excel-iferror-function-vs-ifna-function-1

Related formulas and functions: