Forum Discussion
JamesDuley
Nov 16, 2022Copper Contributor
Are references captured by LAMBDA converted to arrays?
Given the following formula, I expected both types to be the same, but I get "1 vs 64", what's going on here?
=LET(array, A1:A5,
TYPE(INDEX(array,1,0))
&
" vs "
&
LAMBDA(TYPE(INDEX(array,1,0)))()
)
Are references captured by LAMBDA converted to arrays?
If so, is there a way I can force the first to be converted to an array too?
4 Replies
Sort By
- Patrick2788Silver Contributor
The INDEX is returning a scalar so TYPE returns a 1.
This might work:
=LET(array, A1:A5,TYPE(array)&" vs "&LAMBDA(TYPE(INDEX(array,1,0)))())
- JamesDuleyCopper ContributorThat does make the types the same but doesn't select the first row like I need.
I've now found that using CHOOSEROWS instead of INDEX always returns an array whether the input is a reference or not.- Patrick2788Silver ContributorCHOOSEROWS seems to calculate a bit faster than INDEX, too.
- JamesDuleyCopper ContributorTo answer my second question, wrapping in VSTACK seems to do the trick.