0
votes

Data example

What I'm trying to do is to sum row 1 in column D if A3:C has a value. The blue cells in the image shows the values I'm trying to calculate.

=SUMIF(A3:C3;">0";$A$1:$C$1)

or

=SUM(FILTER($A$1:$C$1;A3:C3>0))

does just this, but then I have to drag the formulas down. I want to do it with ArrayFormulas since the number of rows is growing but I can't figure out how. Any suggestions?

EDIT: In the real data there are many columns.

1

1 Answers

0
votes

Please try:

=arrayformula(ArrayFormula((A3:A>0)*A$1)+ArrayFormula((B3:B>0)*B$1)+ArrayFormula((C3:C>0)*C$1))

or a bit shorter when written as:

=arrayformula({(A3:A>0)*A$1}+{(B3:B>0)*B$1}+{(C3:C>0)*C$1})