ERROR.TYPE function
ERROR.TYPE turns an error into a number from 1 to 8 so a formula can respond to a specific kind of error. It returns #N/A if the value is not an error.
Example
Read it as a sentence: look at the #N/A error and give back its error number, which is 7.
A
B
C
D
1
7
2
3
Syntax
ERROR.TYPE(error_val)
-
error_val(required) - The error value to identify.
Returns: A number from 1 to 8 for the error kind, or #N/A if it is not an error.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=ERROR.TYPE(1/0) | 2 | Div 0 |
=ERROR.TYPE(#NAME?) | 5 | Name |
=ERROR.TYPE(NA()) | 7 | N/a |
=ERROR.TYPE(#GETTING_DATA) | 8 | Getting data literal |
=ERROR.TYPE(#NULL!) | 1 | 1 |
=ERROR.TYPE(#VALUE!) | 3 | Value |
=ERROR.TYPE(LAMBDA(x,x)) | #N/A | Uncalled lambda |
=ERROR.TYPE(5) | #N/A | Not an error |
Watch out for
- #DIV/0! is 2, #N/A is 7, #NAME? is 5.
- Non-errors return #N/A.
Where it works
- Excel
- ERROR.TYPE is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Information functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .