The ISERROR
function in Excel is used to check if a cell contains an error. It returns TRUE
if the cell contains any error (e.g., #N/A
, #VALUE!
, #REF!
, #DIV/0!
, #NUM!
, #NAME?
, or #NULL!
), and FALSE
otherwise.
Below are 10 examples of how to use the ISERROR
function, including data and formulas:
Example 1: Basic Usage
Data:
Cell A1
contains =1/0
(which results in #DIV/0!
).
Formula:=ISERROR(A1)
Result: TRUE
(because A1
contains a division by zero error).
Example 2: Combining with IF
Data:
Cell A2
contains =SQRT(-1)
(which results in #NUM!
).
Formula:=IF(ISERROR(A2), "Error Found", "No Error")
Result: "Error Found"
(because A2
contains a #NUM!
error).
Example 3: Checking a Formula
Data:
Cell A3
contains =VLOOKUP("Apple", B1:C5, 2, FALSE)
(but "Apple" is not found in the range).
Formula:=ISERROR(A3)
Result: TRUE
(because A3
results in #N/A
).
Example 4: Using with Arithmetic Operations
Data:
Cell A4
contains 10
, and Cell B4
contains 0
.
Formula:=ISERROR(A4/B4)
Result: TRUE
(because dividing by zero results in #DIV/0!
).
Example 5: Checking a Range
Data:
Cells A5:A10
contain numbers, but A7
contains #REF!
.
Formula:=ISERROR(A7)
Result: TRUE
(because A7
contains a #REF!
error).
Example 6: Using with Array Formulas
Data:
Cells B1:B5
contain {1, 2, #N/A, 4, 5}
.
Formula:=ISERROR(B3)
Result: TRUE
(because B3
contains #N/A
).
Example 7: Combining with SUM
Data:
Cells C1:C5
contain {10, 20, #VALUE!, 40, 50}
.
Formula:=IF(ISERROR(SUM(C1:C5)), "Error in Range", SUM(C1:C5))
Result: "Error in Range"
(because C3
contains #VALUE!
, causing the SUM
function to fail).
Example 8: Checking for Specific Errors
Data:
Cell D1
contains =1/0
(which results in #DIV/0!
).
Formula:=IF(ISERROR(D1), "Division Error", "No Error")
Result: "Division Error"
(because D1
contains a division by zero error).
Example 9: Using with Conditional Formatting
Data:
Cells E1:E10
contain various values, including errors.
Steps:
Select the range
E1:E10
.Go to Conditional Formatting > New Rule.
Use the formula:
=ISERROR(E1)
.Set a format (e.g., red fill) to highlight cells with errors.
Result: All cells in E1:E10
containing errors will be highlighted.
Example 10: Combining with IFERROR
Data:
Cell F1
contains =1/0
(which results in #DIV/0!
).
Formula:=IFERROR(F1, "Custom Error Message")
Result: "Custom Error Message"
(because F1
contains an error, and IFERROR
handles it by displaying the custom message).
Key Notes:
ISERROR
checks for all types of errors. If you only want to check for specific errors (e.g.,#N/A
), useISNA
or other specific error-checking functions.Combine
ISERROR
withIF
to create more dynamic and error-resistant formulas.Use
IFERROR
for a cleaner way to handle errors in formulas.
No comments:
Post a Comment