ERROR.TYPE function
The ERROR.TYPE function in Excel is used to identify the type of error in a formula or cell. It returns a specific number corresponding to the type of error, which can then be used for troubleshooting or conditional logic.
Syntax:
ERROR.TYPE(error_val)
Arguments:
- error_val: The error value or a reference to a cell containing an error.
Error Codes and Their Meanings:
| Error Value | Description | ERROR.TYPE Result |
|---|---|---|
#NULL! | Null intersection | 1 |
#DIV/0! | Division by zero | 2 |
#VALUE! | Invalid value | 3 |
#REF! | Invalid cell reference | 4 |
#NAME? | Invalid function name | 5 |
#NUM! | Invalid numeric value | 6 |
#N/A | Value not available | 7 |
| Any other value | No error | #N/A |
Example:
Suppose you have the following data in A1:
- A1:
=1/0(results in#DIV/0!)
Formula:
=ERROR.TYPE(A1)
Result:
2 (indicating a #DIV/0! error).
Usage:
- Custom Error Messages:
=IF(ERROR.TYPE(A1)=2, "Division by zero error", "No issue") - Error Handling: Use ERROR.TYPE to identify specific errors and take appropriate action in your formulas.
- Debugging: Combine with IF or ISERROR to troubleshoot complex formulas.
Notes:
- If the input (
error_val) does not contain an error, the function returns#N/A. - The function is particularly useful in combination with error-checking formulas like IFERROR or ISERROR.