Skip to content

Add #CALC! error type for Excel compatibility #1647

@marcin-kordas-hoc

Description

@marcin-kordas-hoc

Severity: Low (backlog)

HyperFormula's ErrorType enum does not include CALC. Excel uses #CALC! for several conditions:

  • Zero dimensions in array functions (=SEQUENCE(0), =SEQUENCE(1,0))
  • Empty array results
  • Certain spill-related errors (separate from #SPILL!)

Currently these are mapped to ErrorType.NUM (#NUM!), which is the closest semantic match but diverges from Excel.

Known affected locations

  • SequencePlugin.ts — zero dimension check returns #NUM! instead of #CALC!
  • Potentially other array functions

Scope

Adding ErrorType.CALC would require:

  • New enum value in src/Cell.ts
  • New error message in src/error-message.ts
  • Export handling in CellValueExporter
  • Updates to functions currently returning #NUM! where #CALC! is correct
  • Test updates

Impact

Cosmetic divergence from Excel. Does not affect functionality — formulas still error correctly, just with a different error type. Low priority unless Excel compatibility audit (2026 roadmap) prioritizes exact error type matching.

Found during SEQUENCE implementation (PR #1645).

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureSomething we can add later on without introducing a breaking changeTo Be DiscussedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions