There is a check if $index_number is greater than the number of rows and fail if it's greater. Now due to copy pasting (I think) of the VLOOKUP function there is a check on the count of the COLUMNS and not ROWS:
Original:
$index_number > count($lookup_array[$firstRow])
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. So by changing the code to this, it works:
There's a bug in the HLOOKUP function.
There is a check if $index_number is greater than the number of rows and fail if it's greater. Now due to copy pasting (I think) of the VLOOKUP function there is a check on the count of the COLUMNS and not ROWS:
Original:
We must check on the count of the rows (
row_index_num
and notcol_index_num
as in VLOOKUP) and not on the columns. So by changing the code to this, it works:Full line: https://github.com/PHPOffice/PHPExcel/blob/185bf412339526c97a98d959c3c0ecf4b7c80016/Classes/PHPExcel/Calculation/LookupRef.php#L774
must be this: