2
votes

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
Are you looking to place the sum of each row in a cell in that row, meaning sum the contents of G2:2 and place the answer in cell F2 and the sum G3:3 and place that in F3, etc?Karl_S

1 Answers

7
votes

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