Excel iferror with if

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel Web App Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less

You can use the IFERROR function to trap and handle errors in a formula. IFERROR returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula.

Syntax

IFERROR(value, value_if_error)

The IFERROR function syntax has the following arguments:

  • value    Required. The argument that is checked for an error.

  • value_if_error    Required. The value to return if the formula evaluates to an error. The following error types are evaluated: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!.

Remarks

  • If value or value_if_error is an empty cell, IFERROR treats it as an empty string value («»).

  • If value is an array formula, IFERROR returns an array of results for each cell in the range specified in value. See the second example below.

Examples

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter.

Quota

Units Sold

210

35

55

0

23

Formula

Description

Result

=IFERROR(A2/B2, «Error in calculation»)

Checks for an error in the formula in the first argument (divide 210 by 35), finds no error, and then returns the results of the formula

6

=IFERROR(A3/B3, «Error in calculation»)

Checks for an error in the formula in the first argument (divide 55 by 0), finds a division by 0 error, and then returns value_if_error

Error in calculation

=IFERROR(A4/B4, «Error in calculation»)

Checks for an error in the formula in the first argument (divide «» by 23), finds no error, and then returns the results of the formula.

0

Example 2

Quota

Units Sold

Ratio

210

35

6

55

0

Error in calculation

23

0

Formula

Description

Result

=C2

Checks for an error in the formula in the first argument in the first element of the array (A2/B2 or divide 210 by 35), finds no error, and then returns the result of the formula

6

=C3

Checks for an error in the formula in the first argument in the second element of the array (A3/B3 or divide 55 by 0), finds a division by 0 error, and then returns value_if_error

Error in calculation

=C4

Checks for an error in the formula in the first argument in the third element of the array (A4/B4 or divide «» by 23), finds no error, and then returns the result of the formula

0

Note: If you have a current version of Microsoft 365, then you can input the formula in the top-left-cell of the output range, then press ENTER to confirm the formula as a dynamic array formula. Otherwise, the formula must be entered as a legacy array formula by first selecting the output range, input the formula in the top-left-cell of the output range, then press CTRL+SHIFT+ENTER to confirm it. Excel inserts curly brackets at the beginning and end of the formula for you. For more information on array formulas, see Guidelines and examples of array formulas.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Need more help?

Функция IFERROR (ЕСЛИОШИБКА) в Excel лучше всего подходит для обработки случаев, когда формулы возвращают ошибку. Используя эту функцию, вы можете указать, какое значение функция должна возвращать вместо ошибки. Если функция в ячейке не возвращает ошибку, то возвращается её собственный результат.

Содержание

  1. Видеоурок
  2. Что возвращает функция
  3. Синтаксис
  4. Аргументы функции
  5. Дополнительная информация
  6. Примеры использования функции IFERROR (ЕСЛИОШИБКА) в Excel
  7. Пример 1. Заменяем ошибки в ячейке на пустые значения
  8. Пример 2. Заменяем значения без данных при использовании функции VLOOKUP (ВПР) на “Не найдено”
  9. Пример 3. Возвращаем значение “0” вместо ошибок формулы

Видеоурок

Что возвращает функция

Указанное вами значение, в случае если в ячейке есть ошибка.

Синтаксис

=IFERROR(value, value_if_error) — английская версия

=ЕСЛИОШИБКА(значение;значение_если_ошибка) — русская версия

Аргументы функции

  • value (значение) — это аргумент, который проверяет, есть ли в ячейке ошибка. Обычно, ошибкой может быть результат какого либо вычисления;
  • value_if_error (значение_если_ошибка) — это аргумент, который заменяет ошибку в ячейке (в случае её наличия) на указанное вами значение. Ошибки могут выглядеть так:  #N/A, #REF!, #DIV/0!, #VALUE!, #NUM!, #NAME?, #NULL! (английская версия Excel) или #ЗНАЧ!, #ДЕЛ/0, #ИМЯ?, #Н/Д, #ССЫЛКА!, #ЧИСЛО!, #ПУСТО! (русская версия Excel).

Дополнительная информация

  • Если вы используете кавычки («») в качестве аргумента value_if_error (значение_если_ошибка), ячейка ничего не отображает в случае ошибки.
  • Если аргумент value (значение) или value_if_error (значение_если_ошибка) ссылается на пустую ячейку, она рассматривается как пустая.

Примеры использования функции IFERROR (ЕСЛИОШИБКА) в Excel

Пример 1. Заменяем ошибки в ячейке на пустые значения

Если вы используете функции, которые могут возвращать ошибку, вы можете заключить ее в функцию и указать пустое значение, возвращаемое в случае ошибки.

В примере, показанном ниже, результатом ячейки D4 является # DIV/0!.

IFERROR в Excel

Для того, чтобы убрать информацию об ошибке в ячейке используйте эту формулу:

=IFERROR(A1/A2,””) — английская версия

=ЕСЛИОШИБКА(A1/A2;»») — русская версия

IFERROR в Excel

В данном случае функция проверит, выдает ли формула в ячейке ошибку, и, при её наличии, выдаст пустой результат.

В качестве результата формулы, исправляющей ошибки, вы можете указать любой текст или значение, например, с помощью следующей формулы:

Telegram Logo Больше лайфхаков в нашем Telegram Подписаться

=IFERROR(A1/A2,”Error”) — английская версия

=ЕСЛИОШИБКА(A1/A2;»») — русская версия

IFERROR в Excel

Если вы пользуетесь версией Excel 2003 или ниже, вы не найдете функцию IFERROR (ЕСЛИОШИБКА). Вместо нее вы можете использовать обычную функцию IF или ISERROR.

Пример 2. Заменяем значения без данных при использовании функции VLOOKUP (ВПР) на “Не найдено”

Когда мы используем функцию VLOOKUP (ВПР), часто сталкиваемся с тем, что при отсутствии данных по каким либо значениям, формула выдает ошибку “#N/A”.

На примере ниже, мы хотим с помощью функции VLOOKUP (ВПР) для выбранных студентов подставить данные из результатов экзамена.

IFERROR в Excel

На примере выше, в списке студентов с результатами экзамена нет данных по имени Иван, в результате, при использовании функции VLOOKUP (ВПР), формула нам выдает ошибку.

Как раз в этом случае мы можем воспользоваться функцией IFERROR (ЕСЛИОШИБКА), для того, чтобы результат вычислений выглядел корректно, без ошибок. Добиться этого мы можем с помощью формулы:

=IFERROR(VLOOKUP(D2,$A$2:$B$12,2,0),”Не найдено”) — английская версия

=ЕСЛИОШИБКА(ВПР(D2;$A$2:$B$12;2;0);»Не найдено») — русская версия

IFERROR в Excel

Пример 3. Возвращаем значение “0” вместо ошибок формулы

Если у вас нет конкретного значения, которое вы бы хотели использовать для замены ошибок — оставляйте аргумент функции value_if_error (значение_если_ошибка) пустым, как показано на примере ниже и в случае наличия ошибки, функция будет выдавать “0”:

IFERROR в Excel

Skip to content

Функция ЕСЛИОШИБКА – примеры формул

В статье описано, как использовать функцию ЕСЛИОШИБКА в Excel для обнаружения ошибок и замены их пустой ячейкой, другим значением или определённым сообщением. Покажем примеры, как использовать функцию ЕСЛИОШИБКА с функциями визуального просмотра и сопоставления индексов, а также как она сравнивается с ЕСЛИ ОШИБКА и ЕСНД.

«Дайте мне точку опоры, и я переверну землю», — сказал однажды Архимед. «Дайте мне формулу, и я заставлю ее вернуть ошибку», — сказал бы пользователь Excel. Здесь мы не будем рассматривать, как получить ошибки в Excel. Мы узнаем, как предотвратить их, чтобы ваши таблицы были чистыми, а формулы — понятными и точными.

Итак, вот о чем мы поговорим:

Что означает функция Excel ЕСЛИОШИБКА

Функция ЕСЛИОШИБКА (IFERROR по-английски) предназначена для обнаружения и устранения ошибок в формулах и вычислениях. Это значит, что функция ЕСЛИОШИБКА должна выполнить определенные действия, если видит какую-либо ошибку. Более конкретно, она проверяет формулу и, если вычисление дает ошибку, то она возвращает какое-то другое значение, которое вы ей укажете. Если же всё хорошо, то просто возвращает результат формулы.

Синтаксис функции Excel ЕСЛИОШИБКА следующий:

ЕСЛИОШИБКА(значение; значение_если_ошибка)

Где:

  • Значение (обязательно) — что проверять на наличие ошибок. Это может быть формула, выражение или ссылка на ячейку.
  • Значение_если_ошибка (обязательно) — что возвращать при обнаружении ошибки. Это может быть пустая строка (получится пустая ячейка), текстовое сообщение, числовое значение, другая формула или вычисление.

Например, при делении двух столбцов чисел можно получить кучу разных ошибок, если в одном из столбцов есть пустые ячейки, нули или текст.

Рассмотрим простой пример:

Чтобы этого не произошло, используйте формулу ЕСЛИОШИБКА, чтобы перехватывать и обрабатывать их нужным вам образом.

Если ошибка, то пусто

Укажите пустую строку (“”) в аргументе значение_если_ошибка, чтобы вернуть пустую ячейку, если обнаружена ошибка:

=ЕСЛИОШИБКА(A4/B4; «»)

Вернемся к нашему примеру и используем ЕСЛИОШИБКА:

Как видите по сравнению с первым скриншотом, вместо стандартных сообщений мы видим просто пустые ячейки.

Если ошибка, то показать сообщение

Вы также можете отобразить собственное сообщение вместо стандартного обозначения ошибок Excel:

=ЕСЛИОШИБКА(A4/B4; «Ошибка в вычислениях»)

Перед вами – третий вариант  нашей небольшой таблицы.

