SheetsLessons
Logical function

IFERROR function in Google Sheets

IFERROR returns a value you choose when a formula results in an error, and the normal result otherwise. Use it to replace #N/A, #DIV/0! and friends with something readable.

Syntax

=IFERROR(value, [value_if_error])
value
The formula to try.
value_if_error
Optional. What to show if it errors (defaults to an empty cell).

Practice IFERROR

Task 1 of 2

Calculate revenue per click for the first campaign (B2 ÷ C2). Some campaigns have 0 clicks, so show 0 instead of an error.

D2
fx

Tip: while typing a formula, click a cell or drag across cells to insert references. Press Enter to check, and Tab to accept a function suggestion.

IFERROR examples

Each example below runs against this sample sheet. The results are calculated by the same engine as the practice grid.

ABCDE
1Emp IDNameDeptEmailSalary
21042Maya PatelFinancemaya.patel@acme.co$72,000.00
31187Leo RossiSupportleo.rossi@acme.co$51,000.00
41305Ava KimSalesava.kim@acme.co$64,000.00
51411Omar AliMarketingomar.ali@acme.co$58,000.00
61520Hana TanakaSaleshana.tanaka@acme.co$69,000.00
Employee directory
FormulaResultWhat it shows
=IFERROR(VLOOKUP(9999, A2:C6, 2, FALSE), "Not found")Not foundThe ID doesn't exist, so the fallback is shown.
=IFERROR(VLOOKUP(1187, A2:C6, 2, FALSE), "Not found")Leo RossiNo error, so the normal result comes through.
=IFERROR(E2 / 0, 0)0Division by zero becomes 0.

Tips and common mistakes

  • IFERROR hides every error, including ones caused by typos and broken ranges. When you only expect "not found", IFNA is safer.
  • Don't use it to silence errors you haven't investigated, because it can hide real problems in your data.

Related functions