Excel - ERROR.TYPE Function



ERROR.TYPE Function

Errors typically arise when a formula contains inaccurate cell values, improper logic, or an incorrect cell reference. The Microsoft Excel tools have been allocated distinct numbers to errors. The Excel ERROR.TYPE function will retrieve one of these numbers after evaluating the complex formula. The numbers that are returned fall between 1 and 8. The ERROR.TYPE function will retrieve the #N/A error if the error is not encountered. This function comes under the Excel Information Function.

Compatibility

This advanced Excel function is compatible with the following versions of MS Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016
  • Excel 2013
  • Excel 2010
  • Excel 2007

Syntax

The syntax of the ERROR.TYPE function is as follows −

=ERROR.TYPE(error_val)

Arguments

You can use the following arguments with the ERROR.TYPE function −

Argument Description Required/ Optional
Error_val

It indicates the error value for which you want to fetch its identifying number.

Here, error_val would be the actual error value; it will be a cell reference pointing to a formula you wish to verify whether it contains an error value or an accurate result.

The Error Values Table below shows you the different numbers associated with the error_val returned by the function.

Required

Error Values

Error_val What 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

Notes − The following table shows what each of these different error messages mean −

S .No. Error Value & Meaning of the Error Value
1

#NULL!

Arises when you refer to an intersection of two ranges that do not intersect.

2

#DIV/0!

Occurs when a formula attempts to divide by zero.

3

#VALUE!

Occurs if the variables in your formula are of the wrong type (e.g., text value when a numeric value is expected).

4

#REF!

Arises when a formula contains an invalid cell reference.

5

#NAME!

This occurs if Excel does not recognize a formula name or text within a formula.

6

#NUM!

Occurs when Excel encounters an invalid number.

7

#N/A

Indicates that a value is not available to a formula.

Examples of ERROR.TYPE Function

Practice the following examples to learn the use of the ERROR.TYPE function in Excel.

Example 1: How to Implement the ERROR.TYPE Function in Excel

In this example, we will extract the specific number matching the type of error.

Solution

Step 1 − Assume the sample dataset consists of the three columns named Data, Error, and Error Type. The different types of formulas that we have applied in the Error column are shown below.

Implement ERROR.TYPE Function in Excel1

Step 2 − After that, select the range E3:E6 and enter the formula =ERROR.TYPE(D3) in the formula bar.

Implement ERROR.TYPE Function in Excel2

Step 3 − Furthermore, press the "Ctrl+Enter" to populate the result in the selected range of the cells.

Implement ERROR.TYPE Function in Excel3

Therefore, the respective error type is displayed by passing the different references in the ERROR.TYPE's argument. After evaluating the expression =B6-C6 in the D6 cell, no error occurred, and then the expression "=ERROR.TYPE(D6)" returns the #N/A error in the E6 cell.

Example 2: Combining the if Statement with the ERROR.TYPE Message

After verifying the existence of an error in the IF statement, the custom message can be displayed using the ERROR.TYPE functions as a condition inside the IF statement.

Solution

Step 1 − You may enter the formula =IF(ERROR.TYPE(D3)=9,"Error found", "different error type") in the C5 cell.

In this expression, we will check whether the expression ERROR.TYPE(D3) equals 9 or not. If this statement is true, then the first statement, "Error found", will be displayed. Otherwise, the second statement, "Different error type", will return.

Combining if Statement with ERROR.TYPE Message1

Step 2 − After that, hit the Enter tab. Therefore, the resulting value is "different error type" as the condition is not true.

Combining if Statement with ERROR.TYPE Message2

If the error is not found in the D3 cell, then the formula specified in the C5 cell gives you a #N/A error.

Download Practice Sheet

You can download and use the sample data sheet to practice the ERROR.TYPE function.

Advertisements