Formualizer Docs
Reference

Errors and Types

Detailed guide on value types, coercion rules, and error handling in Formualizer.

Formualizer maintains a strict type system to ensure compatibility with Excel and other spreadsheet engines while providing clear feedback for developers.

Value Types

The core of the system is the LiteralValue model, which maps to native types across different language bindings.

TypeDescriptionPython MappingJS Mapping
Number64-bit floating pointfloatnumber
Int64-bit integerintnumber / bigint
TextUTF-8 stringstrstring
BooleanLogical true/falseboolboolean
Array2D grid of valuesList[List]Array<Array>
DateCalendar datedatetime.dateDate
EmptyBlank cellNonenull
ErrorSpreadsheet errorExcelErrorError object

Excel Error Codes

When an evaluation fails, it returns a specific error code.

ErrorMeaningCommon Cause
#NULL!Null intersectionSpace operator between non-overlapping ranges
#REF!Invalid referenceDeleted row/column or out-of-bounds access
#NAME?Unrecognized nameMisspelled function or undefined name
#VALUE!Wrong value typeText provided where a number was expected
#DIV/0!Division by zeroDenominator is 0 or an empty cell
#N/ANot availableVLOOKUP or MATCH found no match
#NUM!Invalid numberOut-of-range numeric result (e.g., SQRT(-1))
#SPILL!Spill blockedTarget range for an array formula has existing content
#CALC!Calculation errorEngine-level calculation failure or nested array error
#CIRC!Circular referenceA formula references its own cell, directly or indirectly
#N/IMPL!Not implementedThe function exists but the implementation is missing
#CANCELLED!Evaluation cancelledThe evaluation was manually aborted via API

Coercion Rules

Formualizer performs automatic type conversion depending on the context of the operation:

  • Numeric Context:
    • Text is converted to a number if it represents a valid numeric string.
    • Boolean TRUE becomes 1, FALSE becomes 0.
    • Empty cells are treated as 0.
  • Text Context:
    • Numbers and Booleans are converted to their string representations ("123", "TRUE").
    • Empty cells become an empty string ("").
  • Logical Context:
    • Non-zero numbers are TRUE, 0 is FALSE.
    • Text results in a #VALUE! error if used in a logical test.

Error Propagation

In most cases, errors "short-circuit" expressions. If any argument to a function is an error, the function itself returns that error. Exceptions include error-handling functions like IFERROR, IFNA, and ISERROR, which can trap and handle these values.

See Also

On this page