Forum Discussion
Looking for Cumulative Sum Formula that returns Dynamic Arrays (i.e. spill-able)
You may try this :
=SUM(INDEX(Mydata,1,1):INDEX(Mydata,ROW()-ROW(INDEX(Mydata,1,1))+1))
- Formula in cell S86, fill it down:
N.B. Replace Mydata (is Named Range) with the NAME you have given to the RANGE.
Hello,
Thanks for looking at my post. But unfortunately, this formula does not spill.
Making it spillable is what makes this particular formula exercise tricky 😞
I'm not sure if there is a good way to do this without using Lambda (which I currently do not have an access for)
- Rajesh_SinhaMay 01, 2021Iron ContributorPlease share some sample data along with the expected output,,, otherwise what I've suggested & by SergeiBaklan are working for Cumulative Sum as you have mentioned with the post !!
- SergeiBaklanApr 30, 2021Diamond Contributor
It is spill, please check attached. If you change spill in B2 formula follows it.
If you may do something without lamdas, do it. Lambdas in Excel are at very beginning, if you do something using them now, in few months most probably it could be done much easier. Also with lambdas. IMHO, using lambdas now is only to train the brains and be prepared to future Excel.
- mlylylyOct 21, 2022Copper Contributor
This is a great solution!
Sorry to ask additional questions in an old thread but is there a solution where the Dynamic Array (spill) is included in the cumulative sum formula?
My spill formula is P4=INDEX(SORTBY(B4:C8,B4:B8,1),,2), where the cumulative formula is
=LET(s, P4#, k, SEQUENCE(ROWS(s)), SUBTOTAL(9,OFFSET(s,0,0,k)))
However, I would like to have a formula corresponding to
LET(s, INDEX(SORTBY(B4:C8,B4:B8,1),,2), k, SEQUENCE(ROWS(s)), SUBTOTAL(9,OFFSET(s,0,0,k)))
This does not work because the OFFSET() does not reference a cell - is there a way to solve this?
Thanks a lot!
- SergeiBaklanOct 21, 2022Diamond Contributor
- PapaAustinApr 30, 2021Copper Contributor
Hello Sergei,
I was replying to another commenter (his solution was using Sum(index... :index) approach which does not spill.
Yours look like it would spill as you pointed out.
I do not have an access to the latest O365 update with Let and Lambda features (I'm on an enterprise license and probably won't have those features until much later); I tried your file but it gives me #name error because my Excel doesn't know what Let() is.
So far, i have found this approach; it is rather a lengthy formula but it works.
=TRANSPOSE(MMULT(
(COLUMN(MyRange) <= TRANSPOSE(COLUMN(MyRange)))*MyRange,
TRANSPOSE(SIGN(MyRange))
))- Detlef_LewinApr 30, 2021Silver Contributor