How to Use IFERROR and ISERROR in LibreOffice Calc
Handling formula errors is essential for creating clean, professional
spreadsheets in LibreOffice Calc. This guide covers how to use the
IFERROR and ISERROR functions to detect and
manage errors like #DIV/0!, #N/A, and
#VALUE!. You will learn the syntax, key differences, and
practical examples for both functions to prevent broken formulas from
cluttering your sheets.
The IFERROR Function
The IFERROR function evaluates an expression and returns
a fallback value if the formula results in an error. If no error occurs,
it returns the standard result of the formula.
Syntax
IFERROR(Value, Value_if_error)
- Value: The formula or cell reference being evaluated.
- Value_if_error: The custom result returned if an
error is detected (such as text, a number, or an empty string
"").
Example
If you are dividing cell A1 by cell B1, a
standard division formula will return #DIV/0! if
B1 is zero or blank:
=A1/B1
To display 0 instead of the error, use:
=IFERROR(A1/B1, 0)
To display a custom text message, wrap the string in quotation marks:
=IFERROR(A1/B1, "Division by Zero")
The ISERROR Function
The ISERROR function checks whether a specific value or
formula produces any error. Unlike IFERROR, it only returns
a boolean value: TRUE if there is an error, and
FALSE if there is not.
Syntax
ISERROR(Value)
- Value: The expression, formula, or cell reference you want to test.
Using ISERROR with the IF Function
Because ISERROR only outputs TRUE or
FALSE, it is typically nested inside an IF
statement to perform conditional actions.
=IF(ISERROR(A1/B1), "Error Occurred", A1/B1)
In this formula: 1. ISERROR(A1/B1) checks for an error.
2. If TRUE, the IF statement outputs
"Error Occurred". 3. If FALSE, the
IF statement calculates A1/B1.
Key Differences Between IFERROR and ISERROR
| Feature | IFERROR |
ISERROR |
|---|---|---|
| Output Type | Formula result or fallback value | Boolean (TRUE or
FALSE) |
| Formula Length | Shorter; combines detection and replacement | Longer; requires pairing with
IF |
| Efficiency | Evaluates the primary expression once | Evaluates the expression twice when nested
with IF |
| Best Used For | Direct error replacement | Conditional formatting, logic checks, or complex branching |
Practical Example: Trapping VLOOKUP Errors
A common scenario involves searching for records using
VLOOKUP. When an item does not exist in the lookup range,
Calc produces an #N/A error.
Using IFERROR:
=IFERROR(VLOOKUP(D2, A2:B10, 2, FALSE), "Not Found")
If the search key in D2 is not located within
A2:B10, the formula cleanly outputs
"Not Found" instead of #N/A.