Spreadsheet Practice

IFERROR function

IFERROR returns a value you choose when a formula results in an error, and the formula's normal result otherwise. It keeps reports clean, turning #DIV/0! into 0 or a missing lookup into "Not found", but it also hides real mistakes, so wrap only the part you expect to fail.

Available in
Every current version
Category
Logical functions
Returns
The result of value, or value_if_error when value is any error: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? or #NULL!.
Google Sheets
Works the same way in Google Sheets.

Syntax

=IFERROR(value, value_if_error)

ArgumentRequired?What it is
valueRequiredThe formula to evaluate.
value_if_errorRequiredWhat to return if value is an error: a number, text in quotes, "" for a blank, or another formula.

Examples

Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.

CellFormulaResultWhat it shows
F2=IFERROR(B3/C3,0)0Raj has no orders: 0 instead of #DIV/0!
F3=IFERROR(VLOOKUP(E2,A2:B4,2,FALSE),"Not found")Not foundKim isn't in the list, so the fallback text shows
F4=IFERROR(B2/C2,0)$400No error here, so the normal result comes through: revenue per order

Try it live

This is the sample sheet. Change any number or text, or edit a formula, and the results update.

Show the sample data as a table
RepRevenueOrdersRep to findResult
Ana$4,80012Kim0
Raj$00Not found
Lee$3,1509$400

Practice IFERROR

From lesson 12, Tiered lookups & IFERROR. Graded instantly, then re-checked on changed data.

Unknown SKUs

In C2, look up the unit price for each SKU from E2:F5. If the SKU isn't in the price list, show Check SKU. Fill down to C6.

Common mistakes

What you seeWhy, and how to fix it
Hiding real errorsIFERROR catches every error, including typos (#NAME?) and broken references (#REF!). Wrap only the lookup or division you expect to fail, and use IFNA around lookups.
Returning 0 where a blank is betterA 0 drags down averages and shows up in charts. Return "" to leave the cell blank.
Debugging with IFERROR in placeTake IFERROR off while you build a formula, so you can see what is going wrong, then add it back.

Tips

  • XLOOKUP has its own if_not_found argument, so it doesn't need IFERROR.
  • Use IFNA instead when you only want to catch missing lookup values.

Questions

How do I hide #DIV/0! in Excel?

=IFERROR(B2/C2,0) shows 0, and =IFERROR(B2/C2,"") shows a blank, when the divisor is 0 or empty.

What is the difference between IFERROR and IFNA?

IFERROR catches every type of error. IFNA catches only #N/A, so other problems such as #REF! or #VALUE! still show up.

Can I use IFERROR with VLOOKUP?

Yes: =IFERROR(VLOOKUP(E2,A2:C20,3,FALSE),"Not found"). IFNA is safer, because it won't hide the #REF! from a wrong column number.

Lessons that use IFERROR

Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine.