IFERROR: hide #DIV/0! errors

Lesson 12 of 54

IFERROR returns the result of a formula, or a value you choose if that formula gives an error like #DIV/0! or #N/A.

Some products had no visits, so dividing gives #DIV/0!. In cell D2, write a formula that divides Sales by Visits, but shows 0 if there is an error.

D2
ABCD
1ProductSalesVisitsConversion
2Mug120
3Shirt30600
4Cap8200

Type in the formula bar above and press Enter to check.

Skip

How IFERROR works

Syntax

=IFERROR(formula, value_if_error)
formula
The calculation that might fail.
value_if_error
What to show instead: 0, "", or a message like "Not found".

Example

You look up a client's balance with XLOOKUP, but some clients aren't in the list yet.

=IFERROR(XLOOKUP(A2, Clients!A:A, Clients!D:D), "New client")

Shows the balance, or "New client" instead of #N/A.

Common mistakes

  • Wrapping everything in IFERROR. It also hides real mistakes, like a typo in a range.
  • Returning 0 where a blank is better: zeros pull averages down. Use "" for "nothing to show".

Questions people ask

What is the difference between IFERROR and IFNA?

IFNA only catches #N/A (a lookup that found nothing) and lets other errors show, which is safer for lookups.

Practice it above: type the formula in the formula bar and press Enter to check.