Sum all values in all rows using array formula

╄→尐↘猪︶ㄣ 提交于 2019-12-12 18:19:44

问题


I would like an array formula to sum up columns G26:AD per row, since the amount of rows is dynamic.

=ArrayFormula(sum(G26:26)) 

does not work. I tried using MMULT but did not manage to get it working:

=MMULT(G26:26,TRANSPOSE(ARRAYFORMULA(COLUMN(G26:26)^0)))

Any other ideas?


回答1:


Sum by rows

The sum of each row in A:C:

=arrayformula(mmult(A2:C*1, transpose(A2:C2 * 0 + 1)))

Edit. This one is even shorter: =arrayformula(mmult(A2:C*1, transpose(A2:C2 ^ 0)))


Sum by rows with conditions

=arrayformula(mmult(A2:C*--(A2:C>0), transpose(A2:C2 ^ 0)))

Other conditions:

=arrayformula(mmult(A2:D*1, transpose(A2:D2 ^ 0*iseven(column(A2:D2)))))



来源:https://stackoverflow.com/questions/46000416/sum-all-values-in-all-rows-using-array-formula

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