To trap and manage errors.
- value - the value, reference, or formula to check for an error
- value_if_error - the value to return if an error is found
=IFERROR(A2/B2, "Error in calculation")
returns 6 if A2=210 and B2=35 because A2/B2 = 6 is not an error.
=IFERROR(A3/B3, "Error in calculation")
returns "Error in calculation" if A3=55 and B3=0 because division by zero throws an error.
=IFERROR(A4/B4, "Error in calculation")
returns 0 if if A4="" and B2=23 because there is no error and "" is interpreted as 0.
If there is an error in a formula, the IFERROR function will return a specified value. Otherwise, it will return the result of the formula.
- The IFERROR formula returns a custom result when a formula generates an error and returns a standard result when no error is detected.
- IFERROR traps errors from other formulas or functions and returns a friendly result of your choosing when an error is detected.
- The IFERROR formula is a modern alternative to the ISERROR function.
- IFERROR can be a blunt instrument because it traps many kinds of errors. Using functions like the IFNA function lets you trap more specific errors. For example, IFNA specifically traps #N/A errors.
- IFERROR is part of the family of error functions in Sourcetable. Other error functions include ISERR, ISERROR, ISNA, and ERROR.TYPE.
Frequently Asked Questions
What is the IFERROR function?
IFERROR is a useful Sourcetable function for trapping errors in formulas. It returns a custom result of your choosing when a formula generates an error and otherwise returns a standard result from a formula when no error is detected.
How is the IFERROR function used?
To use the IFERROR function, you need to specify a formula to check for errors and a value to return in case of an error. For example:
This formula would divide A1 by A2, and return "Error" if any type of error occurred.
Why is the IFERROR function useful?
The IFERROR function is useful because it allows you to trap errors without using more complicated nested IF statements. It is also an elegant way to find errors, because you can return a human-readable message when an error is detected.
Are there other error functions?
Yes, there are other error functions available in Sourcetable, and sometimes it is better to use them over IFERROR. For example the IFNA function maybe a better option than IFERROR, because it checks for specific types of errors. Other error functions include: