HLOOKUP check on the count of the rows, not columns

We must check on the count of the rows (`row_index_num` and not
`col_index_num` as in VLOOKUP) and not on the columns.

https://support.office.com/en-us/article/HLOOKUP-function-a3034eec-b719-4ba3-bb65-e1ad662ed95f

Fixes https://github.com/PHPOffice/PHPExcel/issues/1339
This commit is contained in:
Adrien Crivelli 2017-10-26 23:02:53 +09:00
parent 25ff914aa6
commit a093a468d1
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
1 changed files with 1 additions and 1 deletions

View File

@ -789,7 +789,7 @@ class LookupRef
} }
$f = array_keys($lookup_array); $f = array_keys($lookup_array);
$firstRow = array_pop($f); $firstRow = array_pop($f);
if ((!is_array($lookup_array[$firstRow])) || ($index_number - 1 > count($lookup_array[$firstRow]))) { if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array))) {
return Functions::REF(); return Functions::REF();
} }
$columnKeys = array_keys($lookup_array[$firstRow]); $columnKeys = array_keys($lookup_array[$firstRow]);