IFERROR Function

Returns user-defined result when formula evaluates to error; otherwise returns expected result

Functions  >  Logical  >  IFERROR

Overview

The IFERROR function returns a user-defined result when a formula evaluates to an error, and returns the expected result when no error is detected.  IFERROR is a way to trap and handle errors without having to use complicated nested IF statements.

Syntax

=IFERROR(value, value_if_error)

Arguments

value – Any value, expression or reference to check for an error.
value_if_error – The user-defined result when the formula evaluates to an error.

Version

Excel 2007 and onward

Purpose

The IFERROR function is used to trap and handle errors when an error is detected within a value, expression or reference.  When the value returns a normal or expected result, the IFERROR function returns the normal or expected result.  It is only when the value results in an error that the IFERROR function changes the result.  

An alternative to the IFERROR function is the ISERROR function, which checks to see if there is an error in a target value, expression or reference.  As there is one correct way to manage and handle errors, it’s always great to have options.

Examples

The IFERROR function can handle the following types of errors:

  • #REF!
  • #DIV/0!
  • #N/A
  • #VALUE!
  • #NUM!
  • #NAME!
  • #NULL!

Using IFERROR to handle your errors can be extremely beneficial for maintaining data integrity.  For larger workbooks with many dependent cells, a single error can cascade quickly into a large problem.

Let’s look at the following example, where we are trying to determine the hourly rate of a contractor, based on what they were paid and the number of hours they worked:

IFERROR Data Set

=(C4/C6) // Results in a #DIV/0! error

Since we are getting a #DIV/0! error, it appears the hours the contractor worked were not entered properly.  Instead of this showing up an error, let’s trap and handle this error using the IFERROR function.

IFERROR Data Set

=IFERROR(C4/C6, “Check Inputs”) // Handles the error 

Similar to the IF function, the value_if_error argument needs to be bounded by quotation marks if the result is a string value.  If it is numerical, it does not need to be bounded by quotation marks:

=IFERROR(C4/C6, “Check Inputs”) // String, quotations
=IFERROR(C4/C6, 0) // Numerical, no quotations

As mentioned above, there is no one-correct-way to trap and handle errors.  Depending on your application, you may want to only determine if a formula or expression is resulting in an error, as opposed to automatically handling and correcting that error.

As such, below is a list of other error functions in Excel:

Notes

  • If value_if_error is left blank, it will default to FALSE

Author

Kyle Stott

Kyle Stott

Certified Microsoft Excel Expert

Kyle has worked professionally with Microsoft Excel for over a decade and has been consulting on and teaching best practices in Microsoft Excel to over 400 companies across 30+ countries.

Want to learn more?

Join My Excel Academy Today!

This All-Access Pass Includes:

Excel Academy Bundle

30-Day Money-Back Guarantee

Want to learn more?

Join My Excel Academy Today!

Excel Academy Bundle

All-Access Pass Includes:

30-Day Money-Back Guarantee

Excel Academy Bundle

Want to learn more?

Join My Excel Academy Today!

30-Day Money-Back Guarantee

This all-access pass includes:

Don’t hesitate – join now!

Have any questions?

View our Frequently Asked Questions or contact us!