Arrayformula sum one column until this row

被刻印的时光 ゝ 提交于 2020-01-11 14:32:34

问题


I'm trying to make an array formula which sums up all the rows until this row. For clarification column a will be the input and column b would be the output. I'm looking for a way to do this with an arrayformula.


a1:1 b1:1
a2:2 b2:3
a3:5 b3:8
a4:3 b4:11

I tried to use
=ARRAYFORMULA(SUM(INDIRECT("F1:"&ADDRESS(ROW(),COLUMN(F2:F))))) but this doesn't work.


回答1:


Since OP changed the question with a clarification, A different answer is submitted below:

B1:

  =ARRAYFORMULA(MMULT(transpose(A1:A5)*--IF(row(1:5),COLUMN(A:E)<=row(1:5)),ROW(1:5)^0))



回答2:


How about

=arrayformula(sumif(row(A1:A4),"<="&row(A1:A4),A1:A4))

The sumif is evaluated separately for each value in the criteria part so:

In the first row of the output array you have

=sumif(row(A1:A4),"<=1",A1:A4)

giving you just the first row of column A.

In the second row of the output array you have

=sumif(row(A1:A4),"<=2",A1:A4)

giving you the sum of the first 2 rows and so on.



来源:https://stackoverflow.com/questions/46159506/arrayformula-sum-one-column-until-this-row

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!