-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to calculate values of formulas using combined named ranges #2730
Comments
I wasn't even aware that it was possible to use the The calculation engine expects a cell reference, row reference or column reference on each side of the So there isn't going to be any quick fix for this. It means a fairly significant amount of code change to the Calculation Engine; and it will need a lot of testing, particularly for edge cases (e.g. if you had |
From my testing inside Excel (version 2203 build 15028.20160) it seems that it evaluates to a range/box that encompases all of the ranges/cells inside. In the image below, if the yellow cell, blue cell, and orange cell range are present. It will evaluate down to the selection box. with named ranges of:
range evaluations
mixed cells/range evaluations
three (or more) cells/ranges evaluations
So the bounding box range is |
Useful to know, thanks. I'll try and do some experimenting over the weekend, or see if I can track down any Microsoft documentation that can confirm your observations. I'll also double check the union and intersection operators when using named ranges (although I'm reasonably sure that they already work as expected). |
A little experimentation tells me that it isn't just named ranges either: the range operator can be chained - I don't know if there's any limit to the chaining; but it will definitely be a while before I figure out how to implement it in the Calculation Engine. |
This is:
What is the expected behavior?
That combining ranges (ie;
firstRange:secondRange
) would evaluate down to a single usable range like Excel does.What is the current behavior?
When running
getCalculatedValue()
against a formula field with a single named range such as=VLOOKUP(A2,myRange,2)
PhpSpreadsheet has no issue getting the calculated value.When running
getCalculatedValue()
against a formula field with combination named ranges such as=VLOOKUP(A2,rateKeys:rateValues,2)
PhpSpreadsheet throws an error likeExample!C2 -> Invalid cell coordinate rateKeys
.What are the steps to reproduce?
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
Which versions of PhpSpreadsheet and PHP are affected?
PHP 8.0.13
PhpSpreadsheet 1.22.0
File to reproduce
example.xlsx
The text was updated successfully, but these errors were encountered: