2016-08-16 12:00:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
return [
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
16.800000000000001,
|
2016-08-16 12:00:19 +00:00
|
|
|
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,
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
6.0,
|
2016-08-16 12:00:19 +00:00
|
|
|
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,
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'#N/A',
|
2016-08-16 12:00:19 +00:00
|
|
|
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,
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
14.0,
|
2016-08-16 12:00:19 +00:00
|
|
|
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,
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
4,
|
2016-08-16 12:00:19 +00:00
|
|
|
'Axles',
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'Axles',
|
|
|
|
'Bearings',
|
|
|
|
'Bolts',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
4,
|
|
|
|
4,
|
|
|
|
9,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
5,
|
|
|
|
7,
|
|
|
|
10,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
6,
|
|
|
|
8,
|
|
|
|
11,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
2,
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
7,
|
2016-08-16 12:00:19 +00:00
|
|
|
'Bearings',
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'Axles',
|
|
|
|
'Bearings',
|
|
|
|
'Bolts',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
4,
|
|
|
|
4,
|
|
|
|
9,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
5,
|
|
|
|
7,
|
|
|
|
10,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
6,
|
|
|
|
8,
|
|
|
|
11,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
3,
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
5,
|
2016-08-16 12:00:19 +00:00
|
|
|
'B',
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'Axles',
|
|
|
|
'Bearings',
|
|
|
|
'Bolts',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
4,
|
|
|
|
4,
|
|
|
|
9,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
5,
|
|
|
|
7,
|
|
|
|
10,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
6,
|
|
|
|
8,
|
|
|
|
11,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
3,
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
11,
|
2016-08-16 12:00:19 +00:00
|
|
|
'Bolts',
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'Axles',
|
|
|
|
'Bearings',
|
|
|
|
'Bolts',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
4,
|
|
|
|
4,
|
|
|
|
9,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
5,
|
|
|
|
7,
|
|
|
|
10,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
6,
|
|
|
|
8,
|
|
|
|
11,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
4,
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'c',
|
2016-08-16 12:00:19 +00:00
|
|
|
3,
|
|
|
|
[
|
|
|
|
[
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'a',
|
|
|
|
'b',
|
|
|
|
'c',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'd',
|
|
|
|
'e',
|
|
|
|
'f',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
2,
|
|
|
|
true,
|
|
|
|
],
|
Fix HLOOKUP on single row (#1512)
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>
2020-06-19 19:06:41 +00:00
|
|
|
[
|
|
|
|
3,
|
|
|
|
3,
|
|
|
|
[
|
|
|
|
[
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
1,
|
|
|
|
true,
|
|
|
|
],
|
2018-12-10 15:12:51 +00:00
|
|
|
[
|
|
|
|
5,
|
|
|
|
'x',
|
|
|
|
[
|
|
|
|
['Selection column', '0', '0', '0', '0', 'x', 'x', 'x', 'x', 'x'],
|
2020-05-18 04:49:57 +00:00
|
|
|
['Value to retrieve', 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
2018-12-10 15:12:51 +00:00
|
|
|
],
|
|
|
|
2,
|
2020-05-18 04:49:57 +00:00
|
|
|
false,
|
2019-07-14 10:56:17 +00:00
|
|
|
],
|
|
|
|
[
|
|
|
|
2,
|
|
|
|
'B',
|
|
|
|
[
|
|
|
|
['Selection column', 'C', 'B', 'A'],
|
2020-05-18 04:49:57 +00:00
|
|
|
['Value to retrieve', 3, 2, 1],
|
2019-07-14 10:56:17 +00:00
|
|
|
],
|
|
|
|
2,
|
2020-05-18 04:49:57 +00:00
|
|
|
false,
|
2019-07-14 10:56:17 +00:00
|
|
|
],
|
2016-08-16 12:00:19 +00:00
|
|
|
];
|