INDEX(): fix getting row and col numbers from references (#239)
Allow to use cell references as row and column in function INDEX(). Eg: ``` =INDEX(A1:B5, A9) ```
This commit is contained in:
parent
088a76737e
commit
4b4bac53aa
|
@ -601,6 +601,9 @@ class LookupRef
|
|||
*/
|
||||
public static function INDEX($arrayValues, $rowNum = 0, $columnNum = 0)
|
||||
{
|
||||
$rowNum = Functions::flattenSingleValue($rowNum);
|
||||
$columnNum = Functions::flattenSingleValue($columnNum);
|
||||
|
||||
if (($rowNum < 0) || ($columnNum < 0)) {
|
||||
return Functions::VALUE();
|
||||
}
|
||||
|
|
|
@ -73,4 +73,18 @@ return [
|
|||
2,
|
||||
2,
|
||||
],
|
||||
[
|
||||
4, // Expected
|
||||
// Input
|
||||
[
|
||||
'20' => ['R' => 1, 'S' => 3],
|
||||
'21' => ['R' => 2, 'S' => 4],
|
||||
],
|
||||
[
|
||||
'21' => ['R' => 2],
|
||||
],
|
||||
[
|
||||
'21' => ['R' => 2],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue