diff --git a/src/PhpSpreadsheet/Calculation/LookupRef.php b/src/PhpSpreadsheet/Calculation/LookupRef.php index e6b0f3203f..f2d22c0023 100644 --- a/src/PhpSpreadsheet/Calculation/LookupRef.php +++ b/src/PhpSpreadsheet/Calculation/LookupRef.php @@ -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; }