IFERROR
Check a formula for errors. Return a fallback value when one occurs, or the formula result when it does not.
Spreadsheet editor
Spreadsheet editor
Syntax
=IFERROR(value, value_if_error)
Returns: Varies Arguments
| Argument | Required | Description |
|---|---|---|
| value | Yes | The value or formula that you want to evaluate for potential errors. |
| value_if_error | Yes | The value to return if the first argument is an error. |
About
The most common use is wrapping lookup formulas. A VLOOKUP that can't find its target returns #N/A, which then breaks any formula referencing that cell. Wrapping it in IFERROR lets you return a blank, a zero, or a label like "Not found" instead. The same applies to MATCH, division formulas, and any calculation that may fail on incomplete data.
If you only need to catch #N/A errors (like lookup misses), use IFNA instead. It leaves other errors visible, which helps catch real formula bugs. To identify which specific error type a cell contains, use ERROR.TYPE.
Exercises using IFERROR
Basic IFERROR exercise
BeginnerOpen exercise
Error-proof a complex formula chain
IntermediateWrite a markup formula and then wrap it in layered error handling to display friendly messages for each error type.
Open exerciseNested IFERROR for multi-table fallback
IntermediateSearch across three inventory lists and return "Not found" only when a code is missing everywhere.
Open exerciseExtract data from mixed format
AdvancedExtract product codes from descriptions with mixed labels and positions.
Open exerciseExamples
VLOOKUP without and with IFERROR
Spreadsheet editor
How the fallback value affects AVERAGE
Spreadsheet editor
Clean imported data with IFERROR and VALUE
Spreadsheet editor
Watch out for
Masking real formula errors
Wrapping every formula in IFERROR can hide errors caused by wrong references, typos in function names, or broken logic. Problems may go unnoticed until the results are clearly wrong.
→ Only use IFERROR where errors are expected, such as lookups that may find no match. Leave other formulas uncovered during development so errors are easy to spot.
Catching more errors than intended
IFERROR catches all error types. If your formula has a typo in a range reference, the resulting #REF! error is silently swallowed along with the #N/A misses you expected.
→ When you only expect #N/A errors (like lookup misses), use IFNA instead. It leaves other error types visible so formula mistakes don't go unnoticed.
Returning zero when you want blank
Using 0 as the fallback value includes those cells in SUM, AVERAGE, and COUNT calculations, which can distort totals when errors represent missing data rather than actual zeros.
→ Use "" (empty string) when you want a blank cell that doesn't affect calculations. Use 0 only when zero is the correct value for the error case.