Skip to content

Commit

Permalink
Fix PHPOffice#1055 : Make hlookup require ordered list only if asking…
Browse files Browse the repository at this point in the history
… for not exact match
  • Loading branch information
jtattevin committed Jul 4, 2019
1 parent d4eab49 commit 3e41ddf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/PhpSpreadsheet/Calculation/LookupRef.php
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,10 @@ public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not
$lookupLower = StringHelper::strToLower($lookup_value);
$rowDataLower = StringHelper::strToLower($rowData);

if (($bothNumeric && $rowData > $lookup_value) ||
($bothNotNumeric && $rowDataLower > $lookupLower)) {
if ($not_exact_match && (
($bothNumeric && $rowData > $lookup_value) ||
($bothNotNumeric && $rowDataLower > $lookupLower)
)) {
break;
}

Expand Down

0 comments on commit 3e41ddf

Please sign in to comment.