FormulaCraft

ERROR.TYPE

ERROR.TYPE maps each Excel error to a numeric code: 1=#NULL!, 2=#DIV/0!, 3=#VALUE!, 4=#REF!, 5=#NAME?, 6=#NUM!, 7=#N/A, and 8=#GETTING_DATA. It returns #N/A when the referenced cell contains no error. Use it to write targeted error-handling formulas that respond differently depending on the specific error type.

Excel
=IF(ISERROR(A2),ERROR.TYPE(A2),"OK")
Google Sheets
=IF(ISERROR(A2),ERROR.TYPE(A2),"OK")

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How it works

  1. 1Reference the cell that may contain an error (e.g., =ERROR.TYPE(A2)).
  2. 2If the cell has an error, you receive a number 1–8 indicating which error type it is.
  3. 3Wrap in IF(ISERROR(...),...) so you only call ERROR.TYPE when an error is present, avoiding the #N/A it returns for non-error cells.

Need a version for your data?

Try: “Identify whether my formula errors are divide-by-zero or reference errors so I can fix each type

Related

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: