#463 : Patch @domic-olga vlookup - incorrect value when not exact match

This commit is contained in:
Progi1984 2016-05-19 14:38:50 +02:00
parent 20d007abb1
commit 6faed3bd58
1 changed files with 6 additions and 2 deletions

View File

@ -720,8 +720,12 @@ class LookupRef
(!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)))) { (!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)))) {
break; break;
} }
$rowNumber = $rowKey; // remember the last key, but only if datatypes match
$rowValue = $rowData[$firstColumn]; if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn])) ||
(!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]))) {
$rowNumber = $rowKey;
$rowValue = $rowData[$firstColumn];
}
} }
if ($rowNumber !== false) { if ($rowNumber !== false) {