5 фактов, которые нужно знать о функции ЕСЛИОШИБКА в Excel

  1. ЕСЛИОШИБКА в Excel обрабатывает все типы ошибок, включая #ДЕЛ/0!, #Н/Д, #ИМЯ?, #NULL!, #ЧИСЛО!, #ССЫЛКА! и #ЗНАЧ!.
  2. В зависимости от содержимого аргумента значение_если_ошибка функция может заменить ошибки вашим текстовым сообщением, числом, датой или логическим значением, результатом другой формулы или пустой строкой (пустой ячейкой).
  3. Если аргумент значение является пустой ячейкой, он обрабатывается как пустая строка (»’), но не как ошибка.
  4. ЕСЛИОШИБКА появилась в Excel 2007 и доступна во всех последующих версиях Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021 и Excel 365.
  5. Чтобы перехватывать ошибки в Excel 2003 и более ранних версиях, используйте функцию ЕОШИБКА в сочетании с функцией ЕСЛИ, например как показано ниже: 

=ЕСЛИ(ЕОШИБКА(A4/B4);»Ошибка в вычислениях»;A4/B4)

Далее вы увидите, как можно использовать ЕСЛИОШИБКА в Excel в сочетании с другими функциями для выполнения более сложных задач.

ЕСЛИОШИБКА с функцией ВПР

Часто встречающаяся задача в Excel – поиск нужного значения в таблице в соответствии с определёнными критериями. И не всегда этот поиск бывает успешным. Одним из наиболее распространенных применений функции ЕСЛИОШИБКА является сообщение пользователям, что искомое значение не найдено в базе данных. Для этого вы заключаете формулу ВПР в функцию ЕСЛИОШИБКА примерно следующим образом:

ЕСЛИОШИБКА(ВПР(  );»Не найдено»)

Если искомое значение отсутствует в таблице, которую вы просматриваете, обычная формула ВПР вернет ошибку #Н/Д:

Для лучшего понимания таблицы и улучшения ее внешнего вида, заключите функцию ВПР в ЕСЛИОШИБКА и покажите более понятное для пользователя сообщение:

=ЕСЛИОШИБКА(ВПР(D3; $A$3:$B$5; 2;ЛОЖЬ); «Не найдено»)

На скриншоте ниже показан пример ЕСЛИОШИБКА вместе с ВПР в Excel:

Если вы хотите перехватывать только #Н/Д, но не все подряд ошибки, используйте функцию ЕНД вместо ЕСЛИОШИБКА. Она просто возвращает ИСТИНА или ЛОЖЬ в зависимости от появления ошибки #Н/Д. Поэтому нам здесь еще понадобится функция ЕСЛИ, чтобы обработать эти логические значения:

=ЕСЛИ(ЕНД(ВПР(D3; $A$3:$B$5; 2;ЛОЖЬ)); «Не найдено»;ВПР(D3; $A$3:$B$5; 2;ЛОЖЬ))

Дополнительные примеры формул Excel ЕСЛИОШИБКА ВПР можно также найти в нашей статье Как убрать сообщение #Н/Д в ВПР?

Вложенные функции ЕСЛИОШИБКА для выполнения последовательных ВПР

В ситуациях, когда вам нужно выполнить несколько операций ВПР в зависимости от того, была ли предыдущая ВПР успешной или неудачной, вы можете вложить две или более функции ЕСЛИОШИБКА одну в другую.

Предположим, у вас есть несколько отчетов о продажах из региональных отделений вашей компании, и вы хотите получить сумму по определенному идентификатору заказа. С ячейкой В9 в качестве критерия поиска (номер заказа) и тремя небольшими таблицами поиска (таблица 1, 2 и 3), формула выглядит следующим образом:

=ЕСЛИОШИБКА(ВПР(B9;A3:B6;2;0);ЕСЛИОШИБКА(ВПР(B9;D3:E6;2;0);ЕСЛИОШИБКА(ВПР(B9;G3:H6;2;0);»Не найден»)))

Результат будет выглядеть примерно так, как на рисунке ниже:

То есть, если поиск завершился неудачей (то есть, ошибкой) первой таблице, начинаем искать во второй, и так далее. Если нигде ничего не нашли, получим сообщение «Не найден».

ЕСЛИОШИБКА в формулах массива

Как вы, наверное, знаете, формулы массива в Excel предназначены для выполнения нескольких вычислений внутри одной формулы. Если вы в аргументе значение функции ЕСЛИОШИБКА  укажете формулу или выражение, которое возвращает массив, она также обработает и вернет массив значений для каждой ячейки в указанном диапазоне. Пример ниже поможет пояснить это.

Допустим, у вас есть Сумма в столбце B и Цена в столбце C, и вы хотите вычислить Количество. Это можно сделать с помощью следующей формулы массива, которая делит каждую ячейку в диапазоне B2:B4 на соответствующую ячейку в диапазоне C2:C4, а затем суммирует результаты:

=СУММ(($B$2:$B$4/$C$2:$C$4))

Формула работает нормально, пока в диапазоне делителей нет нулей или пустых ячеек. Если есть хотя бы одно значение 0 или пустая строка, то возвращается ошибка: #ДЕЛ/0! Из-за одной некорректной позиции мы не можем получить итоговый результат.

Чтобы исправить эту ситуацию, просто вложите деление внутрь формулы ЕСЛИОШИБКА:

=СУММ(ЕСЛИОШИБКА($B$2:$B$4/$C$2:$C$4;0))

