i'm building an excel model using dynamic arrays which may expand horizontally or vertically depending on the inputs
Example of the array:
1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 |
I'm trying to calculate the horizontal cumulative sum / running total for each row of an array. I've tried the Scan/Lamda combination explained here: Cumulative Sum Formula using new Excel Dynamic Array Formulas
This leads to a cumulative sum over the complete array, not for each individual row:
1 | 3 | 6 | 10 |
15 | 21 | 28 | 36 |
Is it possible to achieve a cumulative sum for each row? The solution should look like this:
1 | 3 | 6 | 10 |
5 | 11 | 18 | 26 |
Thanks
CodePudding user response:
Why not just employ some simple matrix multiplication?
=LET(ζ,A1:D2,ξ,COLUMNS(ζ),MMULT(ζ,N(SEQUENCE(ξ)<=SEQUENCE(,ξ))))