Forum Discussion
Formula to aggregate matrix spilling both rows and columns
- Feb 21, 2022
diegol81 , you are welcome.
For data only it's simpler
uHeader = UNIQUE(header, 1); uLabels = UNIQUE(labels); onlyData= MAKEARRAY( ROWS(ulabels), COLUMNS(uHeader), LAMBDA( r, c, SUM( FILTER( FILTER( data, (labels=INDEX(uLabels, r)) ), header=INDEX(uHeader, c) ) ) ) );
IMHO, that's no straightforward solution. As variant you may use AFE Announcing LAMBDAs to Production and Advanced Formula Environment, A Microsoft Garage Project, collect your functions in hidden sheet of some file and use it as template.
Thanks for that. Unfortunately the new AFE addin (actually, all the addins accessible via the Insert | Addins | Get addins dialog) download and install seems to have been disabled globally in my company. Hopefully I'll get the admins to enable it.
Back to my last post: shortly after positing I realised my solution did not fully resemble the functional structure I was seeking, which is akin to that of a SUMIFS: a data array to add-up; a labels vector to evaluate; a labels condition vector; a (transposed) headers vector to evaluate; a (transposed) headers condition vector. I was missing the two condition arguments, which impaired the formula's functionality.
As a result of this review, the LET() call was no longer needed and I renamed the formula SpillSumIfs. Here it goes, hopefully for good.
- SergeiBaklanMar 26, 2022Diamond Contributor
That's good, thanks for sharing