Forum Discussion
ds100
Feb 24, 2022Copper Contributor
Cumulative Sum by column for two dimensional dynamic arrays?
Referencing a two dimensional dynamic array, how would I output a running total two dimensional array which calculates cumulative sums by column? Thanks in advance. Daniel
in E3
=MAKEARRAY( ROWS(TodayArray), COLUMNS(TodayArray), LAMBDA(r,c, SUM( INDEX(TodayArray,SEQUENCE(r),c) ) ) )
7 Replies
- LorenzoSilver Contributor
in E3
=MAKEARRAY( ROWS(TodayArray), COLUMNS(TodayArray), LAMBDA(r,c, SUM( INDEX(TodayArray,SEQUENCE(r),c) ) ) )
- Daniel2010Copper Contributor
Can you do it the other way around?
Today Array Running Totals 1 2 1 3 2 4 2 6 3 6 3 9 4 8 4 12 5 10 5 15 The solution is awesome
- LorenzoSilver Contributor
Alternative for Excel 2021 where MAKEARRAY isn't available
in F2:
=SUBTOTAL(9, OFFSET(B2,, SEQUENCE(,COLUMNS(B2:D6),0), SEQUENCE(ROWS(B2:D6)) ) )
in J2:
=SUBTOTAL(9, OFFSET(B2, SEQUENCE(ROWS(B2:D6),,0), ,, SEQUENCE(,COLUMNS(B2:D6)) ) )
- ds100Copper ContributorBrilliant. I'm going to get a lot of use out of that. Thank you
- LorenzoSilver ContributorGlad I could help & you have LAMBDA & Co. + Thanks for providing feedback