Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sum all values in all rows using array formula

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?

like image 921
frenne Avatar asked Oct 23 '25 03:10

frenne


2 Answers

Sum by rows

The sum of each row in A:C:

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

enter image description here

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)))

enter image description here

Other conditions:

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

enter image description here

like image 151
Max Makhrov Avatar answered Oct 25 '25 11:10

Max Makhrov


now possible with just:

=BYROW(G26:AD; LAMBDA(x; SUM(x)))
like image 28
player0 Avatar answered Oct 25 '25 09:10

player0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!