You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [x] a bug report
- [ ] a feature request
- [x] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
Expected behaviour: Sheet1 looks like this after "getCalculatedValue()" for each cell:
KEY1 | Value1
KEY2 | Value2
What is the current behavior?
KEY1 | Value1
KEY2 | #N/A
What might be the cause of the problem?
The _parseFormula() method in Calculation.php parses the VLOOKUP above into tokens. The A:D reference is changed to become A1:D2.
To calculate the "2" the parser uses $pCellParent->getHighestRow(). BUT: The $pCellParent is the parent of the cell where the formula (VLOOKUP) is inside ("Sheet1"). Actually, it SHOULD get the highest row from the sheet referenced in the formula which is Sheet2, and Sheet2 has 4 lines. Thus, the output should be A1:D4 instead of A1:D2.
My current "quick & dirty" fix. Changing from line 3668:
This is:
What is the expected behavior?
2 Sheets:
"Sheet1" with 2 cols:
KEY1 | =VLOOKUP(A1;Sheet2!A:B;2;0)
KEY2 | =VLOOKUP(A2;Sheet2!A:B;2;0)
"Sheet2" with 2 cols:
KEY0 | Value0
KEY1 | Value1
KEY2 | Value2
KEY3 | Value3
Expected behaviour: Sheet1 looks like this after "getCalculatedValue()" for each cell:
KEY1 | Value1
KEY2 | Value2
What is the current behavior?
KEY1 | Value1
KEY2 | #N/A
What might be the cause of the problem?
The
_parseFormula()
method inCalculation.php
parses the VLOOKUP above into tokens. The A:D reference is changed to become A1:D2.To calculate the "2" the parser uses
$pCellParent->getHighestRow()
. BUT: The $pCellParent is the parent of the cell where the formula (VLOOKUP) is inside ("Sheet1"). Actually, it SHOULD get the highest row from the sheet referenced in the formula which is Sheet2, and Sheet2 has 4 lines. Thus, the output should be A1:D4 instead of A1:D2.My current "quick & dirty" fix. Changing from line 3668:
to:
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?
1.9.0
The text was updated successfully, but these errors were encountered: