ERROR.TYPE Function
Returns a number code for an error type.
Syntax
Parameters
| Parameter | Description | Required |
|---|---|---|
| error_val | A reference to a cell (or a value) that contains an Excel error. | Required |
Basic Example
Identify a divide-by-zero error
=ERROR.TYPE(A1)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!)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")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.
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
ERROR.TYPE
error-typePractice 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.
File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps