IFERROR
Return your own value when a formula produces any error, instead of showing #N/A or #REF!.
Syntax
IFERROR(value, value_if_error) | Argument | Required | Description |
|---|---|---|
value | Required | The formula to evaluate. |
value_if_error | Required | What to return if that formula produces any error at all. |
Examples
Every example below was executed against VisiGrid engine 0.35.0 — not
transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.
| Formula | Result | Notes |
|---|---|---|
=IFERROR(VLOOKUP(999,A2:D4,3,FALSE),"none") | none | The lookup fails with #N/A; the fallback is returned instead. |
=IFERROR(1/0,"div by zero") | div by zero | Catches #DIV/0! the same way. |
=IFERROR(D2/D3,"n/a") | 0.71 | No error, so the original result comes through untouched. |
It hides every error, not just the one you meant
This is the part worth understanding before reaching for it. IFERROR catches
all errors — #N/A, #REF!, #DIV/0!, #VALUE!, #NAME? — and replaces
them with your fallback.
That is fine when the only thing that can go wrong is a missing match. It is
dangerous around anything else, because #REF! means your range is broken, and
IFERROR will quietly report “none” instead:
=IFERROR(VLOOKUP(999, A2:D4, 3, FALSE), "none")
If someone later deletes column C, that formula does not start failing. It keeps
saying none, forever, and the spreadsheet looks like it is working.
What to use instead
- For a missing lookup specifically,
XLOOKUPtakes a not-found value as an argument, so only a genuine miss is substituted and real errors still surface. See XLOOKUP vs VLOOKUP. - To test existence,
COUNTIFreturns0rather than an error, so there is nothing to suppress. IFNA, where available, catches only#N/Aand lets everything else through. That is usually what people mean when they writeIFERROR.
Use IFERROR when you have thought about which errors are possible and decided
you want all of them hidden. That is a narrower situation than its popularity
suggests.
Excel compatibility
Matches Excel.