Excel IFERROR Function Formula Examples
In this article
The Excel IFERROR function catches errors in a formula and returns a value you specify instead, such as "Not found" or 0. You enter a formula that might produce an error, and IFERROR returns a fallback result if that error occurs, otherwise it returns the original formula's result.
in t | Finish time | min | 50 | 0 in d | Distance | km | 10 | 0 out pace | Average pace | min/km | t / d | 2 out speed | Average speed | km/h | d / (t / 60) | 2
Formula
The syntax is: IFERROR(value, value_if_error). The first argument is the formula you want to evaluate; the second is what to return if the first argument results in any error (e.g., #N/A, #DIV/0!, #VALUE!). The second argument can be text, a number, a blank cell reference, or another formula.
Worked Example
Suppose you want to calculate average pace (minutes per kilometer) from a finish time of 50 minutes and a distance of 10 km. The formula is =IFERROR(t/d, "N/A"). If you enter 50 for time and 10 for distance, the result is 5.0 min/km. If distance were 0, the formula would return "N/A" instead of #DIV/0!.
When to Use IFERROR
Use IFERROR when you expect that a formula might fail under certain conditions, such as division by zero, missing lookup values, or invalid data types. It is especially useful in dashboards and reports where you want clean output instead of error codes. However, it should not be used to hide all errors indiscriminately, because it can mask genuine problems in your data or formula logic.
Common Mistakes
- Using IFERROR to suppress errors that indicate real issues, like a broken formula or incorrect cell references.
- Forgetting that IFERROR catches all error types, not just one. If you need to handle only #N/A, use IFNA instead.
- Putting the fallback value in the wrong argument order. The first argument is the formula, the second is the fallback.
- Using IFERROR with array formulas that return multiple values; it may not work as expected in older Excel versions.
Alternatives to IFERROR
Excel offers IFNA, which only catches #N/A errors, and IF(ISERROR(...)) which is an older, more verbose way. For example, =IF(ISERROR(A1/B1), "Error", A1/B1) is equivalent to =IFERROR(A1/B1, "Error"). IFNA is preferred when you only want to handle missing lookup values, because it leaves other errors visible.
Common Problems and Solutions
- IFERROR not working with VLOOKUP: Make sure the lookup range is correct and the value exists; IFERROR only handles errors, not incorrect results.
- IFERROR returns 0 but you want blank: Use
""as the second argument, e.g.,=IFERROR(A1/B1, ""). - IFERROR hides errors in a whole column: This is by design, but you can use conditional formatting to highlight cells that contain errors before wrapping them with IFERROR.
- IFERROR with array formulas: In older Excel, you may need to enter with Ctrl+Shift+Enter. In Excel 365, it works normally.
Frequently Asked Questions
Can IFERROR return a blank cell?
Yes, use an empty string "" as the second argument. For example, =IFERROR(A1/B1, "") returns an empty cell instead of an error.
What is the difference between IFERROR and IFNA?
IFERROR catches all error types (#N/A, #DIV/0!, #VALUE!, etc.), while IFNA only catches #N/A errors. Use IFNA when you specifically want to handle missing lookup values and leave other errors visible for debugging.
Does IFERROR work with VLOOKUP?
Yes, you can wrap VLOOKUP in IFERROR to return a custom message when the lookup value is not found. For example, =IFERROR(VLOOKUP(A1, B:C, 2, FALSE), "Not found").
Can IFERROR be used with array formulas?
In Excel 365 and Excel 2021, IFERROR works with dynamic arrays. In older versions, you may need to enter array formulas with Ctrl+Shift+Enter, and IFERROR may not behave as expected with multi-cell arrays.
Why is my IFERROR returning the fallback value even when there is no error?
This usually means the formula in the first argument is actually producing an error. Check the formula for issues like division by zero, incorrect references, or data type mismatches. You can temporarily remove IFERROR to see the underlying error.
Can I use IFERROR to handle errors in a whole column?
Yes, you can apply IFERROR to each cell in a column by copying the formula down. For example, =IFERROR(A1/B1, 0) in row 1 and then drag down. This will return 0 for any division by zero in that column.