Quick Answer

ERROR.TYPE Function

Returns a number code for an error type.

✓ Excel✓ Google SheetsExcel All versions

Syntax

ERROR.TYPE
(error_val)

Parameters

ParameterDescriptionRequired
error_valA reference to a cell (or a value) that contains an Excel error.Required

Basic Example

Identify a divide-by-zero error

=ERROR.TYPE(A1)
Result2

A1 contains #DIV/0!, which maps to code 2.

Advanced Examples

Example 1: Identify #REF!

A deleted reference produced #REF!.

Map the #REF! error

=ERROR.TYPE(#REF!)
Result: 4
#REF! corresponds to error code 4.

Example 2: Safe lookup with a guard

Return the code only when an error exists.

Avoid ERROR.TYPE's own #N/A on good values

=IF(ISERROR(A1), ERROR.TYPE(A1), "no error")
Result: no error
When A1 is fine, ISERROR is FALSE so the formula returns "no error" instead of triggering #N/A.

How ERROR.TYPE Works

ERROR.TYPE returns a numeric code for the error in error_val: 1=#NULL!, 2=#DIV/0!, 3=#VALUE!, 4=#REF!, 5=#NAME?, 6=#NUM!, 7=#N/A. If error_val is not an error, ERROR.TYPE itself returns #N/A. Pair it with ISERROR or IFERROR before calling.

1
Confirm an error exists
Use ISERROR on the cell first.
2
Enter the formula
Type =ERROR.TYPE(cell).
3
Map the code
Use CHOOSE or a lookup to turn the number into an error name.

Important Notes & Limitations

  • Returns #N/A when given a non-error value.

  • Works only on an actual error value, not on a text label like "#DIV/0!".

  • Only returns a code; you must map it to a name yourself.

Common Errors & Fixes

#N/A from ERROR.TYPE itselfThe argument is not an error value.

Fix: Guard with ISERROR or IFERROR before calling it.

Wrong code recalledThe code numbers are easy to mix up.

Fix: Remember #DIV/0! is 2 and #N/A is 7.

Download Practice File

Practice ERROR.TYPE with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the ERROR.TYPE function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

What code is #N/A?
7.
What if there is no error?
ERROR.TYPE returns #N/A, so always guard it.
How do I show the error name?
Use CHOOSE, e.g. =CHOOSE(ERROR.TYPE(A1), "Null", "Div0", "Value", "Ref", "Name", "Num", "NA").