ERROR.TYPE Function

Excel 2007+

Summary

The ERROR.TYPE function identifies specific Excel error values by returning a unique number for each error type. This enables precise error handling and conditional logic based on the exact error encountered in formulas.

Syntax

ERROR.TYPE(error_val)

Parameters

Parameter Type Required Description
error_val Any Yes The cell reference or direct error value to analyze for its error type number.

Using the ERROR.TYPE Function

ERROR.TYPE converts Excel errors into numeric codes, allowing sophisticated error handling beyond simple error detection. Use it within IF statements, CHOOSE functions, or validation logic to provide specific responses for different error conditions.

Common ERROR.TYPE Examples

Basic Error Identification

=ERROR.TYPE(A1)

Returns the numeric code for whatever error appears in cell A1 (1-8) or #N/A if no error.

Custom Error Messages

=IF(ERROR.TYPE(B2)<3,CHOOSE(ERROR.TYPE(B2),"Ranges don't intersect","Divisor is zero"),"Other error")

Provides specific messages for #NULL! (1) and #DIV/0! (2) errors, generic response for others.

Error Type Validation

=IFERROR(CHOOSE(ERROR.TYPE(C3),"NULL error","Div/0 error","Value error","Ref error","Name error","Num error","N/A error","Data error"),"No error")

Converts any error in C3 to a descriptive text using all 8 error codes.

Frequently Asked Questions

#N/A error value is returned when the input is not a valid Excel error.

#GETTING_DATA is available in Excel 2013 and later versions.

No, newer spill errors like #SPILL! are not covered by ERROR.TYPE codes 1-8.

Common Errors and Solutions

#N/A result

Cause: Input cell contains no error value or a non-standard error

Solution: Ensure the referenced cell contains a genuine Excel error value (#NULL!, #DIV/0!, etc.)

Unexpected numeric result

Cause: Error type number doesn't match expected logic

Solution: Verify error code mapping: 1=#NULL!, 2=#DIV/0!, 3=#VALUE!, etc.

Notes

  • Error codes: 1=#NULL!, 2=#DIV/0!, 3=#VALUE!, 4=#REF!, 5=#NAME?, 6=#NUM!, 7=#N/A, 8=#GETTING_DATA
  • Use with CHOOSE function for multiple error message options
  • Does not detect newer errors like #SPILL! or #CALC!
  • Perfect companion to IFERROR for advanced error diagnostics

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365

Not available in: Excel 2003 and earlier

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+