Written by Allen Wyatt (last updated December 10, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365
It is often helpful to check if a cell contains an error condition so that your formula can know how to calculate results that may be dependent on that cell. Excel provides the IFERROR function to help determine this information. The purpose of this function is to help simplify how you check for potential errors in your formulas. Consider a rather simple example:
=B8/B9
In most instances this formula will return a good result—unless cell B9 contains a zero value. In that case, Excel returns a #DIV/0! error. The traditional approach to trap this potentiality is to use the ISERROR function in this manner:
=IF(ISERROR(B8/B9),0,B8/B9)
The ISERROR function returns either True or False, depending on whether the expression being evaluated returns an error or not. The surrounding IF function can then act upon the value returned by ISERROR to determine what should be displayed.
The problem with this approach is that it is rather convoluted. Note, for instance, that your evaluation (B8/B9) needs to be included twice in the full formula. While that may not seem problematic with such a simple evaluation, with longer formulas it can be a real pain—at a minimum it makes your overall formula twice as long as it should be and provides two formulas that need to be kept in sync when you make changes.
This is where the IFERROR function comes into play. It helps simplify the formulas you create. The following is the equivalent of the traditional formula presented earlier:
=IFERROR(B8/B9,0)
In this instance, the formula B8/B9 is evaluated and, if it results in an error, the 0 value is returned. If there is no error, then the value of the formula being evaluated is instead returned.
You can find additional information about the IFERROR function at this web page:
https://exceljet.net/excel-functions/excel-iferror-function
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7800) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365.
Dive Deep into Macros! Make Excel do things you thought were impossible, discover techniques you won't find anywhere else, and create powerful automated reports. Bill Jelen and Tracy Syrstad help you instantly visualize information to make it actionable. You’ll find step-by-step instructions, real-world case studies, and 50 workbooks packed with examples and solutions. Check out Microsoft Excel 2019 VBA and Macros today!
If you have two columns containing dates and weights from those dates, you may want to pick a date associated with a ...
Discover MoreYou may have a need to determine the range occupied by data within a worksheet. The approach you take in devising a ...
Discover MoreIf you need to randomly match up items in two lists, there are a variety of techniques you can use. Here are a couple of ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments