ERROR.TYPE Function (LibreOffice Calc)

Information Advanced LibreOffice Calc LibreOffice 3.0

The ERROR.TYPE function in LibreOffice Calc returns a numeric code identifying the specific error value in a cell. It is essential for debugging, error classification, and building precise error-handling logic.

The **ERROR.TYPE** function returns a numeric code identifying the specific error in a cell. It distinguishes between `#N/A`, `#DIV/0!`, `#REF!`, `#VALUE!`, and other error types. ERROR.TYPE is essential for debugging, error classification, and building precise error-handling logic in complex spreadsheets.

This guide provides syntax, error codes, examples, edge cases, and best practices, making it one of the most complete ERROR.TYPE references available for LibreOffice Calc.

What the ERROR.TYPE Function Does

  • Returns a numeric code for a specific error
  • Helps classify errors for debugging
  • Useful for building custom error-handling logic
  • Works with formulas, references, and literal errors

It is designed to be precise, diagnostic, and essential for advanced workflows.

Syntax

ERROR.TYPE(value)

Arguments

  • value:
    Any value, expression, or cell reference.

ERROR.TYPE Return Codes

Code Error Meaning
1 #NULL! Intersection of ranges is empty
2 #DIV/0! Division by zero
3 #VALUE! Invalid argument type
4 #REF! Invalid reference
5 #NAME? Unknown function or name
6 #NUM! Invalid numeric value
7 #N/A Value not available
#N/A No error Returned when value is not an error

Basic Examples

Identify the error in A1

=ERROR.TYPE(A1)

Check a literal error

=ERROR.TYPE(#REF!)

Returns 4.

Check a division error

=ERROR.TYPE(1/0)

Returns 2.

Check a #N/A error

=ERROR.TYPE(#N/A)

Returns 7.

Check a non-error value

=ERROR.TYPE(42)

Returns #N/A (meaning “no error”).

Advanced Examples

Build custom error messages

=IF(ISERROR(A1); "Error " & ERROR.TYPE(A1); "OK")

Distinguish #N/A from other errors

=IF(ERROR.TYPE(A1)=7; "Not found"; "Other error")

Handle only #REF! errors

=IF(ERROR.TYPE(A1)=4; "Bad reference"; A1)

Handle only #DIV/0! errors

=IF(ERROR.TYPE(A1)=2; "Divide by zero"; A1)

Create a full error classifier

=CHOOSE(ERROR.TYPE(A1); "Null"; "Div0"; "Value"; "Ref"; "Name"; "Num"; "NA")

Use ERROR.TYPE with VLOOKUP

=IF(ERROR.TYPE(VLOOKUP(A1; B1:C10; 2; 0))=7; "Not found"; "OK")

Use ERROR.TYPE in debugging dashboards

=ERROR.TYPE(A1)

Useful for tracing error propagation.

Edge Cases and Behavior Details

ERROR.TYPE returns #N/A when no error exists

=ERROR.TYPE(100)

Returns #N/A.

ERROR.TYPE only works on error values

  • Numbers → #N/A
  • Text → #N/A
  • Logical values → #N/A
  • Blank cells → #N/A

ERROR.TYPE does not evaluate text errors

=ERROR.TYPE("#REF!")

Returns #N/A — text is not an error.

ERROR.TYPE works on formula results

=ERROR.TYPE(A1/B1)

ERROR.TYPE does not catch hidden errors in strings

=ERROR.TYPE("Error")

Returns #N/A.

Common Errors and Fixes

ERROR.TYPE returns #N/A unexpectedly

Cause:

  • Value is not an error
  • Value is text, not a real error
  • Value is blank
  • Value is a number

ERROR.TYPE returns wrong code

Cause:

  • Error is wrapped in text
  • Error is inside a string returned by a formula

ERROR.TYPE used on a range

=ERROR.TYPE(A1:A10)

Returns a single value in array context; not recommended.

Best Practices

  • Use ERROR.TYPE for precise error classification
  • Use ISERROR/ISERR/ISNA for broader detection
  • Use ERROR.TYPE to build custom error messages
  • Use ERROR.TYPE with lookup functions for debugging
  • Avoid passing text that looks like errors
ERROR.TYPE is your precision tool — perfect for diagnosing exactly which error occurred and building intelligent error-handling logic.
  • Use ISERROR to detect any error
  • Use ISERR to detect all errors except #N/A
  • Use ISNA to detect #N/A specifically
  • Use IFERROR and IFNA for simplified error handling
  • Use TYPE to classify values more broadly

By mastering ERROR.TYPE and its companion functions, you can build highly diagnostic, error‑aware spreadsheets in LibreOffice Calc.