Forum Discussion
Getting multiple values against unique names...
- Oct 04, 2022
The steps to tidy the formula up are insanely complicated for such a simple task (or maybe it's just me getting senile!). To use any built-in function within a helper function, the built-in function needs to be wrapped as a Lambda function.
That is OK,
Filterλ
= LAMBDA(arr, crit,
LAMBDA(acc,n,
VSTACK(acc, TRANSPOSE(FILTER(arr, crit=n)))
)
);but the presence of VSTACK suggests that all is not well. Next, the REDUCE element of the formula needs to be wrapped in a further Lambda function to hide the complexity. The intent of the REDUCE/VSTACK combination is to perform a MAP operation without triggering the 'nested arrays' error. The worksheet formula is now
Mapλ
= LAMBDA(name, Fnλ,
REDUCE(hdr, name, Fnλ)
);The other trick is that the partially satisfied Filterλ Lambda function (itself a Lambda function is passed as a parameter to Mapλ, giving a final form for the worksheet function,
= LET(
array, Mapλ(UNIQUE(Table1[Name]), Filterλ(Table1[Value], Table1[Name])),
IFERROR(DROP(array,1),"")
)which is far more complicated than it should be.
- PeterBartholomew1Oct 04, 2022Silver ContributorIf you have access to Excel 365 we could set you on your way far more gently than this! The new functionality is remarkable but I can well understand your hesitation.