IFERROR Function in Google Sheets
Returns a fallback value when a formula returns an error, otherwise returns the formula's result. The defensive wrapper that turns ugly error codes into clean output.
Syntax
IFERROR(value, [value_if_error])Returns: value if no error, otherwise value_if_error.
Excel equivalent: IFERROR (identical)
Parameters
| Name | Required | Description |
|---|---|---|
| value | Required | The formula or expression to evaluate. |
| value_if_error | Optional | What to return if value evaluates to an error. Defaults to an empty string if omitted. |
Examples
Hide #N/A from a VLOOKUP
=IFERROR(VLOOKUP(A2, Products!A:C, 3, FALSE), "Not found")When VLOOKUP doesn't find a match, the #N/A is replaced with the friendlier "Not found" message.
Default to zero on divide-by-zero
=IFERROR(A2/B2, 0)When B2 is zero or empty, A2/B2 produces #DIV/0!. IFERROR catches it and returns 0 instead.
Cascade lookups across multiple tables
=IFERROR(VLOOKUP(A2, Primary!A:B, 2, FALSE), IFERROR(VLOOKUP(A2, Backup!A:B, 2, FALSE), "Not in either"))Try the primary table first; on error, try the backup; on error from that, return a default message.
When to use an alternative
- IFNA — You specifically want to catch only #N/A and let other errors propagate.
- XLOOKUP — You're wrapping a lookup — XLOOKUP has built-in if_not_found, no IFERROR needed.
- ISERROR + IF — You need to take a different action than just substitution (e.g., log the error).
Common errors and how to fix them
Silently masks real bugs
Cause: IFERROR catches ALL errors including #REF!, #VALUE!, #NAME?, which often indicate genuine problems.
Fix: Prefer IFNA (only catches not-found) so legitimate errors still surface during development.
Returns blank instead of zero
Cause: value_if_error was omitted.
Fix: Always supply the second argument explicitly — `, 0` or `, ""` makes intent clear.
Related functions
Frequently Asked Questions
Should I use IFERROR or IFNA?
Use IFNA when you only want to catch "not found" cases (the most common scenario for lookups). Use IFERROR only when you genuinely want to catch every kind of error including #REF!, #VALUE!, #DIV/0!, etc. IFERROR is dangerous on production sheets because it hides real bugs.
Does IFERROR slow down a large sheet?
Minimally. IFERROR adds a single boolean check per call; the cost is dominated by whatever formula it wraps. If your sheet is slow, the issue is almost certainly the underlying formula (e.g., VLOOKUP across whole columns), not IFERROR.