To achieve the result you’re looking for, you can use BYROW
to supply the argument once per array:
=BYROW({1;5},LAMBDA(row,INDEX(A2:B16,row,2)))
BYROW
sends the array argument provided once per row to the function inside LAMBDA
. As a general formula,
=BYROW(range, LAMBDA(row, your_formula(row)))
If you want to send two arguments, use MAP
instead.
=MAP({1;5},{1;2},LAMBDA(arr_1,arr_2,INDEX(A2:B16,arr_1,arr_2)))
This will get row 1, column 1 and row 5, column 2 respectively.
Actual output |
---|
1 |
E |
MAP
supports unlimited number of arguments and therefore can be used with complex formulas.
Caveat: Only one value per function can be returned. If you want to return more values, use SPLIT/TRANSPOSE/SPLIT
technique mentioned here