Excel IFERROR function: a clean result instead of #N/A and #DIV/0!
IFERROR returns your own value when a formula results in an error. With VLOOKUP, 0 vs "", the danger of hiding errors, and IFNA.
IFERROR evaluates a formula: if the result is normal, it returns it; if it is an error (#N/A, #DIV/0!, #VALUE! and others), it returns the value you specify.
#DIV/0! and #N/A make a report look broken, and worse, one error cell turns every formula that uses it into an error too: SUM returns #N/A as well. IFERROR swaps the error for 0, a blank or a clear label like “Not found”.
But IFERROR is a powerful and dangerous tool. It hides any error, including your own mistakes. More on that below.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Product | Amount | Qty | Plain | With IFERROR | |
| 2 | Rice | 240 000 | 20 | 12 000 | 12 000 | |
| 3 | Oil | 0 | 0 | #DIV/0! | 02 | |
| 4 | Sugar | 150 000 | 12 | 12 500 | 12 500 | |
| 5 | Total | #DIV/0!1 | 24 500 | |||
| 6 |
Syntax
=ЕСЛИОШИБКА(value; value_if_error)
- value — the formula or reference to check:
B2/C2,VLOOKUP(…). - value_if_error — what to return on error:
0,""(blank),"Not found"or another formula.
IFERROR catches every error type: #N/A, #DIV/0!, #VALUE!, #REF!, #NAME?, #NUM!, #NULL!. It has existed since Excel 2007.
Step by step: wrapping an existing formula in IFERROR
1
Select the cell whose formula returns an error, for example D2 with =B2/C2.
2
In the formula bar, type IFERROR( right after = and add ,0) at the end: =ЕСЛИОШИБКА(B2/C2;0). Or choose Формулы → Логические → IFERROR.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Product | Amount | Qty | Price | |
| 2 | Rice | 240 000 | 20 | ||
| 3 | Oil | 0 | 0 | ||
| 4 | |||||
| 5 |
3
In the window, enter B2/C2 as Value and 0 as Value_if_error, then click OK.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Product | Amount | Qty | Price | |
| 2 | Rice | 240 000 | 20 | ||
| 3 | Oil | 0 | 0 | ||
| 4 | |||||
| 5 |
4
Fill the formula down. Rows that used to show an error now show 0, and the total calculates correctly.
Example 1: codes VLOOKUP couldn’t find
You look up a price by product code. A code missing from the price list returns #N/A. With IFERROR you get a readable label instead:
=ЕСЛИОШИБКА(ВПР(A2;$E$2:$F$4;2;ЛОЖЬ);"Not found")
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Code | Qty | Price | Code | Price | ||
| 2 | A-101 | 5 | 18 000 | A-101 | 18 000 | ||
| 3 | B-205 | 2 | Not found | A-102 | 26 500 | ||
| 4 | A-102 | 8 | 26 500 | C-310 | 9 000 | ||
| 5 | C-310 | 3 | 9 000 | ||||
| 6 |
Example 2: growth for a product with no sales last year
Growth is (This year − Last year) / Last year. For a new product last year is 0 — division by zero. Showing 0% would be wrong (there is growth!), so return meaningful text instead:
=ЕСЛИОШИБКА((C2-B2)/B2;"New")
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Product | 2024 | 2025 | Growth | |
| 2 | Tea | 48 000 000 | 55 200 000 | 15% | |
| 3 | Coffee | 31 000 000 | 27 900 000 | -10% | |
| 4 | Cocoa | 0 | 6 400 000 | New | |
| 5 |
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Code | Price | Code | Price | ||
| 2 | A-102 1 | Not found | A-101 | 18 000 | ||
| 3 | A-101 | 18 000 | A-102 | 26 500 | ||
| 4 | A-102 | 26 500 | ||||
| 5 |
Pro level: 0 or blank, IFNA and a fallback lookup
- 0 distorts the average. After
IFERROR(…,0), AVERAGE counts the zeros and the average drops. An empty string""is skipped by AVERAGE and SUM. But arithmetic with""(=E3*2) gives #VALUE!. Choose based on what is calculated next. - IFNA.
=ЕСНД(ВПР(…);"Not found")catches only “not found”. If the range breaks (#REF!), you see it immediately. - XLOOKUP has it built in.
=ПРОСМОТРX(A2;E:E;F:F;"Not found")— the fourth argument works without IFERROR. - Fallback lookup. Not in the first list? Try the second:
=ЕСЛИОШИБКА(ВПР(A2;Prices1;2;ЛОЖЬ);ВПР(A2;Prices2;2;ЛОЖЬ)). - The old way.
=ЕСЛИ(ЕОШИБКА(B2/C2);0;B2/C2)calculates the formula twice. IFERROR is shorter and faster.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Manager | Sales | Plan | Error → 0 | Error → "" | |
| 2 | Aziz | 90 | 100 | 90% | 90% | |
| 3 | Dilnoza | 50 | 0 | 0% | ||
| 4 | Javohir | 120 | 100 | 120% | 120% | |
| 5 | Average | 70% | 105% | |||
| 6 |
Try it in the simulator
Type =ЕСЛИОШИБКА(B2/C2;0) in D2 and fill it down to D5. Then type =СУММ(D2:D5) in D6 — does the total calculate without an error?
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Product | Amount | Qty | Price | ||||||||||||||||||||
| 2 | Rice | 240000 | 20 | |||||||||||||||||||||
| 3 | Oil | 0 | 0 | |||||||||||||||||||||
| 4 | Sugar | 150000 | 12 | |||||||||||||||||||||
| 5 | Flour | 96000 | 8 | |||||||||||||||||||||
| 6 | Total | |||||||||||||||||||||||
| 7 | ||||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.