Information function

ERROR.TYPE function

Returns a number that identifies which error a cell contains, e.g. 2 for #DIV/0! and 7 for #N/A, so formulas can react to each error differently.

Available in All versions of Excel, including Microsoft 365 and Excel for the web

In every Excel versionWorks in Google Sheets

Syntax

ERROR.TYPE(error_val)
ArgumentWhat it means
error_valRequiredThe value to test — usually a cell reference or a formula that may return an error.

Returns: 1 for #NULL!, 2 for #DIV/0!, 3 for #VALUE!, 4 for #REF!, 5 for #NAME?, 6 for #NUM!, 7 for #N/A, 8 for #GETTING_DATA; newer Microsoft 365 errors return higher numbers. If the value is not an error, the result is #N/A.

How ERROR.TYPE works

Where ISERROR only tells you that something went wrong, ERROR.TYPE tells you what went wrong by returning a code number for each kind of error. That lets you show a specific message — "missing from price list" for #N/A, "no units sold" for #DIV/0! — rather than one generic warning.

The catch is that ERROR.TYPE itself returns #N/A when the cell is fine, because there is no error to classify. So in practice you either test for an error first with ISERROR, or wrap the call in IFERROR to turn "no error" into 0. A common pattern is =IF(ISERROR(B2), CHOOSE(ERROR.TYPE(B2), ...), B2).

Examples

1Identify a division-by-zero error

C2fx=ERROR.TYPE(B2)
ABC
1CheckResult
2Margin %#DIV/0!2
3Lookup#N/A
4Total#VALUE!
5Units125

Result: 2

B2 contains #DIV/0!, which has code 2. B3 (#N/A) would give 7 and B4 (#VALUE!) would give 3.

2A specific message for missing lookups

C3fx=IF(ERROR.TYPE(B3)=7, "Missing from list", "Calculation problem")
ABC
1CheckResult
2Margin %#DIV/0!
3Lookup#N/AMissing from list
4Total#VALUE!
5Units125

Result: Missing from list

B3 holds #N/A (code 7), so the message points the reader to the lookup list instead of the formula.

3Return 0 when there is no error

C5fx=IFERROR(ERROR.TYPE(B5), 0)
ABC
1CheckResult
2Margin %#DIV/0!
3Lookup#N/A
4Total#VALUE!
5Units1250

Result: 0

B5 holds the normal number 125. ERROR.TYPE returns #N/A for it, and IFERROR converts that into 0, meaning "no error".

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 16 KB

Common errors and how to fix them

ErrorWhy it happensFix
#N/AThe tested value is not an error.Check with ISERROR first, or wrap in IFERROR.

Tips

  • Use CHOOSE to map codes to messages: CHOOSE(ERROR.TYPE(B2), "Ranges don't meet", "Divide by zero", "Wrong type", "Broken reference", "Unknown name", "Bad number", "Not found").
  • For the common "not found" case alone, IFNA or ISNA is simpler than checking for code 7.

Google Sheets

ERROR.TYPE also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

ERROR.TYPE in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
CzechCHYBA.TYP
DanishFEJLTYPE
DutchTYPE.FOUT
FinnishVIRHEEN.LAJI
FrenchTYPE.ERREUR
GermanFEHLER.TYP
HungarianHIBA.TÍPUS
ItalianERRORE.TIPO
Norwegian (Bokmål)FEIL.TYPE
PolishNR.BŁĘDU
Portuguese (Brazil)TIPO.ERRO
Portuguese (Portugal)TIPO.ERRO
RussianТИП.ОШИБКИ
SpanishTIPO.DE.ERROR
SwedishFEL.TYP
TurkishHATA.TİPİ