Share this page:

MS Excel: ISERROR Function (WS, VBA)

Learn how to use the Excel ISERROR function with syntax and examples.

Description

The Microsoft Excel ISERROR function can be used to check for error values.

Syntax

The syntax for the Microsoft Excel ISERROR function is:

ISERROR( value )

Parameters or Arguments

value is the value that you want to test. If value is an error value (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? or #NULL), this function will return TRUE. Otherwise, it will return FALSE.

Applies To

The ISERROR function can be used in the following versions of Microsoft Excel:

  • Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Type of Excel Function

The ISERROR function can be used in Microsoft Excel as the following type of function:

  • Worksheet function (WS)
  • VBA function (VBA)

Example (as Worksheet Function)

Let's look at some Excel ISERROR function examples and explore how to use the ISERROR function as a worksheet function in Microsoft Excel:

Microsoft Excel

Based on the spreadsheet above, the following Excel ISERROR examples would return:

=ISERROR(A1)
Result: TRUE

=ISERROR(A2)
Result: TRUE

=ISERROR(A3)
Result: TRUE

=ISERROR(A4)
Result: FALSE

=ISERROR("www.techonthenet.com")
Result: FALSE

=ISERROR(3/0)
Result: TRUE

Example (as VBA Function)

The ISERROR function can also be used in VBA code in Microsoft Excel.

Let's look at some Excel ISERROR function examples and explore how to use the ISERROR function in Excel VBA code:

Dim LReturnValue as Boolean

LReturnValue = IsError(CustomFunction())

In this example, the variable called LReturnValue would now contain whether the call to the CustomFunction resulted in an error.

Frequently Asked Questions

Question: Can you give me specific examples of when and how the ISERROR function is used. Specifically, in a worksheet why would I use this function instead of just running down a column or across a row to look for the errors?

Answer: Often times your spreadsheet contains a large amount of formulas which will not properly calculate when an error is encountered. The ISERROR function, in combination with the If function, can be used to default a cell's value when an error is occurred. This allows your formulas to evaluate properly without your intervention.

For example, you may encounter a scenario below:

Microsoft Excel

Instead of using the formula:

=B4/C4

You could use the ISERROR function as follows:

=IF(ISERROR(B4/C4),0,B4/C4)

Microsoft Excel

In this case, the ISERROR function would allow you to return a 0, when an error was encounter such as a "divide by 0 error". Now all of your formulas will still work.