Skip to content

Add positional helpers to maps library (CELLDIST, ADDRESSES, ROW/COL helpers)#186

Merged
jimmytacks merged 1 commit into
mainfrom
lambda-positional-helpers
May 20, 2026
Merged

Add positional helpers to maps library (CELLDIST, ADDRESSES, ROW/COL helpers)#186
jimmytacks merged 1 commit into
mainfrom
lambda-positional-helpers

Conversation

@jimmytacks
Copy link
Copy Markdown
Collaborator

@jimmytacks jimmytacks commented May 20, 2026

Summary

Six small Maps lambdas covering the address ↔ position conversion graph and grid distance:

  • CELLDIST(cell1, cell2, [metric]) — Manhattan (0, default), Chebyshev (1), or Euclidean (2) distance between two A1 addresses. Pure-arithmetic body so Excel broadcasting handles both same-shape zip and column × row cartesian inputs naturally.
  • ADDRESSES(cells) — range reference → A1 strings, shape-preserving. Closes the gap where downstream lambdas want string addresses but the caller has a reference.
  • ROWOF / COLOF — extract row/col from a CELLTOPOS-encoded position, with optional [mult] matching the CELLTOPOS / POSTOCELL convention.
  • ROWNUM / COLNUM — row/col from A1 address text, like ROW() / COLUMN() but accepting strings. Composed on top of CELLTOPOS so address-parsing edge cases (sheet prefix, $, ranges, case-insensitive, multi-letter cols up to XFD) are inherited.

Together with the existing CELLTOPOS / POSTOCELL, this completes the three-way conversion graph between A1 text, (row, col), and encoded position.

Closes #182
Closes #183
Closes #185

Test plan

  • Format validation: 424 tests pass
  • Harness functional tests: all 452 tests pass (includes new ROWOF/COLOF/ROWNUM/COLNUM/ADDRESSES/CELLDIST coverage with scalar, array-lift, sheet-prefix, $-anchor, cell-reference, and cartesian-broadcast cases)
  • Spot-check in Excel: try =CELLDIST("F28", "G26") → 3, =CELLDIST({"A1";"B2"}, {"C3","D4"}) → 2×2 grid, =ADDRESSES(F28:H30) → 3×3 of strings, =ROWNUM("AA17") → 17, =COLNUM("XFD1") → 16384

🤖 Generated with Claude Code

…OLOF, ROWNUM/COLNUM

Six small Maps lambdas covering address-to-position conversions and grid distance:

- CELLDIST(cell1, cell2, [metric]) — Manhattan (0, default), Chebyshev (1),
  or Euclidean (2) distance between two A1 addresses. Pure-arithmetic body
  so Excel broadcasting handles both same-shape zip and column x row
  cartesian inputs naturally.
- ADDRESSES(cells) — range reference -> A1 strings, shape-preserving via
  ADDRESS(ROW, COLUMN, 4). Closes the gap where a downstream lambda wants
  string addresses but the caller has a reference.
- ROWOF / COLOF — extract row/col from CELLTOPOS-encoded position, with
  optional [mult] matching CELLTOPOS / POSTOCELL convention.
- ROWNUM / COLNUM — row/col from A1 address text. Composed on top of
  CELLTOPOS so address-parsing edge cases (sheet prefix, $, ranges,
  case-insensitive, multi-letter cols up to XFD) are inherited for free.

Closes #182, closes #183, closes #185.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jimmytacks jimmytacks merged commit c6fad07 into main May 20, 2026
1 check passed
@jimmytacks jimmytacks deleted the lambda-positional-helpers branch May 20, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LAMBDA idea: Position & address helpers (ROWOF, COLOF, ROWNUM, COLNUM) LAMBDA idea: ADDRESSES LAMBDA idea: CELLDIST

1 participant