FormulaCamp
Completed
← All functions
Logic

IFERROR

Replaces any error.

Syntax

IFERROR(value, value_if_error)

Example: =IFERROR(B2/C2,0)

Available in: All versions

IFERROR returns a replacement value when a formula produces any error, and the formula result otherwise: =IFERROR(value, value_if_error). It is the quickest way to hide #N/A, #DIV/0! and similar errors in reports.

When to use it

Arguments explained

Worked examples

Safe division

AB
1RevenueUnits
2100

Formula: D2: =IFERROR(A2/B2,0)

Result: 0

Dividing by zero gives #DIV/0!, which IFERROR replaces with 0.

Friendly lookup failure

AB
1SKUPrice
2A10124.99
3A10239

Formula: D2: =IFERROR(VLOOKUP("Z9",A2:B3,2,FALSE),"Not found")

Result: Not found

Z9 is not in the list, so VLOOKUP returns #N/A and IFERROR shows the text.

Average of an empty range

A
1Notes
2n/a
3pending

Formula: D1: =IFERROR(AVERAGE(B2:B4),"No data")

Result: No data

AVERAGE of cells with no numbers gives #DIV/0!, replaced by "No data".

Try it

A tiny spreadsheet with example data. Edit the formula or any number and see the result.

Formula in F2: =IFERROR(B3/D3,"n/a")

Example spreadsheet for IFERROR
ABCDEF
1StudentScoreExtra creditAttemptsResult
2Ann92Yes2n/a
3Bob74No0
4Cy58Yes3
5Dee81No1
6Eli662
Result in F2: n/a
Practice this in a lesson: IFERROR and Checking Functions

Common errors and how to fix them

Related functions

Frequently asked questions

What is the difference between IFERROR and IFNA?
IFERROR catches all error types. IFNA catches only #N/A, so genuine mistakes stay visible.
Does IFERROR work with arrays?
Yes, in Microsoft 365 it works across spilled results.
Should I wrap every formula in IFERROR?
No. Hiding errors can mask broken references. Use it where a failure is expected.
Can IFERROR return a blank?
Yes: =IFERROR(A1/B1,"").

Practice

More in Logic