Are references captured by LAMBDA converted to arrays?

Copper Contributor

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
To answer my second question, wrapping in VSTACK seems to do the trick.

@JamesDuley 

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)))())
That 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.
CHOOSEROWS seems to calculate a bit faster than INDEX, too.