-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Description
Consider the following code:
$sheet->getCell('A1')->setValue(5);
$sheet->getCell('B1')->setValue(2);
$sheet->getCell('B2')->setValue(4);
$sheet->getCell('B3')->setValue(6);
$sheet->getCell('B4')->setValue(8);
$sheet->getCell('B5')->setValue(10);
$sheet->getCell('B6')->setValue(12);
$sheet->getCell('C1')->setValue('=SUM(B1:INDIRECT("B"&A1))');
var_dump($sheet->getCell('C1')->getCalculatedValue());
$sheet->getCell('D1')->setValue(3);
$sheet->getCell('D2')->setValue(6);
$sheet->getCell('D3')->setValue(9);
$sheet->getCell('D4')->setValue(12);
$sheet->getCell('E1')->setValue('=SUM(D1:INDIRECT("D"&A1))');
var_dump($sheet->getCell('E1')->getCalculatedValue());
The formula in C1 resolves to =SUM(B1:B5)
, and is correctly evaluated as 30
.
The formula in E1 should resolve to =SUM(D1:D5)
, however it is incorrectly evaluated as 3
rather than 30
. It appears that the Calculation Engine is evaluating it as =SUM(D1:D1)
. The difference between this and the previous example appears to be that B5
exists in the first case, but D5
does not in the second.
I have used the Calculation debugger to try to see what's going wrong in the second case, but haven't yet reached any satisfactory conclusion.
This issue is a secondary problem for issue #4528.
Metadata
Metadata
Assignees
Labels
No labels