a5a0268050
Fixes a bug when doing a HLOOKUP on a single row. ```php <?php require 'vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\Spreadsheet; $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); /** * Single row. */ $singleRow = "=HLOOKUP(10, {5, 10, 15}, 1, 0)"; $sheet->getCell('A1')->setValue($singleRow); // Should echo 10, but echos '#N/A' and some PHP notices and warnings. echo $sheet->getCell('A1')->getCalculatedValue() . PHP_EOL; /** * Multiple rows. */ $multipleRows = "=HLOOKUP(10, {5, 10, 15; 20, 25, 30}, 1, 0)"; $sheet->getCell('A2')->setValue($multipleRows); // Should echo: 10 and also does. echo $sheet->getCell('A2')->getCalculatedValue() . PHP_EOL; ``` Co-authored-by: Mark Baker <mark@lange.demon.co.uk>
312 lines
5.5 KiB
PHP
312 lines
5.5 KiB
PHP
<?php
|
|
|
|
return [
|
|
[
|
|
16.800000000000001,
|
|
10251,
|
|
[
|
|
[
|
|
'Order ID',
|
|
10247,
|
|
10249,
|
|
10250,
|
|
10251,
|
|
10252,
|
|
10253,
|
|
],
|
|
[
|
|
'Unit Price',
|
|
14.0,
|
|
18.600000000000001,
|
|
7.7000000000000002,
|
|
16.800000000000001,
|
|
16.800000000000001,
|
|
64.799999999999997,
|
|
],
|
|
[
|
|
'Quantity',
|
|
12,
|
|
9,
|
|
10,
|
|
6,
|
|
20,
|
|
40,
|
|
],
|
|
],
|
|
2,
|
|
false,
|
|
],
|
|
[
|
|
6.0,
|
|
10251,
|
|
[
|
|
[
|
|
'Order ID',
|
|
10247,
|
|
10249,
|
|
10250,
|
|
10251,
|
|
10252,
|
|
10253,
|
|
],
|
|
[
|
|
'Unit Price',
|
|
14.0,
|
|
18.600000000000001,
|
|
7.7000000000000002,
|
|
16.800000000000001,
|
|
16.800000000000001,
|
|
64.799999999999997,
|
|
],
|
|
[
|
|
'Quantity',
|
|
12,
|
|
9,
|
|
10,
|
|
6,
|
|
20,
|
|
40,
|
|
],
|
|
],
|
|
3,
|
|
false,
|
|
],
|
|
[
|
|
'#N/A',
|
|
10248,
|
|
[
|
|
[
|
|
'Order ID',
|
|
10247,
|
|
10249,
|
|
10250,
|
|
10251,
|
|
10252,
|
|
10253,
|
|
],
|
|
[
|
|
'Unit Price',
|
|
14.0,
|
|
18.600000000000001,
|
|
7.7000000000000002,
|
|
16.800000000000001,
|
|
16.800000000000001,
|
|
64.799999999999997,
|
|
],
|
|
[
|
|
'Quantity',
|
|
12,
|
|
9,
|
|
10,
|
|
6,
|
|
20,
|
|
40,
|
|
],
|
|
],
|
|
2,
|
|
false,
|
|
],
|
|
[
|
|
14.0,
|
|
10248,
|
|
[
|
|
[
|
|
'Order ID',
|
|
10247,
|
|
10249,
|
|
10250,
|
|
10251,
|
|
10252,
|
|
10253,
|
|
],
|
|
[
|
|
'Unit Price',
|
|
14.0,
|
|
18.600000000000001,
|
|
7.7000000000000002,
|
|
16.800000000000001,
|
|
16.800000000000001,
|
|
64.799999999999997,
|
|
],
|
|
[
|
|
'Quantity',
|
|
12,
|
|
9,
|
|
10,
|
|
6,
|
|
20,
|
|
40,
|
|
],
|
|
],
|
|
2,
|
|
true,
|
|
],
|
|
[
|
|
4,
|
|
'Axles',
|
|
[
|
|
[
|
|
'Axles',
|
|
'Bearings',
|
|
'Bolts',
|
|
],
|
|
[
|
|
4,
|
|
4,
|
|
9,
|
|
],
|
|
[
|
|
5,
|
|
7,
|
|
10,
|
|
],
|
|
[
|
|
6,
|
|
8,
|
|
11,
|
|
],
|
|
],
|
|
2,
|
|
true,
|
|
],
|
|
[
|
|
7,
|
|
'Bearings',
|
|
[
|
|
[
|
|
'Axles',
|
|
'Bearings',
|
|
'Bolts',
|
|
],
|
|
[
|
|
4,
|
|
4,
|
|
9,
|
|
],
|
|
[
|
|
5,
|
|
7,
|
|
10,
|
|
],
|
|
[
|
|
6,
|
|
8,
|
|
11,
|
|
],
|
|
],
|
|
3,
|
|
false,
|
|
],
|
|
[
|
|
5,
|
|
'B',
|
|
[
|
|
[
|
|
'Axles',
|
|
'Bearings',
|
|
'Bolts',
|
|
],
|
|
[
|
|
4,
|
|
4,
|
|
9,
|
|
],
|
|
[
|
|
5,
|
|
7,
|
|
10,
|
|
],
|
|
[
|
|
6,
|
|
8,
|
|
11,
|
|
],
|
|
],
|
|
3,
|
|
true,
|
|
],
|
|
[
|
|
11,
|
|
'Bolts',
|
|
[
|
|
[
|
|
'Axles',
|
|
'Bearings',
|
|
'Bolts',
|
|
],
|
|
[
|
|
4,
|
|
4,
|
|
9,
|
|
],
|
|
[
|
|
5,
|
|
7,
|
|
10,
|
|
],
|
|
[
|
|
6,
|
|
8,
|
|
11,
|
|
],
|
|
],
|
|
4,
|
|
],
|
|
[
|
|
'c',
|
|
3,
|
|
[
|
|
[
|
|
1,
|
|
2,
|
|
3,
|
|
],
|
|
[
|
|
'a',
|
|
'b',
|
|
'c',
|
|
],
|
|
[
|
|
'd',
|
|
'e',
|
|
'f',
|
|
],
|
|
],
|
|
2,
|
|
true,
|
|
],
|
|
[
|
|
3,
|
|
3,
|
|
[
|
|
[
|
|
1,
|
|
2,
|
|
3,
|
|
],
|
|
],
|
|
1,
|
|
true,
|
|
],
|
|
[
|
|
5,
|
|
'x',
|
|
[
|
|
['Selection column', '0', '0', '0', '0', 'x', 'x', 'x', 'x', 'x'],
|
|
['Value to retrieve', 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
],
|
|
2,
|
|
false,
|
|
],
|
|
[
|
|
2,
|
|
'B',
|
|
[
|
|
['Selection column', 'C', 'B', 'A'],
|
|
['Value to retrieve', 3, 2, 1],
|
|
],
|
|
2,
|
|
false,
|
|
],
|
|
];
|