formulastreak

Logic and errors function

IFERROR function in Google Sheets and Excel

IFERROR returns a value when it's fine and a fallback of your choice when it's any error.

Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet

Syntax

IFERROR(value, value_if_error)

Arguments in [brackets] are optional. Google Sheets writes it IFERROR(value, [value_if_error]).

Example

=IFERROR(C2/B2,0) reads: Divide sales C2 by clicks B2, and show 0 instead of an error when that fails (a campaign with 0 clicks).

Marketing campaigns · edit D2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultD2 = 3.0%
ABCDE
1CampaignClicksSalesConversionOwner
2Spring email1200363.0%Mara
3Instagram860121.4%
4Display ads000.0%Jonas
5Search ads2300693.0%Priya
6Newsletter540275.0%
7Partner blog000.0%Kenji

D4 shows 0.0% instead of #DIV/0!; rows with clicks still show their conversion, like 3.0% in D2.

How the spreadsheet calculates it

Returns C2 divided by B2, but if that gives any error, shows 0 instead. Careful: it hides every error, typos included.

  1. 1. IFERROR: Returns C2 divided by B2, but if that gives any error, shows 0 instead. Careful: it hides every error, typos included.
    • value = `C2/B2`: the calculation that might fail
    • fallback = `0`: what to show instead of an error

More IFERROR examples

  • =IFERROR(C2/B2,0)The conversion rate, or 0 when there were no clicks.
  • =IFERROR(C2/B2,"")The same, but the cell looks empty instead.
  • =IFERROR(VALUE(A2),"Not a number")Convert text to a number, with a message when it can't.

Paste any of these into the formula explainer to see it step by step.

Tips

  • Prefer IFNA around lookups so a broken formula still shows its error.
  • Prefer testing the cause (IF(B2=0, "", C2/B2)) when you know what the error will be.
  • Use "" as the fallback when an empty-looking cell reads better than 0, but remember that "" is text in further maths.
  • Add IFERROR last, after the formula works, so it can't hide a mistake you made while writing it.

What IFERROR is used for

Keeping dashboards clean where some rows can't be calculated yet (no clicks, no sales), and giving lookups a friendly fallback when every error really means “not available”.

Arguments

ArgumentRequiredWhat it is
valueYesThe calculation that might fail, such as C2/B2 or a lookup.
value_if_errorYesWhat to show instead of an error: 0, "" for a blank look, or a message.Watch out: Required in Excel; leaving it out isn't valid.

Common mistakes

  • Leaving out the fallback: IFERROR(C2/B2) isn't complete.

  • Wrapping everything in IFERROR, so real mistakes stay hidden.

  • Wrapping lookups in IFERROR: it also hides a wrong column number (#REF!). IFNA only catches “not found”.

  • Hiding an error before knowing why it happens.

In Google Sheets

Google Sheets' IFERROR makes the second argument optional: left out, an error shows as a blank.

Errors you may see with IFERROR

  • #DIV/0!: IFERROR is often used to replace #DIV/0!; testing the divisor with IF is usually clearer.
  • #SPILL!: Microsoft's list of errors IFERROR catches doesn't include #SPILL! or #CALC!.

Questions

How do I use IFERROR with VLOOKUP?

Wrap the whole lookup and add the fallback: =IFERROR(VLOOKUP(B2,$G$2:$J$8,4,FALSE),"Not found"). The guide on how to use IFERROR with VLOOKUP shows it on a live sheet, with IFNA and XLOOKUP's built-in fallback.

IFERROR or IFNA?

IFNA around lookups, IFERROR only when every error means the same thing. See IFERROR vs IFNA.

How do I show a blank instead of an error?

Use an empty string as the fallback: IFERROR(C2/B2, "").

Does IFERROR slow a spreadsheet down?

Microsoft's page doesn't say, and we haven't measured it. Choose it for meaning: use it only where hiding every error is what you want.

Sources

Official documentation the facts on this page were checked against.

Practise IFERROR on a live sheet

Lesson 14, Errors and blank cells (Unit 3, Decisions), has 5 graded exercises, checked instantly, with steps and hints when you're stuck. Pro