This closes #2303, support 3D references across sheet ranges#2310
Merged
Conversation
Formulas of the shape SUM(Sheet1:SheetN!A1) failed with
#NAME? invalid reference because parseReference split the
reference on ':' and handed the leading sheet token to parseRef,
which treats it as a cell name. No code path recognised the 3D
shape.
Add parse3DRef / split3DRef / readSheetToken / expand3DSheetRange
ahead of parseReference. On a match the reference is expanded
across the workbook-order sheet range and each sheet's cell or
range is evaluated recursively, yielding a matrix that existing
aggregates (SUM, AVERAGE, MIN, MAX, COUNT, COUNTA, PRODUCT)
consume unchanged. Non-ASCII sheet names work unquoted, e.g.
SUM(Jänner:Dezember!M40), matching Excel's behaviour.
The quoted-name form SUM('A':'B'!ref) is mis-tokenised by
github.com/xuri/efp before parseReference sees it, so it is
tracked separately and not handled here.
Signed-off-by: Christopher Albert <albert@tugraz.at>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2310 +/- ##
=======================================
Coverage 99.60% 99.60%
=======================================
Files 32 32
Lines 26803 26855 +52
=======================================
+ Hits 26697 26749 +52
Misses 55 55
Partials 51 51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
xuri
reviewed
May 22, 2026
Member
xuri
left a comment
There was a problem hiding this comment.
Thanks for your PR. Could you grant sloppy-org:2303-3d-refs-cleanbranch push permission for me? So I can made some code review updates based on your branch.
Contributor
Author
|
@xuri I sent an invite to the fork repo, since this pr based write access doesnt work cross-orga . Cheers! |
xuri
requested changes
May 25, 2026
xuri
requested changes
May 25, 2026
xuri
requested changes
May 25, 2026
1 task
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Formulas of the shape
SUM(Sheet1:SheetN!A1)previously failed with#NAME? invalid referencebecauseparseReferencesplit the reference on:and handed the leading sheet token toparseRef, which treats it as a cell name.This change teaches
parseReferenceto recognise references of the shape<sheet1>:<sheet2>!<ref>, expand them across the workbook-order sheet range, and evaluate each sheet's cell or range recursively. The resulting matrix is consumed unchanged by the existing aggregates (SUM,AVERAGE,MIN,MAX,COUNT,COUNTA,PRODUCT). Non-ASCII unquoted sheet names work too, e.g.SUM(Jänner:Dezember!$M$40).The quoted-name form
SUM('A':'B'!ref)is mis-tokenised bygithub.com/xuri/efpupstream ofparseReferenceand is therefore out of scope here; it is tracked separately in #2309.Related Issue
Partial closer for umbrella #2303; the quoted-form gap is tracked in #2309.
Documentation
Reference-site entries for this PR ship in a companion docs PR: xuri/excelize-doc#31. That PR covers the English version; other language versions follow the project's usual rollout cadence.
Motivation and Context
Workbooks with 3D aggregate totals (e.g. annual summaries across monthly sheets) currently cannot be recalculated through excelize — every such formula resolves to
#NAME?. This is the narrowest fix that removes that failure without touching other code paths.How Has This Been Tested
go test -skip TestZip64 -timeout 10m .passes cleanly.gofmt -s -l .andgo vet ./...are clean. ARM cross-builds from.github/workflows/go.yml(GOARM=5|6|7,arm64,android/arm64) all build.TestCalc3DRefis table-driven and covers single-cell, range, degenerate single-sheet, multi-column, reversed range (#REF!), and missing sheet cases across all seven aggregates listed above. The non-ASCII sub-test coversJänner:Dezember.Types of changes
Checklist