Information

ERROR.TYPE Formula

ERROR.TYPE returns a number corresponding to the specific type of error in a cell. It is useful for building detailed error-handling logic that responds differently to different error types, and for diagnostic formulas that identify exactly what went wrong.

Syntax

ERROR.TYPE(error_val)
ParameterDescription
error_val Parameter of the ERROR.TYPE function.
Try ERROR.TYPE in Viztab — free, no signup

Examples

Identify error type

Formula
=ERROR.TYPE(A1)
If A1 contains #DIV/0!, returns 2. If #VALUE!, returns 3. If #REF!, returns 4. Returns #N/A if A1 has no error.

Custom error messages

Formula
=IFERROR(CHOOSE(ERROR.TYPE(A1),"Null error","Div by zero","Wrong type","Bad reference","Bad name","Bad number","N/A"), "No error")
Converts cryptic error codes into human-readable messages. CHOOSE maps each error number to a friendly description.

Count specific errors

Formula
=SUMPRODUCT((ISERROR(A1:A100))*(ERROR.TYPE(A1:A100)=2)*1)
Counts how many cells in A1:A100 contain #DIV/0! errors specifically. Error type 2 = division by zero.

Common Errors

#N/A

Returned when the argument is NOT an error — ERROR.TYPE returns #N/A for valid, non-error values. This is intentional.

Tips

Error number mapping

1=#NULL!, 2=#DIV/0!, 3=#VALUE!, 4=#REF!, 5=#NAME?, 6=#NUM!, 7=#N/A, 8=#GETTING_DATA. Memorize 2 (div/0) and 7 (N/A) — they're the most common.

Returns #N/A for non-errors

Counterintuitively, ERROR.TYPE errors (#N/A) when the input is fine. Wrap in IFERROR to handle both cases cleanly.

Debugging tool

When ISERROR is TRUE but you don't know which error, ERROR.TYPE tells you the specific type without having to examine the cell manually.

Try ERROR.TYPE in Viztab

Import your data and use ERROR.TYPE with 370+ other formulas. No signup required.

Open Viztab

Related Formulas