Bill Software Engineer
Bill Software Engineer

Reputation: 7782

How do you do sumif with equation?

Basically, I want to do a SUMIF, but I need to enter an equation for sum_range parameter, so normally, to do a SUMIF, you write:

=SUMIF(CRITERIA_RANGE,CRITERIA,SUM_RANGE)

This is great, but what if I need to do some calculation in my summation? So for example:

=SUMIF(CRITERIA_RANGE,CRITERIA,COL1*COL2)

Is something like this possible?

Upvotes: 0

Views: 77

Answers (2)

Siddharth Rout
Siddharth Rout

Reputation: 149305

A different answer (NOT FOR POINTS).

Explanation

The reason why you cannot use SUMIF in your scenario is because SUMIF cannot handle Arrays as sumproduct does and hence I would go with Chris's suggestion of using SUMPRODUCT

Alternative

Here is one more way to achieve what you want.

=SUM(IF(CRITERIA_RANGE=CRITERIA,COL1*COL2,""))

ScreenShot

enter image description here

Please note that this is an ARRAY FORMULA which means that instead of pressing ENTER, you have to press CTRL+SHIFT+ENTER

Upvotes: 1

chris neilsen
chris neilsen

Reputation: 53126

SUMPRODUCT is commonly used in this case

Eg

 =SUMPRODUCT((CRITERIA_RANGE=CRITERIA)*COL1*COL2)

Upvotes: 3

Related Questions