Skip to content

[Bug]: ADDRESS returns "!R2C3" when sheetName is empty (should return "R2C3") #1641

Description

@marcin-kordas-hoc

Description

ADDRESS(2,3,1,FALSE(),) returns !R2C3 instead of R2C3.

When the sheetName argument is an empty string (either from an empty cell reference or trailing comma), HyperFormula still prepends the ! separator. Excel ignores empty sheetName and returns the address without prefix.

Root cause

In src/interpreter/plugin/AddressPlugin.ts:70, the condition:

if (sheetName !== undefined && sheetName !== null)

does not exclude empty strings. Fix: add && sheetName !== ''.

Reproduction steps

const hf = HyperFormula.buildFromArray([
  ['=ADDRESS(2,3,1,FALSE(),)'], // empty sheetName — should be "R2C3", bug: "!R2C3"
], { licenseKey: 'gpl-v3' })

hf.getCellValue({ sheet: 0, row: 0, col: 0 })
// Actual:   "!R2C3"
// Expected: "R2C3" (Excel behavior, Microsoft 365 desktop)

Excel reference

=ADDRESS(2,3,1,FALSE(),) → R2C3 (Microsoft 365 desktop)

HyperFormula version

3.2.0

Your framework

No response

Your environment

Node.js

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions