IFERROR Function
The IFERROR function in Google Sheets returns a custom value if a formula results in an error, otherwise it returns the result of the formula.
Syntax
IFERROR(value, [value_if_error])
Examples
- Basic Error Handling
Handle division by zero error:
=IFERROR(1/0, "Error")
This will output ‘Error’ instead of showing a #DIV/0! error.
- Handle Errors in Lookup
Return ‘Not Found’ if a VLOOKUP fails:
=IFERROR(VLOOKUP(A1, B:C, 2, FALSE), "Not Found")
This will output ‘Not Found’ if the lookup value is not found.
Notes
- The IFERROR function is useful in preventing error messages from appearing in your sheet.
- It can be combined with any formula to handle potential errors.
Related Functions
- IFNA: Returns a custom value if a formula results in the #N/A error.
- ERROR.TYPE: Returns a number corresponding to the error type.