Summary
Syntax
=IFERROR(value, value_if_error)
- value: The value, reference, or formula to check for an error.
- value_if_error: The value to return if an error is found.
Return value
How to use
Examples
IFERROR for Division
=IFERROR(A2/B2, "Cannot divide by zero")
IFERROR and VLOOKUP
=IFERROR(VLOOKUP(E2, A2:B10, 2, FALSE), "Item not found")
Using IFERROR vs IFNA
When handling errors in Excel, IFERROR and IFNA both offer solutions, but they serve different purposes. IFERROR is a broad solution that catches any type of error within a formula, making it a great choice for formulas where multiple error types could occur, and a unified response is sufficient. It streamlines error handling by providing a single fallback for all errors, but this convenience may come at the cost of masking various types of errors, some of which might require special attention.
On the other hand, IFNA is specifically designed to catch only #N/A errors, which commonly occur in lookup functions when a value isn’t found. It’s ideal when you’re confident that #N/A is the only error your formula could encounter and other errors, if they occur, need to be visible for diagnosis. IFNA ensures that you’re informed about other potential issues in your data or formula by not masking errors other than #N/A.
In choosing between IFERROR and IFNA, consider the nature of the errors your formula might encounter and the balance you need to strike between convenience and precision. IFERROR offers a one-size-fits-all solution, while IFNA allows for more targeted error handling while keeping other types of errors in plain sight.
Additional Notes
- IFERROR can trap all types of errors, which in some cases might mask unexpected problems in your data or formula. Use it when you’re certain of the types of errors you expect.
- For situations where only #N/A errors need to be caught, consider using the more specific IFNA function.
- Always ensure that the value_if_error is appropriate for the possible errors and the context of your data to avoid misleading results.
- In Excel 2013 and later versions, you can use additional error-handling functions like ISERROR, ISERR, ISNA, and ERROR.TYPE for more customized error handling strategies.