PhpSpreadsheet/tests/data/Calculation/LookupRef
oleibman c79a9a8e21
Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004)
* Improved Support for INDIRECT, ROW, and COLUMN Functions

This should address issues #1913 and #1993. INDIRECT had heretofore not supported an optional parameter intended to support addresses in R1C1 format which was introduced with Excel 2010. It also had not supported the use of defined names as an argument. This PR is a replacement for #1995, which is currently in draft status and which I will close in a day or two.

The ROW and COLUMN functions also should support defined names. I have added that, and test cases, with the latest push. ROWS and COLUMNS already supported it correctly, but there had been no test cases. Because ROW and COLUMN can return arrays, and PhpSpreadsheet does not support dynamic arrays, I left the existing direct-call tests unchanged to demonstrate those capabilities.

The unit tests for INDIRECT had used mocking, and were sorely lacking (tested only error conditions). They have been replaced with normal, and hopefully adequate, tests. This includes testing globally defined names, as well as locally defined names, both in and out of scope.

The test case in 1913 was too complicated for me to add as a unit test. The main impediments to it are now removed, and its complex situation will, I hope, be corrected with this fix.

INDIRECT can also support a reference of the form Sheetname!localName when localName on its own would be out of scope. That functionality is added. It is also added, in theory, for ROW and COLUMN, however such a construction is rejected by the Calculation engine before passing control to ROW or COLUMN. It might be possible to change the engine to allow this, and I may want to look into that later, but it seems much too risky, and not nearly useful enough, to attempt to address that as part of this change.

Several unusual test cases (leading equals sign, not-quite-as-expected name definition in file, complex indirection involving concatenation and a dropdown list) were suggested by @MarkBaker and are included in this request.
2021-04-20 22:16:21 +02:00
..
ADDRESS.php Start refactoring the Lookup and Reference functions (#1912) 2021-03-10 21:18:33 +01:00
CHOOSE.php Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
COLUMN.php Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004) 2021-04-20 22:16:21 +02:00
COLUMNS.php COLUMNS and ROWS functions crashed in some cases 2018-01-13 18:01:50 +09:00
COLUMNSonSpreadsheet.php Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004) 2021-04-20 22:16:21 +02:00
COLUMNonSpreadsheet.php Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004) 2021-04-20 22:16:21 +02:00
FORMULATEXT.php Fix for worksheet lookup for worksheets with spaces in the title 2019-07-24 22:15:35 -07:00
HLOOKUP.php Start refactoring the Lookup and Reference functions (#1912) 2021-03-10 21:18:33 +01:00
INDEX.php Lookup ref further tests and examples (#1918) 2021-03-11 22:34:47 +01:00
INDIRECT.php Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004) 2021-04-20 22:16:21 +02:00
IndirectDefinedName.xlsx Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004) 2021-04-20 22:16:21 +02:00
IndirectFormulaSelection.xlsx Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004) 2021-04-20 22:16:21 +02:00
LOOKUP.php Start refactoring the Lookup and Reference functions (#1912) 2021-03-10 21:18:33 +01:00
MATCH.php Replace manual wildcard logic in MATCH() function with the new WildcardMatch methods (#1919) 2021-03-12 18:23:15 +01:00
OFFSET.php First step extracting INDIRECT() and OFFSET() to their own classes (#1921) 2021-03-14 19:58:10 +01:00
ROW.php Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004) 2021-04-20 22:16:21 +02:00
ROWS.php COLUMNS and ROWS functions crashed in some cases 2018-01-13 18:01:50 +09:00
ROWSonSpreadsheet.php Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004) 2021-04-20 22:16:21 +02:00
ROWonSpreadsheet.php Improved Support for INDIRECT, ROW, and COLUMN Functions (#2004) 2021-04-20 22:16:21 +02:00
TRANSPOSE.php Start refactoring the Lookup and Reference functions (#1912) 2021-03-10 21:18:33 +01:00
VLOOKUP.php Start refactoring the Lookup and Reference functions (#1912) 2021-03-10 21:18:33 +01:00