James Raitsev
James Raitsev

Reputation: 96491

How to sum up row numbers in Excel conditioned by a column?

I am trying to find a formula I can use that sums up the numbers in columns F and G provided that value in column A is ... "A", for example

I attempted to be explicit about it by saying =SUMIF(F8:G11,A8:A11="A") ) Sum up stuff in F-G column A has a value of "A"

This doesn't work. What am I missing please?

enter image description here

Upvotes: 0

Views: 62

Answers (2)

JvdV
JvdV

Reputation: 75960

Try:

enter image description here

Formula in B7:

=SUM(FILTER(F1:G4,A1:A4="A"))

Or;

=SUM((A1:A4="A")*(F1:G4))

I guess the latter can be used with SUMPRODUCT() in older version.

Upvotes: 2

Scott Craner
Scott Craner

Reputation: 152650

One the order of SUMIF is: SUMIF(range, criteria, [sum_range])

Two. The sum_range must be the same shape as the range.

We can add two together:

=SUMIF(A8:A11,"A",F8:F11)+SUMIF(A8:A11,"A",G8:G11)

enter image description here

Or if you are okay with a little volatility we can use OFFSET and wrap in sumproduct:

=SUMPRODUCT(SUMIF(A8:A11,"A",OFFSET(F8:F11,,{0,1})))

Upvotes: 2

Related Questions