ISERROR


Tests for any error value.

Syntax:

ISERROR(value)

Returns TRUE if value refers to or evaluates to any error value, including #N/A, and FALSE otherwise.

Use the ISERR function to test for any errors except #N/A.

Example:

ISERROR(SQRT(-1))

returns TRUE, because taking the squareroot of -1 is an error.

ISERROR(C5)

where C5 contains 123, returns FALSE, because 123 is not an error.

ISERROR(NA())

returns TRUE, because NA() returns the #N/A error.


Application:

Scenario: Calculating Price Per Unit


Imagine you have a spreadsheet for sales data, and you want to calculate the "Price Per Unit" for each product. The formula is Total Price / Quantity Sold. Some of the data might have a quantity of zero, leading to a division-by-zero error.


Without IFERROR:


The raw data and formula (B1/C1) would look like this:

Product

Total Price

Quantity Sold

Price Per Unit

A
B
C
D
1
Widget A
$100.00
10
$10.00
2
Gadget B
$50.00
5
$10.00
3
Tool C
$120.00
0
#DIV/0!
4
Gizmo D
$90.00
15
$6.00

Here, the calculation for "Tool C" results in a #DIV/0! error because you cannot divide a number by zero. This is a very common and legitimate error that needs to be handled.


With IFERROR:


This is the perfect use case for IFERROR. We can wrap the division formula to check for the error and, if found, display a more meaningful message.


Formula for D3: IFERROR(B3/C3, "No sales data")


This formula means: "Try to calculate B3 divided by C3. If the result is an error (like #DIV/0!), then display the text 'No sales data' instead."


Here is the corrected table with the IFERROR function:

Product

Total Price

Quantity Sold

Price Per Unit

A
B
C
D
1
Widget A
$100.00
10
$10.00
2
Gadget B
$50.00
5
$10.00
3
Tool C
$120.00
0
No sales data
4
Gizmo D
$90.00
15
$6.00




This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof