Forum Discussion
PeterBartholomew1
Sep 01, 2021Silver Contributor
A statement of truth or a wasted opportunity. Lambda helper functions reluctant to return 2D arrays.
I remember JoeMcDaid stating that 2D arrays are the only data types held in Excel; rows columns and scalars are merely special cases with the last being a 1x1 array. So why is it such a proble...
PeterBartholomew1
Sep 18, 2021Silver Contributor
I got some advice concerning the original 'array of arrays' problem. Essentially the advice was 'rather than trying to create arrays of arrays, reduce the array to 'thunks', which can be handled as scalars and evaluated at the end using MAKEARRAY. In the event, I didn't even need to do that because I was already working with Lambda functions (team name as the parameter) which evaluated correctly.
= LET(
teamList, UNIQUE(team),
teamScore, MAP(teamList, SCOREλ),
teamOrder, SORTBY(teamList, teamScore),
result, MAKEARRAY(COUNTA(teamList), 4,
LAMBDA(t,p,INDEX(MEMBERSλ(INDEX(teamOrder,t)), p))
),
IFERROR(result, ""))tboulden
Sep 18, 2021Iron Contributor
That's a nice clean construction that encapsulates our journey from your original post!!