How to Use IFERROR in Google Sheets

By Tomosuke Hasegawa · Updated Oct 29, 2026 · Beginner · 5 min read · includes 2 free exercises

In short: IFERROR returns the value you give it, unless that value is an error, in which case it returns a replacement. The formula is =IFERROR(value, [value_if_error]).

What IFERROR does

Formulas break: a lookup finds nothing, a division uses zero. IFERROR catches the error and shows something else, so your sheet stays readable. If you leave out the replacement, the cell shows a blank.

IFERROR syntax

=IFERROR(value, [value_if_error])

Google's help page says IFERROR(exp1, exp2) is logically the same as IF(NOT(ISERROR(exp1)), exp1, exp2).

A step-by-step example: a failed lookup

Here is a product table in cells A1:C5.

ABC
1IDNamePrice
2P-101Mug6.5
3P-102Lamp24
4P-103Backpack39
5P-104Notebook8.75

A lookup for an ID that does not exist normally shows #N/A. To show a message instead:

=IFERROR(VLOOKUP("P-999", A2:C5, 3, FALSE), "Not found")

This returns Not found. Here is why:

  1. Sheets tries the VLOOKUP. There is no P-999, so it produces #N/A.
  2. IFERROR sees the error and returns its second argument instead.
  3. If the ID did exist, the price would come through unchanged.

A second example: dividing by zero

Say A2 holds a total of 50 and B2 holds a count of 0.

AB
1TotalPeople
2500
=IFERROR(A2/B2, 0)

Dividing by zero is an error, so this returns 0 instead of #DIV/0!.

Common IFERROR mistakes

Try it yourself

Use the tables above. Type your formula into the box, starting with =, then press Check.

Exercise 1: Friendly lookup

Write a formula that looks up "P-999" in A2:C5 and returns the Price (column 3) with an exact match, but shows Not found if the lookup fails.

Hint: wrap the whole VLOOKUP, then add "Not found" as the second argument.

Exercise 2: Avoid #DIV/0!

Write a formula that divides A2 by B2, but returns 0 if the division is an error.

Hint: IFERROR(A2/B2, ...).

What to learn next

Syntax and rules in this guide were checked against Google's IFERROR help page. See all guides.