How to Use the ISERROR Function in Google Sheets
=ISERROR(value). It is most often used inside IF.
What ISERROR does
ISERROR asks one question: did this produce an error? That lets you replace ugly error codes with a message, or find the cells that need fixing. If you just want a replacement value, IFERROR is shorter. ISERROR is the better tool when you need a TRUE or FALSE flag, or want different handling for errors.
ISERROR syntax
=ISERROR(value)
Per Google's help page, ISERROR returns TRUE for any error, including #DIV/0!, #N/A, #NAME?, #NULL!, #NUM!, #VALUE! and #REF!. The related ISERR function excludes #N/A, so pick the right one for your case. The page notes it is most often used inside IF.
A step-by-step example
Cell A2 holds 10 and cell A3 holds 0.
| A | |
|---|---|
| 1 | Value |
| 2 | 10 |
| 3 | 0 |
=ISERROR(A2/A3)
This returns TRUE. Here is why: dividing by zero produces #DIV/0!, and ISERROR catches any error.
Show a friendly message
=IF(ISERROR(A2/A3), "Check divisor", A2/A3)
This returns Check divisor. If A3 held a nonzero number, the division result would appear instead. The same pattern wraps a lookup: Google's own sample shows IF(ISERROR(VLOOKUP(...)), "Result not found", VLOOKUP(...)). For lookups that fail with #N/A, see IFNA.
Common mistakes
- Hiding real problems. A message that covers every error can hide a typo in a formula.
- Repeating a long calculation in both the test and the result. IFERROR avoids that.
- Mixing up ISERROR and ISERR. ISERR ignores #N/A.
Try it yourself
Use the cells above (A2 and A3). Type your formula into the box, starting with =, then press Check.
Exercise 1: Is it an error?
Write a formula that checks whether dividing A2 by A3 produces an error.
Exercise 2: Friendly message
Write a formula that shows Check divisor if A2/A3 is an error, and the division result otherwise.
What to learn next
- IFERROR: replace an error with a clean result.
- IFNA: replace only #N/A errors.
- ISTEXT: check whether a value is text.
Syntax and rules in this guide were checked against Google's ISERROR help page. See all guides.