Excel function guide · Logic
IFERROR function in Excel
IFERROR returns the result of a formula, or a value you choose if that formula produces an error such as #DIV/0! or #N/A. It's most often wrapped around divisions and lookups.
Syntax
=IFERROR(value, value_if_error)
| Argument | Required? | What it means |
|---|---|---|
| value | Required | The formula to try, for example B2/C2 or a lookup. |
| value_if_error | Required | What to return if it errors: 0, "" (looks blank), or a message in quotes. |
IFERROR examples
Every example uses this small table. The results are what Excel shows in the cell.
| A | B | C | |
|---|---|---|---|
| 1 | Store | Revenue | Orders |
| 2 | Leeds | 18,400 | 230 |
| 3 | York | 9,600 | 120 |
| 4 | Hull | 0 | 0 |
| 5 | Bath | 12,150 | 135 |
1. The problem
=B4/C4
Result: #DIV/0!
Hull had no orders, so revenue per order divides by zero.
2. Replace the error
=IFERROR(B4/C4, "No orders")
Result: No orders
Same calculation; the error is replaced with a message. On Leeds' row the same formula returns 80.
3. A lookup that may fail
=IFERROR(VLOOKUP("Derby", A2:C5, 2, FALSE), "Not listed")Result: Not listed
Derby isn't in the list, so VLOOKUP's #N/A becomes Not listed.
Try it now
Practise IFERROR in a live sheet.
Type each formula yourself. Answers are checked by the same engine as the full course. No account needed.
Step 1 of 3
In D2, calculate revenue per order (B2/C2), wrapped in IFERROR so an error shows 0.
Common IFERROR mistakes
Hiding real mistakes
IFERROR catches every error, including #NAME? from a typo and #REF! from a deleted column. For lookups, IFNA catches only #N/A, so genuine breakages still show.
Wrapping too early
Build and check the formula first, then add IFERROR. Otherwise a wrong formula can quietly show your fallback on every row.
0 versus ""
A 0 fallback is counted by AVERAGE and pulls it down; "" is text, which AVERAGE and SUM ignore. Pick the one that makes your totals right.
Using it instead of fixing the data
If a lookup returns #N/A because of extra spaces or numbers stored as text, clean the data. IFERROR would just hide valid matches.
Practise this in Excel Quest
AND, OR & IFERROR Members
Course 4 · Logic & Error Handling · 12 min
Combine conditions into real hiring rules and handle errors gracefully. The lesson covers AND, OR and IFERROR together, building real hiring rules.
This lesson is included in Formula Quest memberships. A free account starts you on the free lessons of the Excel Quest curriculum.