One of the most useful functions in Google Sheets is the ISERROR function, which allows you to check if a value in a specific cell is an error.
The basic syntax of this function is as follows:
=ISERROR(A1)
This function returns TRUE if the value in cell A1 is an error, otherwise it returns FALSE.
Example 1: Using ISERROR to Return a New Value
Let’s say we are trying to divide the values in column A by the values in column B in the following Google Sheets spreadsheet:
When we divide by zero, we get #DIV/0! in column C.
We could use the following formula to return the value “Invalid Division” instead:
=IF(ISERROR(A2/B2), "Invalid Division", A2/B2)
Here is a screenshot showing how to use this formula in practice:
If the ISERROR(A2/B2) function is TRUE, then “Invalid Division” is returned.
Otherwise, if the ISERROR(A2/B2) function is FALSE, then the result of A2/B2 is returned.
Example 2: Using ISERROR with VLOOKUP
Let’s say we are trying to perform a VLOOKUP in the following spreadsheet to find the value in the “Points” column that corresponds to a “Mag” name in the “Team” column:
Since the name “Mag” does not exist in the “Team” column, we get #N/A as the result.
We could use the following formula to return the value “Team Not Found” instead if the VLOOKUP formula fails to find the team name:
=IF(ISERROR(VLOOKUP("Mag", A1:B11, 2, FALSE)), "Team Not Found", VLOOKUP("Mag", A1:B11, 2, FALSE))
Here is a screenshot showing how to use this formula in practice:
Since the name “Mag” does not exist in the “Team” column, the formula returns “Team Not Found” as the result instead of #N/A.
Note: You can find the complete online documentation of the ISERROR function here.
Additional Resources
The following tutorials explain how to perform other common tasks in Google Sheets:
- How to Replace Text in Google Sheets
- How to Replace Blank Cells with Zero in Google Sheets
- How to Use a Case-Sensitive VLOOKUP in Google Sheets
Use these examples to get the most out of the ISERROR function in Google Sheets and simplify your calculation and data lookup tasks.