Excel tutorial
/

Functions

Intermediate

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.

Книга1 - Excel
—☐✕
E3fx=ЕСЛИОШИБКА(B3/C3;0)
ABCDEF
1ProductAmountQtyPlainWith IFERROR
2Rice240 0002012 00012 000
3Oil00#DIV/0!02
4Sugar150 0001212 50012 500
5Total#DIV/0!124 500
6
Готово
1 — one #DIV/0! breaks the total too. 2 — IFERROR replaced the error with 0, and the total works

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.

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Вставить функциюАвтосуммаФинансовыеЛогическиеТекстовыеДата и времяСсылки и массивыМатематические
Библиотека функций
Диспетчер имён
Определённые имена
D2fx
ABCDE
1ProductAmountQtyPrice
2Rice240 00020
3Oil00
4
5
Готово

3

In the window, enter B2/C2 as Value and 0 as Value_if_error, then click OK.

Книга1 - Excel
—☐✕
D2fx
ABCDE
1ProductAmountQtyPrice
2Rice240 00020
3Oil00
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")

Книга1 - Excel
—☐✕
C3fx=ЕСЛИОШИБКА(ВПР(A3;$E$2:$F$4;2;ЛОЖЬ);"Not found")
ABCDEFG
1CodeQtyPriceCodePrice
2A-101518 000A-10118 000
3B-2052Not foundA-10226 500
4A-102826 500C-3109 000
5C-31039 000
6
Готово
B-205 is not in the price list — “Not found” instead of #N/A

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")

Книга1 - Excel
—☐✕
D4fx=ЕСЛИОШИБКА((C4-B4)/B4;"New")
ABCDE
1Product20242025Growth
2Tea48 000 00055 200 00015%
3Coffee31 000 00027 900 000-10%
4Cocoa06 400 000New
5
Готово
Cocoa is new in 2025: “New” instead of #DIV/0!
Книга1 - Excel
—☐✕
B2fx=ЕСЛИОШИБКА(ВПР(A2;$D$2:$E$3;2;ЛОЖЬ);"Not found")
ABCDEF
1CodePriceCodePrice
2A-102 1Not foundA-10118 000
3A-10118 000A-10226 500
4A-102 26 500
5
Готово
1 — the code in A2 ends with an invisible space. It is in the list, but IFERROR hid the real cause. B4 is fixed with TRIM

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.
Книга1 - Excel
—☐✕
D5fx=СРЗНАЧ(D2:D4)
ABCDEF
1ManagerSalesPlanError → 0Error → ""
2Aziz9010090%90%
3Dilnoza5000%
4Javohir120100120%120%
5Average70%105%
6
Готово
Dilnoza’s plan was never entered. With 0 the average is 70%, with a blank it is 105%. A big difference!

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?

Книга1 - Excel
—☐✕
Буфер обмена
Шрифт
Выравнивание
Число
Стили
Ячейки
Редактирование
✕✓fx
ABCDEFGHIJKLMNOPQRSTUVWX
1ProductAmountQtyPrice
2Rice24000020
3Oil00
4Sugar15000012
5Flour960008
6Total
7
8
9
10
Лист1
Готово

Has ExcelLab been useful?

Support the project and help us release new lessons and exercises.

Support us
Previous

85 / 154