Skip to content

OFFSET formula not evaluated by calc engine (1.0.76) #101

@lgbnt

Description

@lgbnt

Bug: OFFSET formula not evaluated by calc engine

Version: officecli 1.0.76
OS: Ubuntu 24.04, kernel 6.17.0-23
Severity: Medium

Steps to reproduce

officecli create test.xlsx
officecli open test.xlsx
cat <<'EOF' | officecli batch test.xlsx
[
  {"command":"set","path":"/Sheet1/A1","props":{"value":"100"}},
  {"command":"set","path":"/Sheet1/A2","props":{"value":"200"}},
  {"command":"set","path":"/Sheet1/B1","props":{"formula":"OFFSET(A1,0,0)"}},
  {"command":"set","path":"/Sheet1/B2","props":{"formula":"OFFSET(A1,1,0)"}}
]
EOF
officecli close test.xlsx
officecli get test.xlsx /Sheet1/B1

Expected

/Sheet1/B1 (cell) "100" type=Number formula=OFFSET(A1,0,0) cachedValue=100

Actual

/Sheet1/B1 (cell) "=OFFSET(A1,0,0)" type=String

The formula is stored as literal text, not evaluated. cachedValue is missing.

Context

We tested 40 common Excel formulas against officecli's calc engine. 39/40 pass correctly — including SUM, AVERAGE, VLOOKUP, INDEX+MATCH, SUMIF, PMT, SUMPRODUCT, etc. OFFSET is the only one that fails.

Workaround

INDEX can replace OFFSET in most cases:

  • OFFSET(A1,1,0)INDEX(A:A,2) (1-indexed row)
  • Dynamic ranges can use structured references (ListObject) or INDIRECT

officecli-offset-issue.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions