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 ValueDescriptionERROR.TYPE Result
#NULL!Null intersection1
#DIV/0!Division by zero2
#VALUE!Invalid value3
#REF!Invalid cell reference4
#NAME?Invalid function name5
#NUM!Invalid numeric value6
#N/AValue not available7
Any other valueNo 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:

  1. Custom Error Messages:
    =IF(ERROR.TYPE(A1)=2, "Division by zero error", "No issue")
    
  2. Error Handling: Use ERROR.TYPE to identify specific errors and take appropriate action in your formulas.
  3. 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.
Leave a Reply 0

Your email address will not be published. Required fields are marked *