Return to List of Excel Functions

ISERROR Function Examples in Excel, VBA, & Google Sheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on November 6, 2023
Download Example Workbook

Download the example workbook

This tutorial demonstrates how to use the ISERROR Function in Excel to test if a cell results in an error.

ISERROR Main

How to use the ISERROR Function

The ISERROR Function checks if a calculation results in an error.

=ISERROR(A2)

ISERROR

IF ISERROR Replaced by IFERROR

Prior to Excel 2007, the ISERROR Function was commonly used along with the IF Function to output a second calculation if the first calculation resulted in an error.

=IF(ISERROR(C2/B2),"Zero Stock",C2/B2)

IF ISERROR

However, in Excel 2007, the IFERROR Function was introduced, making the IF / ISERROR combo obsolete.

=IFERROR((C2/B2),"Zero Stock")

IFERROR

ISERR and ISNA

The ISERROR Function returns TRUE if any error occurs.

There are two other error checking “is” functions:

=ISNA(A2)
=ISERR(A2)

ISNA ISERR

Also, in addition to the IFERROR Function, there is the IFNA Function.

These functions are important because many formula errors are a result of bad formulas, but #N/A errors are often valid. For example, if you use the VLOOKUP Function and the lookup value is not found, the formula will return #N/A.

=VLOOKUP(A2,$D$2:$E$7,2,FALSE)

ISERROR Vlookup

By applying the IFNA Function to the VLOOKUP, you can handle valid #N/A errors, while not handling other formula errors (so you don’t overlook those other errors).

=IFNA(VLOOKUP(A2,$D$2:$E$7,2,FALSE),VLOOKUP(A2,$G$2:$H$7,2,FALSE))

ISERROR Vlookup IFNA

Other Logical Functions

Excel / Google Sheets contain many other logical functions to perform other logical tests. Here is a list:

IF / IS Functions
iferror
iserror
isna
iserr
isblank
isnumber
istext
isnontext
isformula
islogical
isref
iseven
isodd

ISERROR in Google Sheets

The ISERROR Function works exactly the same in Google Sheets as in Excel:

ISERROR Google

ISERROR Examples in VBA

You can also use the ISERROR function in VBA. Type:

application.worksheetfunction.iserror(value)

For the function arguments (value, etc.), you can either enter them directly into the function, or define variables to use instead.

Lets assume we have the following values in our worksheet

Vba ISERROR function

We will issue the ISERROR function with VBA, for each of the above cells:

WorksheetFunction.IsError(Range("A1")) 'FALSE
WorksheetFunction.IsError(Range("B1")) 'FALSE
WorksheetFunction.IsError(Range("C1")) 'FALSE
WorksheetFunction.IsError(Range("D1")) 'TRUE
WorksheetFunction.IsError(Range("E1")) 'TRUE
WorksheetFunction.IsError(Range("G1")) 'TRUE

Excel Practice Worksheet

practice excel worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!

Free Download

Return to List of Excel Functions