Microsoft Office Tutorials and References

In Depth Information

**Using the IFERROR function**

Figure 85-2:
Using an IF function to hide error values.

You can adapt this technique to any formula. The original formula (without the initial equal sign)

serves as the argument for the ISERROR function, and it repeats as the last argument of the IF

function:

=IF(ISERROR(OriginalFormula),””,OriginalFormula)

By the way, you can put anything you like as the second argument for the ISERROR function. (It

doesn’t have to be an empty string.) For example, you can make it a cell reference.

Using the IFERROR function

If your workbook will be used only by people who have Excel 2007 or later, you might prefer to

use the IFERROR function. This function takes two arguments: The first argument is the

expression that’s checked for an error, and the second is the value to return if the formula evaluates to

an error. The formula presented in the preceding section can be rewritten as

=IFERROR(B2/C2,””)

Using this function has two advantages:

h
Writing error-checking formulas is easier because IFERROR does the work of both the IF

function and the ISERROR function.

h
The expression is evaluated only one time, which can result in faster recalculation times.

Keep in mind that because IFERROR was introduced in Excel 2007, it doesn’t work with earlier

versions of Excel.