Commit Graph

6 Commits

Author SHA1 Message Date
Arne Jørgensen a5a0268050
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 21:06:41 +02:00
Adrien Crivelli fcd9f10663
Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
Juluan 7505638dc8 Fix 1055 (#1076)
* Fix #1055 : Make hlookup require ordered list only if asking for not exact match

* Added test for #1055
2019-07-14 12:56:17 +02:00
Fräntz Miccoli 294ba58dde
Exact match in VLOOKUP now returns first match
It was inconsistent with spreadsheet software before.

Closes #809
2018-12-15 17:42:07 +11:00
Adrien Crivelli 8dddf56c2e
Use proper syntax for variadic functions
This simplify code, increase readability and improve the function
signature for API users.
2017-01-23 15:01:20 +09:00
Adrien Crivelli e1f81f0fe0
Refactor tests data from custom format to PHP
FIX #14
2016-08-16 21:00:19 +09:00