简体   繁体   中英

can I reference the results of an ArrayFormula recursively in Google Sheets?

Say I have a table of indeterminate height, with numerical values in Columns A & B:

A B C
1 73 23
2 11 58
3 ... ...

If I wanted to calculate the sum of A+B for each row, I could populate all of the results with one formula: =ArrayFormula(A:A+B:B) .

I want to do something similar, but instead of adding A1 to B1 to find C1 , I want to add C1 + B2 to find C2 .

I'm wondering if it is possible for ArrayFormula to self-referentially, so I can use the previous result in the next iteration of the formula?

Achieving this with one formula is important in this case, because the table keeps getting longer (it's populated by a live data feed).

At very least, I'd greatly appreciate any help in thinking this through:)

Here's a demo Sheet you can edit.

it's called running total or cumulative sum ... use:

=INDEX(QUERY(MMULT(TRANSPOSE((SEQUENCE(COUNTA(B:B))<=
 SEQUENCE(1, COUNTA(B:B)))*{C1; B2:B}), 
 SEQUENCE(COUNTA(B:B), 1, 1, )), "offset 1", ))

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM