## Summary

To catch errors that a formula might encounter in a worksheet, you can use the IFERROR function to display a custom message, or nothing at all. In the example shown, the formula in E5 is:

``````=IFERROR(C5/D5,"")
``````

If C5/D5 returns a value, that value is returned. If C5/D5 returns an error, IFERROR returns an empty string ("").

## Generic formula

``=IFERROR(formula,value_if_error)``

## Explanation

In this example, the IFERROR function is used to trap and suppress the #DIV/0! error that occurs when there is no value for Orders (column D). Without IFERROR, the formula C5/D5 would display a #DIV/0! error in E6 and E9.

The IFERROR function takes two arguments: a value (usually entered as a formula), and a result to display if the formula returns an error. The second argument is only used if the first argument throws an error.

In this case, the first argument is the simple formula for calculating the average order size, which divides total sales by the order count:

``````=C5/D5
``````

The second argument is entered as an empty string (""). When the formula returns a normal result, the result is displayed. When the formula returns #DIV/0!, an empty string is returned and nothing is displayed.

Author

### Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.