Что делает эта формула? Делит значение в столбце B на значение в столбце C в каждой строке (3500/100, 2000/50 и 0/0) и возвращает массив результатов {35; 40; #ДЕЛ/0!}. Функция ЕСЛИОШИБКА перехватывает все ошибки #ДЕЛ/0! и заменяет их нулями. Затем функция СУММ суммирует значения в итоговом массиве {35; 40; 0} и выводит окончательный результат (35+40=75).

ПримечаниеПомните, что ввод формулы массива должен быть завершен нажатием комбинации  Ctrl + Shift + Enter (если у вас не Office365 или Excel2021 – они понимают формулы массива без дополнительных телодвижений).

ЕСЛИОШИБКА или ЕСЛИ + ЕОШИБКА?

Теперь, когда вы знаете, как использовать функцию ЕСЛИОШИБКА в Excel, вы можете удивиться, почему некоторые люди все еще склоняются к использованию комбинации ЕСЛИ + ЕОШИБКА. Есть ли у этого старого метода преимущества по сравнению с ЕСЛИОШИБКА? 

В старые недобрые времена Excel 2003 и более ранних версий, когда ЕСЛИОШИБКА не существовало, совместное использование ЕСЛИ и ЕОШИБКА было единственным возможным способом перехвата ошибок. Это просто немного более сложный способ достижения того же результата.

Например, чтобы отловить ошибки ВПР, вы можете использовать любую из приведенных ниже формул.

В Excel 2007 — Excel 2016:

ЕСЛИОШИБКА(ВПР(  ); «Не найдено»)

Во всех версиях Excel:

ЕСЛИ(ЕОШИБКА(ВПР(…)); «Не найдено»; ВПР(…))

Обратите внимание, что в формуле ЕСЛИ ЕОШИБКА ВПР вам нужно дважды выполнить ВПР.  Чтобы лучше понять, расшифруем: если ВПР приводит к ошибке, вернуть «Не найдено», в противном случае вывести результат ВПР.

А вот простой пример формулы Excel ЕСЛИ ЕОШИБКА ВПР:

=ЕСЛИ(ЕОШИБКА(ВПР(D2; A2:B5;2;ЛОЖЬ)); «Не найдено»; ВПР(D2; A2:B5;2;ЛОЖЬ ))

ЕСЛИОШИБКА против ЕСНД

Представленная в Excel 2013, ЕСНД (IFNA в английской версии) — это еще одна функция для проверки формулы на наличие ошибок. Его синтаксис похож на синтаксис ЕСЛИОШИБКА:

ЕСНД(значение; значение_если_НД)

Чем ЕСНД отличается от ЕСЛИОШИБКА? Функция ЕСНД перехватывает только ошибки #Н, тогда как ЕСЛИОШИБКА обрабатывает все типы ошибок.

В каких ситуациях вы можете использовать ЕСНД? Когда нецелесообразно скрывать все ошибки. Например, при работе с важными данными вы можете захотеть получать предупреждения о возможных ошибках в вашем наборе данных (случайном делении на ноль и т.п.), а стандартные сообщения об ошибках Excel с символом «#» могут быть яркими визуальными индикаторами проблем.

Давайте посмотрим, как можно создать формулу, отображающую сообщение «Не найдено» вместо ошибки «Н/Д», которая появляется, когда искомое значение отсутствует в наборе данных, но при этом вы будете видеть все  другие ошибки Excel.

Предположим, вы хотите получить Количество из таблицы поиска в таблицу с результатами, как показано на рисунке ниже.  Проще всего было бы использовать ЕСЛИОШИБКА с ВПР. Таблица приобрела бы красивый вид, но при этом за надписью «Не найдено» были бы скрыты не только ошибки поиска, но и все другие ошибки. И мы не заметили бы, что в исходной таблице поиска у нас есть ошибка деления на ноль, так как не заполнена цена персиков. Поэтому более разумно использовать ЕСНД, чтобы с ее помощью обработать только ошибки поиска:

=ЕСНД(ВПР(F3; $A$3:$D$6; 4;ЛОЖЬ); «Не найдено»)

Или подойдет комбинация ЕСЛИ ЕНД для старых версий Excel:

=ЕСЛИ(ЕНД(ВПР(F3; $A$3:$D$6; 4;ЛОЖЬ));»Не найдено»; ВПР(F3; $A$3:$D$6; 4;ЛОЖЬ))

Как видите, формула ЕСНД с ВПР возвращает «Не найдено» только для товара, которого нет в таблице поиска (Сливы). Для персиков она показывает #ДЕЛ/0! что указывает на то, что наша таблица поиска содержит ошибку деления на ноль.

Рекомендации по использованию ЕСЛИОШИБКА в Excel

Итак, вы уже знаете, что функция ЕСЛИОШИБКА — это самый простой способ отлавливать ошибки в Excel и маскировать их пустыми ячейками, нулевыми значениями или собственными сообщениями. Однако это не означает, что вы должны обернуть каждую формулу в функцию обработки ошибок. 

Эти простые рекомендации могут помочь вам сохранить баланс.

  1. Не ловите ошибки без весомой на то причины.
  2. Оберните в ЕСЛИОШИБКА только ту часть формулы, где по вашему мнению могут возникнуть проблемы.
  3. Чтобы обрабатывать только определенные ошибки, используйте другую функцию обработки ошибок с меньшей областью действия:
    • ЕСНД или ЕСЛИ ЕНД для обнаружения только ошибок #H/Д.
    • ЕОШ для обнаружения всех ошибок, кроме #Н/Д.

Мы постарались рассказать, как можно использовать функцию ЕСЛИОШИБКА в Excel. Примеры перехвата и обработки ошибок могут быть полезны и для «чайников», и для более опытных пользователей. 

Также рекомендуем:

Return value 

The value you specify for error conditions.

Usage notes 

The IFERROR function is used to catch errors and return a more friendly result or message when an error is detected. When a formula returns a normal result, the IFERROR function returns that result. When a formula returns an error, IFERROR returns an alternative result. IFERROR is an elegant way to trap and manage errors. The IFERROR function is a modern alternative to the ISERROR function.

Use the IFERROR function to trap and handle errors produced by other formulas or functions. IFERROR checks for the following errors: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!.

Example #1

In the example shown, the formula in E5 copied down is:

=IFERROR(C5/D5,0)

This formula catches the #DIV/0! error that occurs when Qty is empty or zero, and replaces it with zero.

Example #2

For example, if A1 contains 10, B1 is blank, and C1 contains the formula =A1/B1, the following formula will catch the #DIV/0! error that results from dividing A1 by B1:

=IFERROR (A1/B1,"Please enter a value in B1")

As long as B1 is empty, C1 will display the message «Please enter a value in B1» if B1 is blank or zero. When a number is entered in B1, the formula will return the result of A1/B1.

Example #3

You can also use the IFERROR function to catch the #N/A error thrown by VLOOKUP when a lookup value isn’t found. The syntax looks like this:

=IFERROR(VLOOKUP(value,data,column,0),"Not found")

In this example, when VLOOKUP returns a result,  IFERROR functions that result. If VLOOKUP returns #N/A error because a lookup value isn’t found, IFERROR returns «Not Found». 

IFERROR or IFNA?

The IFERROR function is a useful function, but it is a blunt instrument since it will trap many kinds of errors. For example, if there’s a typo in a formula, Excel may return the #NAME? error, but IFERROR will suppress the error and return the alternative result. This can obscure an important problem. In many cases, it makes more sense to use the IFNA function, which only traps the #N/A error.

Other error functions

Excel provides a number of error-related functions, each with a different behavior:

  • The ISERR function returns TRUE for any error type except the #N/A error.
  • The ISERROR function returns TRUE for any error.
  • The ISNA function returns TRUE for #N/A errors only.
  • The ERROR.TYPE function returns the numeric code for a given error.
  • The IFERROR function traps errors and provides an alternative result.
  • The IFNA function traps #N/A errors and provides an alternative result.

Notes

  • If value is empty, it is evaluated as an empty string («») and not an error.
  • If value_if_error is supplied as an empty string («»), no message is displayed when an error is detected.
  • In Excel 2013+, you can use the IFNA function to trap and handle #N/A errors specifically.
Skip to content

Excel Logo

IFERROR Function in Excel

IFERROR Function in Excel

IFERROR is an Excel Logical Function to Check if a value is an Error. IFERROR used in Excel to handle if the formula is evaluated to an Error. We can handle the Error Cells and Formulas with errors like #VALUE!,#N/A, #REF!, #DIV/0!, #NUM! #NAME? and #NULL!.

In this topic:

  • Function
  • Syntax
  • Parameters
  • Usage
  • Examples
  • IfError Return Values

IFERROR Function

Excel IFError Function helps to return a value if an formula returns an Error. For example, if we enter some formula in Cell, and we assume that there is some chance of getting an Error. In this case we can use IFERROR function to return something else when the formula evaluates an error.

=IFERROR(Actual Formula, Value if the formula returns an Error)

Example:
Let us say you are accepting Total Sales at Range A1 and Units in Range B1. And You wants to calculate the Unit Price at C1. Your formula at C1=A1/B1.

  • If the user enters 2000 at Range A1 and 10 at B1, the formula C1 evaluates and returns the unit price as 200.
  • What if the user enters 2k at Range A1 and 10 at B1, the formula C1 evaluates to an Error (#VALUE!).
  • In this case, we can use IFERROR function to instruct the user to enter valid numbers.
  • You can use the formula =IFERROR(A1/B1,”Please Enter Valid Number”) to ask the user to enter valid data.

Syntax

Here is the syntax of the Excel IFERROR Function. It has two required parameters.

IFERROR(value, value_if_error)

Parameters

Excel IFERROR Function takes two parameters. Value is a formula to check for an error. And the second one is the value to be returned if the first argument evaluate an error.

value: Value is a required parameter. This is the Argument which is to be evaluated for an Error. Often, it is a formula or expression.

value_if_error: This is a required parameter. This is the value to return if the formula evaluates to an error. IFERROR returns this value if the first argument evaluates to #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? or #NULL!.

How to use IFERROR in Excel?

IFERROR Functions is used along with other Excel Functions to handle the returning error values. We can combine iferror function while using the reference functions like VLOOKUP, HLOOKUP, XLOOKUP, MATCH, INDEX. We also combine with other conditional aggregate functions like IF, COUNTIF, SUMIF, AVERAGEIF.

Using IFERROR in EXCEL Formula

Let us see how to use IFERROR Function in Excel. We can use the IFERROR function in Excel formula to find if an expression is returning an Error. You can use the IFERROR function to identify the expressions witch may return errors and handle it. IFERROR returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula.

  • IFERROR returns a specified value if a formula evaluates to an error; otherwise, it returns the result of the formula
  • We can provide a Value , a string or another Expression if the Formula evaluate to an Error
  • Often, we use IFERROR with the formulas which may return errors in some (unknown) cases or wrong data inputs. And return some text or value when the formula returns an Error.

Using IFERROR with IF Statement

We can use IFERROR with IF Statement to make conditional and logical checks. Let us see how to use iferror with if statement in Excel formula.

The following example shows how to use IFERROR with IF Statement. User enter some amount at Range B1 and the If formula calculates the Discount Price as Result.

IF Formula =IF(B1>1000,B1*0.1,B1*0.05)

IFERROR + IF Formula =IFERROR(IF(B1>1000,B1*0.1,B1*0.05),”Please Enter Valid Data”)

Excel IFERROR with IF Statement

  • IF Formula – Valid Data: Calculates and Result the when you enter valid data
  • IF Formula – Invalid Data: Calculates and Result the error (#VALUE!) when you enter invalid number.
  • IFERROR+IF Formula – Valid Data: Calculates and Result the when you enter valid data
  • IFERROR+ IF Formula – Invalid Data: If you enter invalid number, IF Function calculates and Result the error (#VALUE!), IFERROR Evaluates the error and creates the custom message (“Please Enter Valid Data”).

IFERROR Blank

IFERROR Function is used to produce a Blank string if the formula evaluates an Error. Here is the IFERROR Blank Example formula which is common use of IFERROR Function.

Excel If Error Then Blank: If there is any error in the formula then Excel returns Blank using IFERROR. We will take the simple formula to return blank when there is an Error in Excel Formula. To produce a blank string, you can pass the blank string in the second argument of the IFERROR function. Or, you can simply leave the second parameter empty.

Blank String: The following formula will result a BLANK string if the the expression evaluates an Error. Here, we are providing an Blank string character(“”) as  the second parameter of the IFERROR Function.

=IFERROR(IF(B1>1000,B1*0.1,B1*0.05),””)

Using IFERROR with BLANK String

Empty Argument:The following formula will result an Empty Cell if the the expression evaluates an Error. Here, we are not providing the second parameter of the IFERROR Function. We are just closing the function after the comma.

=IFERROR(IF(B1>1000,B1*0.1,B1*0.05),)

Using IFERROR with Empty Argument

Difference between Providing the Second Argument and Leaving Empty: Function creates a Blank String Character(“”), overwrites the default cell format when you pass the second character. If you leave empty, this will creates cell with default format (as if you entered nothing in the cell).

IFERROR VLOOKUP

IFERROR is used with the combination of VLOOKUP function. VLOOKUP  function returns an error value (#NA) if it is not found the lookup value in the lookup table array range. We can suppress these errors using IFERROR function with VLOOKUP. Otherwise, we can perform another operation if Vlookup returns an Error.

Let us see an example to understand how to use IFERROR and VLOOKUP together. VLOOKUP tries to find the lookup value (D2) in the lookup table array (A2:B11) and returns the corresponding  value in column 2. If VLOOKUP not find the value in the given range, IFERROR Returns a string (“Not found”)

=IFERROR(VLOOKUP(D2,A2:B11,2,FALSE),”Not Found”)

IFERROR VLOOKUP

IFERROR INDEX MATCH

We use INDEX and MATCH Functions to create Advanced VLOOKUP Formula. We can use IFERROR with the combination of INDEX and MATCH functions (as used in the VLOOKUP function). INDEX and MATH Lookup functions returns an error value (#NA) if the lookup value is not found the lookup range. We can use IFERROR function to produce the alternative string.

Here is a simple example to show you how to use IFERROR function along with INDEX and MATCH reference functions.  MATCH function returns the match position of the lookup value (D4) in the lookup range ($A$2:$A$11). And the INDEX function returns the value from the reference ($B$2:$B$11) from the row number returned by MATCH function. Match returns #NA error if the given lookup value is not found in the lookup range. We can use IFERROR to Returns a new string (“Not found”)

=IFERROR(INDEX($B$2:$B$11,MATCH(D4,$A$2:$A$11,0)),”Not Found”)

IFERROR INDEX MATCH

IF And IFERROR Combined

We can Combine IF and IFERROR Functions in Excel to create issue free Formulas. We can check some expression using IF Function. And trap the result using IFERROR function.

=IFERROR(IF(Sum(A1:A5)>100,”True”,”False”),”Not Valid Data in Range A1:A5″)

This formula will checks an expression using IF and returns the defined value. If it returns an error, error message will be displayed in the Cell.

IF IFERROR and VLOOKUP

We can also Combine IF, IFERROR Functions with VLOOKUP in Excel to create advanced Formulas. VLOOKUP fetch a value from table range. And the IFERROR Evaluates the VLOOKUP output. Finally, IF functions makes the decision to display the value based on the result.

Here is real-time example to understand how to use IFERROR and VLOOKUP together in the same formula.

IF IFERROR and VLOOKUP

=IF(IFERROR(VLOOKUP(C2,A1:A10,1,FALSE),””)=””,”Not in the Records”,”Present in the Records”)
  • In this formula, VLOOKUP will check for an EMP Record
  • IFERROR returns blank if no record is found
  • IF statement will display the message based on the result

Nested IFERROR

Nested IFERROR formula is helpful to fetch the values from multiple references. Following is the example of Nested IFERROR with VLOOKUP function to check for a value in two different ranges and return the corresponding column value. If the lookup values is not found in both the ranges, return custom value or a text.

Nested IFERROR

=IFERROR(VLOOKUP(G2,A2:B11,2,FALSE),IFERROR(VLOOKUP(G2,D2:E11,2,FALSE),”Not Found”))
  • VLOOKUP(G2,A2:B11,2,FALSE) : checks for a value G2 in the first range A2:B11
  • =IFERROR(VLOOKUP(G2,A2:B11,2,FALSE), : This will checks the return value and out put the corresponding value. If it is not found in the given range (A2:B11). IFERROR process the second part of the formula (i.e; IFERROR(VLOOKUP(G2,D2:E11,2,FALSE),”Not Found”))
  • VLOOKUP(G2,D2:E11,2,FALSE):checks for a value G2 in the first range D2:E11
  • IFERROR(VLOOKUP(G2,D2:E11,2,FALSE),”Not Found”) : This will checks the return value of 2nd VLOOKUP and out put the corresponding value. If it is not found in the given range (D2:E11). IFERROR process the second argument of the function and returns the string “Not Found”

Nested IFERROR and IF

We can add the IF Function with Nested IFERROR function to return the value based on the result. We can use the above formula and display the value in the cell using IF Function.

=IF(IFERROR(VLOOKUP(G2,A2:B11,2,FALSE),IFERROR(VLOOKUP(G2,D2:E11,2,FALSE),”Not Found”))=”Not Found”,”Need to Add”,”Exist in the Table”)

Here, we have added Function to display a message as “Need to Add”,”Exist in the Table” based on the Nested IfError and If function.

Excel IFERROR Else

We can make use of this formula to check if an expression evaluates an Error then display some value. Else display another Value.

=IF(IFERROR(VLOOKUP(G2,D2:E11,2,FALSE),”Not Found”)=”Not Found”,”IfError: Display some thing IFERROR”,”Else: Display something Else”)

Comparing IFERROR with Other Function

We have many functions to handle the Errors in Excel. Let us see the different Error trapping Functions in Excel and how they are different from IFERROR function.

ISERROR vs IFERROR

ISERROR Function is useful to check if an expression evaluates to an error or not. IFERROR Helps to replace that error with some value.

IF ISERROR vs IFERROR

If ISERROR combination is useful when you wants to check an expression and execute Expression One when it is True and Expression Two when it is False.

IFNA vs IFERROR

IFNA Function is used when you wants to replace only if an expression returns #NA Error. Where as IFERROR is helps to tackle with any type of errors listed above.

ISNA vs IFERROR

ISNA Function is used to check if an expression is Returning a #NA type Error. IFERROR is used to replace an error if the expression evaluates to any error listed above.

IF and IFERROR

IF Function is used to check a condition and executes the first expression when it is True and the second expression when it is False. But IFERROR is used when you want to replace an error only if the expression evaluates to any error listed above.

IFERROR vs IFNA for VLOOKUP

VlookUp returns #NA type error if the lookup value is not found in the table array. You can use IFNA function to deal with this situation.  But, in some cases the VlookUp return other type of Errors like  #Name (based on the input expressions). You can use IfError to deal with any type of Errors as mention above.

How Does IFERROR Work

IFERROR Works as error handling formula in Excel. Following is the process flow chart of IFERROR Function with clear instructions.

How Does IFERROR Work?

  • It required two arguments to process the function
  • It will process the first argument and validate the evaluated value
  • If the first argument returns the value which is not an error (#VALUE!,#N/A, #REF!, #DIV/0!, #NUM! #NAME? and #NULL!.), then it returns the result output of the first argument
  • If the first argument returns an error, then it will process the second argument of the IFERROR function and returns the output

Here are the simple examples to understand how does IFERROR function Works. The first example returns the actual value, and the second example returns the IFERROR function value.

Example 1: We have provided the First argument as 25+75, tried to add number and number. It returns the values as 100. So, the IFERROR function Returns the first argument.

Formula

=IFERROR(25+75 ,”You can not add a number and Text”)

Output:100

Example 2: We have provided the First argument as 25+”Some Text”, tried to add number and string. It returns an Error. So, the IFERROR function Returns the second argument.

Formula

=IFERROR(25+”Some Text” ,”You can not add a number and Text”)

Output:”You can not add a number and Text”

IFERROR Examples

1. Display Message to User

Here is a simple example to explain the IFERROR Function. The following Formula check the first expression and returns the given string as it evaluates an Error.

Formula:

=IFERROR(5/0,”Please Enter Valid Number”)

Returns: Please Enter Valid Number

We can see the first argument of the formula (5/0) evaluates #DIV/0! Error. And IFERROR function trap this error and returns the second argument.

2. IFERROR Then Return 0

Let us say we are performing a calculation based on the result. If there is any Error in the Formula, we want the Excel to return Zero. In this case we can use iferror and simply return 0 if the formula evaluates to an Error.

Formula:

Returns: 0 (if the formula evaluates to an error)

3. IFERROR, Make the Cell Blank

Excel sheet do not look good if there are many Error Cells . We can use the IFERROR formula to return a blank if the formula returns errors.

Formula:

Returns: “” (if the formula evaluates to an error)

4. Check if a value found in List of values

IFEEROR helps to determine if an item found in the list of items, range or Array. The following Example checks if value find in a range of values.

IFERROR to Check if a value found in List of values

=IFERROR(MATCH(“Value to Find”,C1:C15,0),”Not found in the given range”)

5. If Error then Evaluate another Formula

The following formula checks for a value in Range A1:A10. If it is not found in the A1:B10, IFERROR helps to check in another Range(D1:E10). Here is a simple example on IFERROR to return a value from one of the Ranges.

If Error then Evaluate another Formula

=IFERROR(V(“Value to Find”,C1:C15,0),”Not found in the given range”)

IFERROR Return Values

Excel IFERROR can be used to return values based on our requirement. We can return a string, a number, or evaluate a formula. Let us see the most widely returning Values of IFERROR Function.

IFERROR Return Values

Return Value Formula Description
BLANK =IFERROR(IF(B2>1000,B2*0.1,B2*0.05),””) Return BLANK

IfError Then BLANK

NULL =IFERROR(IF(B3>1000,B3*0.1,B3*0.05),””) Return NULL

IfError Then NULL

EMPTY =IFERROR(IF(B4>1000,B4*0.1,B4*0.05),””) Return EMPTY

IfError Then EMPTY

Empty Cell =IFERROR(IF(B5>1000,B5*0.1,B5*0.05),””) Return Empty Cell

IfError Then Empty Cell

Nothing =IFERROR(IF(B6>1000,B6*0.1,B6*0.05),””) Return Nothing

IfError Then Nothing

No Value =IFERROR(IF(B7>1000,B7*0.1,B7*0.05),”No Value Found”) Return No Value

IfError Then No Value

Original Value =IFERROR(IF(B8>1000,B8*0.1,B8*0.05),B8) Return Original Value

IfError Then Original Value

TRUE =IFERROR(IF(B9>1000,B9*0.1,B9*0.05),TRUE) Return TRUE

IfError Then TRUE

FALSE =IFERROR(IF(B10>1000,B10*0.1,B10*0.05),FALSE) Return FALSE

IfError Then FALSE

0 =IFERROR(IF(B11>1000,B11*0.1,B11*0.05),0) Return 0

IfError Then 0

Blank Instead of 0 =IFERROR(IF(B12>1000,B12*0.1,B12*0.05),””) Return Blank Instead of 0

IfError Then Blank Instead of 0

Blank Text Instead of 0 =IFERROR(IF(B13>1000,B13*0.1,B13*0.05),”BLANK”) Return Blank Text Instead of 0

IfError Then Blank Text Instead of 0

Null Text =IFERROR(IF(B14>1000,B14*0.1,B14*0.05),”NULL”) Return Null Text

IfError Then Null Text

EMPTY Text =IFERROR(IF(B15>1000,B15*0.1,B15*0.05),”EMPTY”) Return EMPTY Text

IfError Then EMPTY Text

ERROR Text =IFERROR(IF(B16>1000,B16*0.1,B16*0.05),”ERROR”) Return ERROR Text

IfError Then ERROR Text

N/A Text =IFERROR(IF(B17>1000,B17*0.1,B17*0.05),”N/A”) Return N/A Text

IfError Then N/A Text

Hyphen (-) =IFERROR(IF(B18>1000,B18*0.1,B18*0.05),”-“) Return Hyphen (-)

IfError Then Hyphen (-)

Question Mark (?) =IFERROR(IF(B19>1000,B19*0.1,B19*0.05),”?”) Return Question Mark (?)

IfError Then Question Mark (?)

Zero =IFERROR(IF(B20>1000,B20*0.1,B20*0.05),”Zero”) Return Zero

IfError Then Zero

Text =IFERROR(IF(B21>1000,B21*0.1,B21*0.05),”Your Text”) Return Text

IfError Then Text

Error =IFERROR(IF(B22>1000,B22*0.1,B22*0.05),”Error”) Return Error

IfError Then Error

NA =IFERROR(IF(B23>1000,B23*0.1,B23*0.05),NA()) Return NA

IfError Then NA

Space =IFERROR(IF(B24>1000,B24*0.1,B24*0.05),” “) Return Space

IfError Then Space

Value =IFERROR(IF(B25>1000,B25*0.1,B25*0.05),”1000″) Return Value

IfError Then Value

Cell Value =IFERROR(IF(B26>1000,B26*0.1,B26*0.05),B26) Return Cell Value

IfError Then Cell Value

Another Cell =IFERROR(IF(B27>1000,B27*0.1,B27*0.05),A27) Return Another Cell

IfError Then Another Cell

Number =IFERROR(IF(B28>1000,B28*0.1,B28*0.05),”25″) Return Number

IfError Then Number

Row =IFERROR(IF(B29>1000,B29*0.1,B29*0.05),ROW()) Return Row

IfError Then Row

Column =IFERROR(IF(B30>1000,B30*0.1,B30*0.05),COLUMN()) Return Column

IfError Then Column

Date =IFERROR(IF(B31>1000,B31*0.1,B31*0.05),TODAY()) Return Date

IfError Then Date

Error =IFERROR(IF(B32>1000,B32*0.1,B32*0.05),CELL(“type”)) Return Error

IfError Then Error

Return 0:

We can use IFERROR to return 0 if the formula evaluates an Error. This is very helpful while processing the numerical data. If you have the formulas witch are resulting an Error while calculation, it will effect the all other calculations. If you return 0 using IFERROR, you can avoid those issues with your spreadsheet.

Formula:

Return Blank:

If you are dealing with string data, you can return blank instead of 0. It makes your sheet more cleaner and issue free. Following is the formula to Return Blank if there are any errors in Formula.

Formula:

Return Null:

You can make use of IFERROR and return Null string to avoid conflicts with other formula. Here is

Best Practices

Please remember the following best practices to be followed while using IFERROR in Excel Formula.

  • IFERROR is very important and useful formula to create an issue free spreadsheet worksheet. Use this formula when there is a chance of evaluation error.
  • Try to use smaller portion of the formula, instead of the entire formula.
  • Do not leave the arguments empty. IFERROR treats the empty arguments as an Empty String (“”).
  • Try to Avoid using IF  + ISERROR , instead use IFERROR Function
  • Use ISNA function to check if the expression evaluates only #NA Error, otherwise use IFERROR to catch all Errors
  • ISERR function to check if the expression evaluates errors except #NA Error

Share This Story, Choose Your Platform!

© Copyright 2012 – 2020 | Excelx.com | All Rights Reserved

Page load link

IFERROR function provides a great way to handle errors in Excel formulas. Excel IFERROR function returns a custom result (which can be a text, cell reference, or another formula) when the expression enclosed inside it returns an error.

IFERROR helps you catch and address problems with your formulas so you can have clean and orderly spreadsheets. Alternatively, you can use nested IF statements to handle formula errors but nested IF statements are quite challenging to read and reduce the spreadsheets’ maintainability. This is the reason IFERROR function is preferred for handling errors.

Excel IFERROR Function

Now, let’s see the syntax of the IFERROR function.

Syntax

The syntax of an IFERROR function is as follows:

=IFERROR(value, value_if_error)

'value' – This a required parameter that tells the function what to check for errors. It may be an expression, formula, or cell reference.
'value_if_error' This is also a required parameter that represents the value returned from the function in case of an error. It may be an empty string, a cell reference blank cell, a line of text, a numeric value, or another formula or expression.

Important Characteristics of the IFERROR function

  • The IFERROR function deals with all types of errors. This includes #N/A, #DIV/0, #NAME, #NUM!, #NULL, #VALUE, and #REF.
  • IFERROR function is only available in Excel 2007 or higher versions.
  • To catch errors in earlier versions of Excel (2003 and below), you’ll have to use the ISERROR function combined with the IF function.
  • An empty 'value' parameter will result in an empty string («») instead of an error.
  • An empty 'value_if_error' parameter will also be evaluated as an empty string («»), and hence, no message will be displayed if an error is found.
  • IFERROR function can be used with array formulas. If an array formula is passed as a value parameter to the IFERROR function, the function returns an array of results for every cell in the specified range.

Types of Formula Errors in Excel

Before going any further, let’s see what all errors can excel formulas throw.

#N/A Error

The #N/A Error stands for Not Available Error. It is thrown when something that you were looking for is not found. Despite its obvious unpleasantness, it is a «useful» error because it tells you something important is missing in your formula.

It may also be triggered by an extra space between characters, wrong spellings, or inconclusive lookup tables. The functions most likely to give you a #N/A error include MATCH, LOOKUP, VLOOKUP, and HLOOKUP.

#DIV/0! Error

The #DIV/0 Error is another type of error often found in Excel. You will find this error every time a number is divided by zero (0) or an empty cell reference. It occurs when you attempt to perform calculations like 10/0.

In many situations, the #DIV/0 error is unavoidable. This is especially true if you prefer to assign formulas before populating your excel worksheets with data. In such situations, you probably don’t want to see an error message at all, and this can be achieved by the IFERROR function.

#VALUE! Error

The #VALUE Error is encountered when you use an incorrect datatype parameter in a formula. It’s Excel’s way of saying there is something wrong with the way you’ve typed your formula. Or that it has identified a problem with the cells you’re attempting to reference.

This error-type is very broad, and it may be hard to determine its exact cause.

Pro tip – While building a formula, you must make sure that the datatypes of all the values involved are compatible. Otherwise, you will encounter this error.

#REF! Error

The #REF! Error, also known as the reference error, is encountered when a reference in a formula has expired. Most commonly, this is the case when a formula points to a cell reference that does not exist (for example, you deleted a row or a column that was being referenced by a formula).

#NAME ERROR

This error commonly occurs as a result of misspelled functions. Unlike word, Excel demands you to type in the exact name of the function you are going to use.

If, for example, you wanted to type HLOOKUP but type HLOKUP instead, you’ll get a #Name error. It means part of your formula needs fixing. Most times, you can avoid it by using the formula wizard.

#NUM ERROR

The #NUM Error occurs when the value you are trying to calculate is beyond Excel’s limits. There are various conditions in which the #NUM Error can occur.

Another scenario that can return a #Num error is when you try to provide a non-numeric value (or any invalid value) to a function argument that only supports numeric values. For example – trying to calculate the square root of a negative number SQRT(-10) will return a #NUM error.

Recommended Reading: Excel ERROR.TYPE Function

Examples of IFERROR Function

Now let’s try to understand the IFERROR function with some examples.

Example 1 – Handling #NA errors in VLOOKUP Function

Let’s assume we have a list of students along with their registration numbers. We try to find the registration number for a student with the name «Glen» out of that list.

IFERROR_EXAMPLE_01

For this, we will be writing a VLOOKUP function as –

=VLOOKUP("Glen",A1:B11,2,0)

But since ‘Glen’ doesn’t exist in the student list, so VLOOKUP gives a #N/A error, as shown in the above image.

Now, to replace #N/A with a more meaningful text like «Student Not Found!» we’ll have to use the IFERROR function.

To use the IFERROR function in this case, we will need to use the VLOOKUP function as the first parameter to the IFERROR and text «Student Not Found!» as the second parameter.

IFERROR_WITH_VLOOKUP_NA_ERROR_02

The formula should look like this:

=IFERROR(VLOOKUP("Glen",A1:B11,2,0),"Student Not Found!")

Example 2 – Handling #VALUE! Or Invalid Parameter Errors

Let’s assume we have a task planner spreadsheet that calculates the days between two dates using the NETWORKDAYS function as shown.

IFERROR_WITH_VALUE_ERROR_03

As shown in the image, Task – 4 is an ongoing task and does not have an enddate, and hence the enddate is marked as ‘NA’. But while calculating days, NETWORKDAYS displays a #VALUE! error.

To fix this error, we can wrap our formula inside an IFERROR function and display a suitable message instead of an error.

IFERROR_WITH_VALUE_ERROR_04

So, our formula would be:

=IFERROR(NETWORKDAYS(B6,C6), "Ongoing Task")

Example 3 – Handling #DIV/0! Or Divide By Zero Errors

Now let’s suppose we have a weekly sales stats report of a gift store. The report represents total orders generated by each sales manager along with the total sales value.

IFERROR_WITH_DIVIDE_BY_ZERO_ERROR_05

In the report, we want to calculate the ‘Average Order Value’ generated by each sales manager. For calculating the ‘average order value’, we can use a formula – Total Sales Value / Total Orders.

An excel formula can represent this as:

=C3/B3

As we can see, the report sales manager ‘Donald Perkins’ has made zero sales for the week, and hence this formula results in an error.

The #DIV/0 error really stands out, and it would be embarrassing to have such errors appear in your excel report.

We can use the IFERROR function in such a case and pass our existing formula as the first argument to the function, and the second argument would be a suitable message or an empty string.

IFERROR_WITH_DIVIDE_BY_ZERO_ERROR_06

So, the final formula would be:

=IFERROR(C3/B3,"")

This will show an empty string in case an error occurs in the inner formula.

Example 4 – Handling Errors In Array Formulas Using IFERROR Function

Array formulas in excel allow you to perform powerful calculations on one or more value sets. Let’s take example 3 and use an array formula to populate ‘Average Order Value’ against each row.

To do this, we will have an array formula that divides each value in the cell range C3:C7 by the appropriate cell within the range B3:B7, and then press ‘control + shift + enter’ keys.

Adding Array formula 071

The formula would be:

{=C3:C7/B3:B7}

And as we can see with the array formula, we are again getting a ‘# DIV/0’ error for the D6 cell.

To fix this, we can use the IFERROR function. IFERROR function, when used with an array formula, returns an array of values for each cell in the range provided.

So our final formula would be:

{=IFERROR(C3:C7/B3:B7,"")}

IFERROR_WITH_ARRAY_FORMULA_08

This formula divides each value in the range C3:C7 with an appropriate value from range B3:B7, and then returns an array of results. The IFERROR function captures all the #DIV/0 errors and replaces them with empty strings.

Example 5 – Importance of IFERROR Function in Excel Calculators and Templates

Let’s consider you are building a Monthly Loan Repayment Calculator in Excel, as shown below.

IFERROR_WITH_Templates_09

This template works nicely with all the data, but if the user forgets to enter any mandatory value, the formula returns an error.

IFERROR_WITH_Templates_With_Errros_10

Errors like this stand out, and it is quite awkward to have such errors in your excel templates.

IFERROR_WITH_Templates_With_IFError_11

To fix this, you could wrap your formulas in an IFERORR function and display a more meaningful message to the end-user. For example:

=IFERROR(PMT((B4%/12),B5,B3,0), "Mandatory fields should not be blank!")

IFERROR vs. ISERROR

The ISERROR function is an error-handling alternative for those who are working with Excel 2003 or lower versions. Since the IFERROR function came out with Excel 2007 so before that, for handling formula errors, we used ISERROR Function with Excel IF Statement.

ISERROR function accepts a single argument, which can be an expression, formula, or cell reference. If the supplied argument results in an error, it returns TRUE otherwise, it returns FALSE.

The errors that the ISERROR function checks are as follows:

  • #N/A Error
  • #VALUE Error
  • #REF Error
  • #DIV/0! Error
  • #NUM! Error
  • #NAME? Error
  • #NULL! Error

ISERROR Function differs from the IFERROR in the sense that – the ISERROR function returns a Boolean value if there is an error or not. On the other hand, the IFERROR function allows the user to put up a custom and meaningful value or string instead of the error.

Syntax of ISERROR Function

The syntax of the ISERROR function is as follows:

=ISERROR(value)

'value' – This a required parameter that tells the function what to check for errors. It may be an expression, formula, or cell reference.

ISERROR Function Example

Let’s again revisit Example 1 and try to handle the error using the ISERROR function. So, we have a list of students along with their registration numbers. We try to find the registration number for a student with the name «Glen» out of that list.

IFERROR_EXAMPLE_01

For this, we will be writing a VLOOKUP function as –

=VLOOKUP("Glen",A1:B11,2,0)

But since ‘Glen’ doesn’t exist in the student list, so VLOOKUP gives a #N/A error, as shown in the above image. In the previous example, we used the IFERROR function to replace the #N/A error with a more meaningful text like «Student Not Found!»

But here, let’s try to use the ISERROR function along with the IF function to achieve the same result. So, the formula would be:

ISERROR_WITH_IF_12

=IF(ISERROR(VLOOKUP("Glen",A2:B11,2,0)),"Student Not Found!", VLOOKUP("Glen",A2:B11,2,0))

NOTE: IFERROR function automatically assumes you will always want the result if your calculations don’t have any errors. ISERROR, on the other hand, gives you either «TRUE» or a «FALSE», and when combined with the IF function, you can have more control over the result in both outcomes.

Recommended Reading: Excel ISERR Function – How to Use

IFERROR vs. IFNA

IFNA Function is another error handling function in Excel. However, the IFNA function only catches #N/A errors and allows us to display more meaningful error messages in case of a #N/A error.

Syntax of IFNA Function

The syntax of IFNA Function is as follows:

=IFNA(value, value_if_na)

'value' – the expression, formula, or reference excel should be checked for errors.

'value_if_na' – represents the value returned from the function in case of an #N/A error. It may be an empty string, a cell reference blank cell, a line of text, a numeric value, or another formula or expression.

IFNA works best with lookup functions such as VLOOKUP, MATCH, HLOOKUP, and LOOKUP.

IFNA Function Example

Let’s try to understand the IFNA function again with Example 1.

So, we have a list of students, and we are trying to fetch details for a student named «Glen» using a VLOOKUP function. However, since «Glen» is not a part of the list, so the VLOOKUP function throws a #N/A error.

IFNA_EXAMPLE_13

To handle such errors, we make use of the IFNA function as –

=IFNA(VLOOKUP("Glen",A2:B11,2,0),"Student Not Found!")

This formula results in a more meaningful text, «Student Not Found!» if no student with the name «Glen» is found in the given range.

Please Note: IFNA Function only handles #N/A errors and does not catch or handle any other errors, as shown in the below screenshot.

IFNA_EXAMPLE_14

In the above image, we can clearly see that the IFNA function misses the #DIV/0! Error and returns the error as it is.

Recommended Reading: ISNA Function In Excel

So this was all about the IFERROR function in excel. We will get back to you with another amazing function. Stay Tuned!

When you work with data and formulas in Excel, you’re bound to encounter errors.

To handle errors, Excel has provided a useful function – the IFERROR function.

Before we get into the mechanics of using the IFERROR function in Excel, let’s first go through the different kinds of errors you can encounter when working with formulas.

Types of Errors in Excel

Knowing the errors in Excel will better equip you to identify the possible reason and the best way to handle these.

Below are the types of errors you might find in Excel.

#N/A Error

This is called the ‘Value Not Available’ error.

You will see this when you use a lookup formula and it can’t find the value (hence Not Available).

Below is an example where I use the VLOOKUP formula to find the price of an item, but it returns an error when it can’t find that item in the table array.

Excel IFERROR Function - Not Available Error

#DIV/0! Error

You’re likely to see this error when a number is divided by 0.

This is called the division error. In the below example, it gives a #DIV/0! error as the quantity value (the divisor in the formula) is 0.

Division Error in Excel

#VALUE! Error

The value error occurs when you use an incorrect data type in a formula.

For example, in the below example, when I try to add cells that have numbers and character A, it gives the value error.

This happens as you can only add numeric values, but instead, I tried adding a number with a text character.

Value Error in Excel

#REF! Error

This is called the reference error and you will see this when the reference in the formula is no longer valid. This could be the case when the formula refers to a cell reference and that cell reference does not exist (happens when you delete a row/column or worksheet that was referred to in the formula).

In the below example, while the original formula was =A2/B2, when I deleted Column B, all the references to it became #REF! and it also gave the #REF! error as the result of the formula.

Reference Error in Excel

#NAME ERROR

This error is likely to a result of a misspelled function.

For example, if instead of VLOOKUP, you by mistake use VLOKUP, it will give a name error.

NAME Error in Excel

#NUM ERROR

Num error can occur if you try and calculate a very large value in Excel. For example, =187^549 will return a number error.

NUM Error in Excel

Another situation where you can get the NUM error is when you give a non-valid number argument to a formula. For example, if you’re calculating the Square Root if a number and you give a negative number as the argument, it will return a number error.

For example, in the case of Square Root function, if you give a negative number as the argument, it will return a number error (as shown below).

While I have shown only a couple of examples here, there can be many other reasons that can lead to errors in Excel. When you get errors in Excel, you can’t just leave it there. If the data is further used in calculations, you need to make sure the errors are handled the right way.

Excel IFERROR function is a great way to handle all types of errors in Excel.

Excel IFERROR Function – An Overview

Using the IFERROR function, you can specify what you want the formula to return instead of the error. If the formula does not return an error, then its own result is returned.

EXCEL IFERROR FUNCTION - What it does!

IFERROR Function Syntax

=IFERROR(value, value_if_error)

Input Arguments

  • value – this is the argument that is checked for the error. In most cases, it is either a formula or a cell reference.
  • value_if_error – this is the value that is returned if there is an error. The following error types evaluated: #N/A, #REF!, #DIV/0!, #VALUE!, #NUM!, #NAME?, and #NULL!.

Additional Notes:

  • If you use “” as the value_if_error argument, the cell displays nothing in case of an error.
  • If the value or value_if_error argument refers to an empty cell, it is treated as an empty string value by the Excel IFERROR function.
  • If the value argument is an array formula, IFERROR will return an array of results for each item in the range specified in value.

Excel IFERROR Function – Examples

Here are three examples of using IFERROR function in Excel.

Example 1 – Return Blank Cell Instead of Error

If you have functions that may return an error, you can wrap it within the IFERROR function and specify blank as the value to return in case of an error.

In the example shown below, the result in D4 is the #DIV/0! error as the divisor is 0.

Using Excel IFERROR function to remove error values

In this case, you can use the following formula to return blank instead of the ugly DIV error.

=IFERROR(A1/A2,””)

Returning a blank using the IFERROR function in Excel

This IFERROR function would check whether the calculation leads to an error. If it does, it simply returns a blank as specified in the formula.

Here, you can also specify any other string or formula to display instead of the blank.

For example, the below formula would return the text “Error”, instead of the blank cell.

=IFERROR(A1/A2,”Error”)

Using Excel Iferror function to return text in a cell

Note: If you are using Excel 2003 or a prior version, you will not find the IFERROR function in it. In such cases, you need to use the combination of IF function and ISERROR function.

Example 2 – Return ‘Not Found’ when VLOOKUP Can’t Find a Value

When you use the Excel VLOOKUP Function, and it can’t find the lookup value in the specified range, it would return the #N/A error.

For example, below is a data set of student names and their marks. I have used the VLOOKUP function to fetch the marks of three students (in D2, D3, and D4).

Using iferror functiont to handle NA error in Excel

While the VLOOKUP formula in the above example finds the names of first two students, it can’t find Josh’s name on the list and hence it returns the #N/A error.

Here, we can use the IFERROR function to return a blank or some meaningful text instead of the error.

Below is the formula that will return ‘Not Found’ instead of the error.

=IFERROR(VLOOKUP(D2,$A$2:$B$12,2,0),”Not Found”)

excel-iferror-function-vlookup-not-found

Note that you can also use IFNA instead of IFERROR with VLOOKUP. While IFERROR would treat all kinds of error values, IFNA would only work on the #N/A errors and wouldn’t work with other errors.

Example 3 – Return 0 in case of an Error

If you don’t specify the value to return by IFERROR in the case of an error, it would automatically return 0.

For example, if I divide 100 with 0 as shown below, it would return an error.

excel-iferror-function-error-when-div-by-0

However, if I use the below IFERROR function, it would return a 0 instead. Note that you still need to use a comma after the first argument.

excel-iferror-function-comma

Example 4 – Using Nested IFERROR with VLOOKUP

Sometimes when using VLOOKUP, you may have to look through the fragmented table of arrays. For example, suppose you have the sales transaction records in 2 separate worksheets and you want to look-up an item number and see it’s value.

Doing this requires using nested IFERROR with VLOOKUP.

Suppose you have a dataset as shown below:

Nested IFERROR with VLOOKUP dataset

In this case, to find the score for Grace, you need to use the below nested IFERROR formula:

=IFERROR(VLOOKUP(G3,$A$2:$B$5,2,0),IFERROR(VLOOKUP(G3,$D$2:$E$5,2,0),"Not Found"))

This kind of formula nesting ensure that you get the value from either of the table and any error returned is handled.

Note that in case the tables are on the same worksheet, however, in a real-life example, it likely to be on different worksheets.

Excel IFERROR Function – VIDEO

Related Excel Functions:

  • Excel AND Function.
  • Excel OR Function.
  • Excel NOT Function.
  • Excel IF Function.
  • Excel IFS Function.
  • Excel FALSE Function.
  • Excel TRUE Function.

You May Also Like the Following Excel Tutorials:

  • Use IFERROR with VLOOKUP to Get Rid of #N/A Errors.
  • Identify Errors Using Excel Formula Debugging.

What is IFERROR Function in Excel?

The IFERROR function in Excel checks a formula (or a cell) for errors and returns a specified value in place of the error. This returned value can be a text message, an empty string, a logical value, a number, etc. The errors handled by the function include “#N/A,” “#DIV/0!,” “#NAME?,” and so on.

For example, cells A1, A2, and A3 contain the numbers 24, 35, and 78 respectively. We perform the following tasks in the given sequence:

  1. To find the minimum number among the listed ones, we enter the formula “=MN(A1:A3)” in cell A4. It returns the “#NAME?” error because the correct function is MIN.
  2. To return a custom message, we enter the formula “=IFERROR(MN(A1:A3),”incorrect function name”)” in cell A4. It returns the text “incorrect function name” (without the double quotation marks).

In this way, the IFERROR excel function replaces the error message (#NAME?) with a customized text string (incorrect function name).

In Excel, errors are displayed on account of multiple reasons. The IFERROR function detects and deals with these errors the way the user wants.

The purpose of using the IFERROR function is to return a customized and specified result in case a formula evaluates to an error. However, if no error is detected, the function returns the output of the formula.

The IFERROR function is categorized under the Logical functions of Excel.

Table of contents
  • What is IFERROR Function in Excel?
  • Syntax
    • How to Use IFERROR Excel?
      • #1–“#N/A” Error
      • #2–“#DIV/0!” Error
      • #3–“#NAME?” Error
      • #4–“#NULL!” Error
      • #5–“#NUM!” Error
      • #6–“#REF!” Error
      • #7–“#VALUE!” Error
    • Frequently Asked Questions
    • Recommended Articles

Syntax

The syntax of the IFERROR excel function is shown in the following image:

IFERROR Function Formula

The function accepts the following arguments:

  • Value: This is the value to be checked for errors. It can be a cell reference, formula, value or expression.
  • Value_if_error: This is the output returned in case an error is found. It can be a text string, blank cell, number, logical value, and so on.

Both the preceding arguments are mandatory.

How to Use IFERROR Excel?

Let us go through some examples to understand how the IFERROR function handles the Excel errorsErrors in excel are common and often occur at times of applying formulas. The list of nine most common excel errors are — #DIV/0, #N/A, #NAME?, #NULL!, #NUM!, #REF!, #VALUE!, #####, Circular Reference.read more. Every example covers one Excel error.

You can download this IFERROR Function Excel Template here – IFERROR Function Excel Template

#1–“#N/A” Error

The following table shows the names of some employees segregated in two columns titled “list of emp A” and “list of emp B.” Every name is written as “name” followed by a number. Some names are common to both the columns, while some are present in just one column.

We want to create an excel listA list can be created in Excel to define a list of items/values as predefined values. It may be created using the Data Validation tool so that users may select from a list rather than entering their own values.read more that separates the common names (present in both the columns) from those absent in the first column (list of emp A). Use the following functions:

  • The VLOOKUPThe VLOOKUP excel function searches for a particular value and returns a corresponding match based on a unique identifier. A unique identifier is uniquely associated with all the records of the database. For instance, employee ID, student roll number, customer contact number, seller email address, etc., are unique identifiers.
    read more
    function of Excel must look up values in the first column (list of emp A).
  • The IFERROR function of Excel must return the text string “name not in list A” for all “#N/A” errors.

IFERROR Function Example

The steps to apply the VLOOKUP and IFERROR functions (with reference to the current example) are listed as follows:

Step 1: Enter the following VLOOKUP formula in cell C2.

“=VLOOKUP(B2,$A:$A,1,0)”

Press the “Enter” key. Drag the formula downwards till the cell C18. The output of the VLOOKUP formula is shown in column C of the following image.

The VLOOKUP formula looks for a name of column B in column A. It returns the “#N/A” error (in column C) for the names that are absent in column A. Such names could not be found in column A as they are present only in column B.

IFERROR Function Example 1

Step 2: Replace the “#N/A” errors (shown in column C of the preceding image) with the text string “name not in list A.” For this, enter the following formula in cell C2.

“=IFERROR(VLOOKUP(B2,$A:$A,1,0),”Name not in list A”)”

Press the “Enter” key. Drag the IFERROR formula till cell C18.

For the ease of understanding, we have displayed the formulas of column C in the succeeding image. Some cells of column C are shown in green. These are the ones that had returned the “#N/A” error in the preceding step (step 1).

The formula “VLOOKUP(B2,$A:$A,1,0)” becomes the first argument and the string “name not in list A” becomes the second argument of the IFERROR function.

The IFERROR function checks the first argument for an error. If the VLOOKUP formula evaluates to an error, the second argument of the IFERROR function is returned. It has already been stated that the VLOOKUP formula evaluates to an error if the lookup value is not found in column A.

IFERROR Function Example 3

Step 3: The output of the IFERROR formula appears in column C, as shown in the succeeding image.

The IFERROR function returns the name if the VLOOKUP formula does not evaluate to an error. However, if the VLOOKUP formula does evaluate to an error, the IFERROR function returns the string “name not in list A.”

In this way, all the “#N/A” errors have been replaced by the text string “name not in list A.” This string implies that the particular name is not in list A (column A).

Hence, “name 20,” “name 35,” “name 21,” “name 31,” and “name 32” are present in column B but not in column A. The names common to both the columns (shown without color) have been separated (in column C) from those absent in column A (shown in green).

#2–“#DIV/0!” Error

The following table shows some amounts (in $) in the first column titled “amount.” We want to distribute every amount equally among the corresponding number of people mentioned in the second column named “to divide amongst.”

Use the following formulas or functions:

  • The division formula must divide the amounts among the stated number of people.
  • The IFERROR function must return the text string “no of person < 1” for all “#DIV/0!” errors.

IFERROR Function Example 4

The steps to apply the division formula and the IFERROR function are listed as follows:

Step 1: Enter the following division formula in cell C2.

“=amount/number of people” or “A2/B2”

Press the “Enter” key. Drag the formula downwards till cell C6. The output of the division formula is shown in column C of the following image.

Cell C4 shows the “#DIV/0!” error because the number of people (in cell B4), i.e., the denominator is zero.

Note: In Excel, any number divided by zero returns the “#DIV/0!” error.

IFERROR Function Example 5

Step 2: To replace the “#DIV/0!” error with the text string “no of person < 1,” enter the following formula in cell C2.

“=IFERROR((A2/B2),”No of Person < 1″)”

Press the “Enter” key. Drag the formula till cell C6. The output appears in column C, as shown in the following image.

In cases where the argument “A2/B2” does not evaluate to an error, the IFERROR formula returns the amount (in column C). Wherever the first argument (A2/B2) evaluates to an error, the text string “no of person < 1” is returned. This text string (in cell C4) implies that the number of persons among which $6,000 is to be divided is less than 1.

Hence, the amounts listed in column A have been divided among the number of people stated in column B. The amount received by each person is stated in column C.

IFERROR Function Example 6

#3–“#NAME?” Error

The following list shows some numbers to be added. Use the following functions:

  • The SUM function in ExcelThe SUM function in excel adds the numerical values in a range of cells. Being categorized under the Math and Trigonometry function, it is entered by typing “=SUM” followed by the values to be summed. The values supplied to the function can be numbers, cell references or ranges.read more must sum the given numbers.
  • The IFERROR function of Excel must return the text string “typed wrong formula” for all “#NAME?” errors.

IFERROR Function Example 7

The steps to apply the SUM and the IFERROR function are listed as follows:

Step 1: Enter the following formula in cell C2.

“=SU(A2:A9)”

The same is shown in the succeeding image.

Press the “Enter” key. The “#NAME?” error appears in cell C2. This is because we have mistakenly entered the function name as “SU” instead of “SUM.”

IFERROR Function Example 8

Step 2: To replace the “#NAME?” error with the text string “typed wrong formula,” enter the following formula in cell C2.

“=IFERROR(SU(A2:A9),”Typed Wrong Formula”)”

Press the “Enter” key. The formula is shown in the following image.

IFERROR Function Example 9

Step 3: The output appears in cell C2 of the following image. Hence, the IFERROR function has returned the text string “typed wrong formula” in cell C2. This string implies that the name of the function (SUM) has been typed incorrectly.

The given text string is returned because there is an error in the first argument [SU(A2:A9)] of the IFERROR function. Had we entered the correct function name (SUM), the output of the IFERROR formula (in cell C2) would have been the sum of the listed numbers, i.e., 180.

IFERROR Function Example 10

#4–“#NULL!” Error

The following list shows three numbers in the range A2:A4. We want to sum the numbers using the following formulas or functions:

  • The arithmetic operator “plus” (+) must be used to add the numbers in cells A2, A3, and A4.
  • The IFERROR function must return the total of the listed numbers.

The steps to use the plus sign (+) and the IFERROR function are listed as follows:

Step 1: Enter the following formula in cell A5.

“=A2+A3 A4”

Press the “Enter” key. The “#NULL!” error appears in cell A5, as shown in the following image. This error appears because we have forgotten to enter the relevant arithmetic operator before the reference A4. Rather, we have mistakenly entered a space before A4.

Handling #NULL! Error Example 4-1

Step 2: To replace the “#NULL!” error with the total of the listed numbers in column A, enter the following formula in cell A5.

“=IFERROR((A2+A3 A4),(SUM(A2:A4)))”

Press the “Enter” key.

The first argument, “A2+A3 A4,” is checked for an error. The second argument, “SUM(A2:A4),” is the “value_if_error.” This implies that if the first argument evaluates to an error, the function returns the output of the second argument “SUM(A2:A4).”

Hence, the IFERROR formula returns the sum 600 in cell A5, as shown in the following image.

Handling #NULL! Error Example 4-2

#5–“#NUM!” Error

The following list shows some numbers. We want to find the square roots of these numbers. Use the following functions:

  • The SQRT function in Excel must calculate the square roots of the given numbers.
  • The IFERROR function must return the text string “a negative number” for all “#NUM!” errors.

Handling #NUM Error Example 5

The steps to apply the SQRT FunctionThe Square Root function is an arithmetic function built into Excel that is used to determine the square root of a given number. To use this function, type the term =SQRT and hit the tab key, which will bring up the SQRT function. Moreover, this function accepts a single argument.read more and the IFERROR functions are listed as follows:

Step 1: Enter the following SQRT formula in cell B2.

“=SQRT(A2)”

Press the “Enter” key. Drag the formula downwards till cell B8. The output of the SQRT function is shown in column B of the following image.

The SQRT function helps calculate the square root of a number. However, the square root of a negative number does not exist. So, the SQRT function returns “#NUM!” errors for such numbers.

IFERROR Function Example 5-1

Step 2: To replace the “#NUM!” errors with the text string “a negative number,” enter the following formula in cell B2.

“=IFERROR(SQRT(A2),”A Negative Number”)”

Press the “Enter” key. Drag the formula till cell B8. The output of the formula is shown in column B of the following image.

The IFERROR function returns the result of the SQRT formula for all positive numbers. For the negative numbers, the IFERROR function returns the text “a negative number.” This text string notifies the user that the number whose square root needs to be found is negative.

Hence, the square roots of the listed numbers have been calculated and the resulting “#NUM!” errors have been replaced with a custom message (a negative number).

IFERROR Function Example 16

#6–“#REF!” Error

The following image shows two numbers in cells A2 and A3. These numbers have been divided with the help of the formula (=A2/A3) entered in cell C2. We want to delete row 3. Use the following techniques and functions:

  • The row 3 must be deleted by right-clicking its header and choosing “delete.”
  • The IFERROR function of Excel must return the text string “reference deleted” for the “#REF!” errors.

Handling #REF! Error Example 6

The steps to delete row 3 and apply the IFERROR function are listed as follows:

Step 1: Select row 3 by clicking the header (3) appearing on the leftmost side of the Excel sheet. Right-click the selection and choose “delete” from the context menu.

The row 3 is deleted and the “#REF!” error appears in cell C2, as shown in the following image.

The cell A3 was a part of the formula entered in cell C2. Since Excel is unable to locate the value (or cell reference) of the denominator, it returns the “#REF!” error in cell C2.

Handling #REF! Error Example 6-1

Step 2: To replace the “#REF!” error with the string “reference deleted,” enter the following formula in cell C2.

“=IFERROR((A2/#REF!),”Reference Deleted”)”

Press the “Enter” key. The output of the IFERROR formula appears in cell C2 of the following image.

The IFERROR function checks whether the first argument (A2/#REF!) evaluates to an error or not. Since it does return an error, the function returns the second argument (reference deleted) as the output.

The text string “reference deleted” implies that the cell referenceCell reference in excel is referring the other cells to a cell to use its values or properties. For instance, if we have data in cell A2 and want to use that in cell A1, use =A2 in cell A1, and this will copy the A2 value in A1.read more entered in the division formula has been deleted. This text string is the argument “value_if_error.”

Hence, row 3 has been deleted and the resulting “#REF!” error has been replaced by the string “reference deleted.”

Handling #REF! Error Example 6-2

#7–“#VALUE!” Error

The following image shows two values in cells A2 and A3. We want to add these values. Use the following formulas or functions:

  • The arithmetic operator plus (+) must sum up the given values.
  • The IFERROR function must return the text string “text can’t add to number” for the “#VALUE!” errors.

The steps to use the plus symbol (+) and the IFERROR function are listed as follows:

Step 1: Enter the following formula in cell A5.

“=A2+A3”

Press the “Enter” key. The “#VALUE!” error appears in cell A5. This is because cell A2 contains a number while A3 contains a text string. The addition of a numeric and text value has resulted in an error. The same is shown in the following image.

Handling #VALUE! Error Example 7

Step 2: To replace the “#VALUE!” error with the text string “text can’t add to number,” enter the following formula in cell A5.

“=IFERROR((A2+A3),”Text Can’t Add to Number”)”

Press the “Enter” key. The output of the IFERROR formula is shown in cell A5 of the following image.

The IFERROR function checks the first argument (A2+A3) for an error. Since this argument does evaluate to an error, the function returns the second argument (text can’t add to number). The text string “text can’t add to number” implies that a text value cannot be added to a numeric value.

Had there been a number in place of the string “bag,” the IFERROR function would have returned the sum of the two numbers.

Hence, since the given values could not be added, the resulting “#VALUE!” error has been replaced by a custom message (text can’t add to number).

Handling #VALUE! Error Example 7-1

Likewise, the IFERROR function can be used for managing errors in Excel. Moreover, the output to be returned (in case of an error) can be customized as per the requirements of the user.

Frequently Asked Questions

1. Define the IFERROR function of Excel.

The IFERROR function detects and handles the various types of Excel errors like “#N/A,” “#DIV/0!,” “#REF!,” “#VALUE!,” and so on. In place of these errors, the function returns a text message, number, empty string, logical value, etc.

The syntax of the IFERROR function of Excel is stated as follows:

“IFERROR(value,value_if_error)”

The first argument “value” is checked for errors. The second argument, “value_if_error,” is returned in case an error is found in the first argument. Both the arguments of the IFERROR function are mandatory.

2. When is the IFERROR function used and how does it work in Excel?

The IFERROR function is used in the following situations:

a. To capture the error and notify its presence to the user
b. To tell Excel what is to be done in case the first argument runs into an error
c. To replace the error with a customized message

The IFERROR function works as follows:

a. The function checks the first argument for errors.
b. In case the first argument does evaluate to an error, the function returns a predefined response. This response is entered as the second argument in the function.
c. In case the first argument does not run into an error, the function returns the result of the first argument.

3. How does the IFERROR function return a blank cell in Excel?

To return a blank cell, an empty string needs to be entered in the second argument of the IFERROR function. For example, two cells contain the following values:

• Cell A1 contains 20
• Cell A2 contains 0

Enter the formula “=IFERROR(A1/A2,””) in cell B1. After pressing the “Enter” key, it returns an empty cell (B1).

As long as cell A2 contains zero, the given IFERROR formula returns a blank cell. This is because the formula identifies division by zero as an error. The moment a value is entered in cell A2, the IFERROR formula returns the result of A1/A2.

Had A1 been a blank cell and A2 contained 20, the formula “=IFERROR(A1/A2,“no message”) would have returned 0. This is because the formula does not identify a blank cell in the numerator as an error. Hence, it returns the result of the first argument.

Recommended Articles

This has been a guide to IFERROR Excel function. We discuss how to handle excel errors (#DIV/0, #N/A, #NAME?, #NULL!, #NUM!, #REF!, #VALUE!,) with examples. You may also look at these useful functions of Excel

  • IFERROR with VLOOKUP in ExcelIFERROR is an error-handling function and Vlookup is a referencing function. They’re combined and used so that when Vlookup encounters an error while finding or matching the data, the formula must know what to do. Vlookup function is nested in the iferror function.read more
  • VBA IFERRORThe IFERROR function in Excel is used to determine what to do when an error occurs before performing any function.read more
  • VLOOKUP Errors
  • ISERROR in ExcelISERROR is a logical function that determines whether or not the cells being referred to have an error. If an error is found, it returns TRUE; if no errors are found, it returns FALSE.read more

Like this post? Please share to your friends:
  • Excel if массив аргументов
  • Excel if клетка заполнена
  • Excel if words match
  • Excel if with wildcard
  • Excel if with text values