When IFERROR checks a formula for any of the errors mentioned above – it returns the value we directed it to. This value is the one we specified for the value_if_error argument.
It’s time we use the IFERROR function for the following example in Excel.🙌
The data above represents employees’ working days, salary, and the number of sales made by each of them.
Suppose you want to calculate the sales efficiency of each employee. To do so, we will divide each employee’s sales (Column D) and working days (Column B).
Drag and drop the same formula to the whole list.
Excel displays #DIV/0! error message in cells E3 and E5. (Because the dividend i.e. Sales is zero for E3 and E5).
Let’s do the same thing again, but this time with the IFERROR function.
We are enclosing the same above formula in the IFERROR function:
=IFERROR(D3/B3 , 0)
In place of the value_if_error argument, we have specified zero (o).
Instead of displaying an error message, excel returned zero. This is because we provided zero as the value_if_error.
You can even display a custom message using the IFERROR function.
Let’s modify the above formula in the following way:
This time the value_if_argument is “On Leave”.
Once again, the function casts its magical spell on the error and provides us with a custom message in its place.🎉
Now that you know what the IFERROR function is, why not deal with complicated situations?