The Excel ERROR.TYPE function returns a number that corresponds to a specific error value. You can use ERROR.TYPE to test for specific kinds of errors. If no error exists, ERROR.TYPE returns #N/A. See below for a key to the error codes returned by ERROR.TYPE.
Syntax:= ERROR.TYPE (error_val)
The ERROR.TYPE function syntax has the following arguments:
- Error_val Required. The error value whose identifying number you want to find. Although error_val can be the actual error value, it will usually be a reference to a cell containing a formula that you want to test.
If error_val is | ERROR.TYPE returns |
---|---|
#NULL! | 1 |
#DIV/0! | 2 |
#VALUE! | 3 |
#REF! | 4 |
#NAME? | 5 |
#NUM! | 6 |
#N/A | 7 |
#GETTING_DATA | 8 |
Anything else | #N/A |
Example: Let’s look at some Excel ERROR.TYPE function examples and explore how to use the ERROR.TYPE function as a worksheet function in Microsoft Excel:
Syntax: =ERROR.TYPE(A2)
Result:
Based on the Excel spreadsheet above, the following ERROR.TYPE examples would return:
Syntax: =ERROR.TYPE(A3)
Result: 2
Syntax: =ERROR.TYPE(A4)
Result: 3
Syntax: =ERROR.TYPE(A5)
Result: 4
Syntax: =ERROR.TYPE(A6)
Result: 5
Syntax: =ERROR.TYPE(A7)
Result: 6
Syntax: =ERROR.TYPE(A8)
Result: 7
Syntax: =ERROR.TYPE(A9)
Result: #N/A
Syntax: =ERROR.TYPE(A10)
Result: #N/A
Syntax: =IF(ERROR.TYPE(A11)<3,CHOOSE(ERROR.TYPE(A11),”Ranges do not intersect”,”The divisor is zero”))
Result: The divisor is zero
Note:
Use ERROR.TYPE to get a number that corresponds to a specific error value. See below for a key to the error codes returned by ERROR.TYPE. If no error exists, ERROR.TYPE returns #N/A.
In most cases, error_val will be supplied as a reference to a cell that may contain an error value.
One way to use ERROR.TYPE is to test for specific errors and display a relevant message (instead of error values) when certain error conditions exist.