Multiplying columns if criteria is met

oscarj

New Member
Joined
May 4, 2018
Messages
12
Hello,

Probably simple question here, but I am struggling with SUMIFS and SUMPRODUCT so I am reaching out for help. I have 3 columns: Two have values that need to be multiplied if a condition in the 3rd column is met. For simplicity, here is an example

[TABLE="width: 500"]
<tbody>[TR]
[TD]Value 1[/TD]
[TD]Value 2[/TD]
[TD]Criteria[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]10[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]20[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]30[/TD]
[TD]Yes[/TD]
[/TR]
</tbody>[/TABLE]

The result would be 2*10 + 4*30 = 140. The actual sheet will have 2000 rows though. What is the easiest way to do this?

Thank you

Oscar
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi,

SUMPRODUCT:


Book1
ABCDE
1Value 1Value 2Criteria140
2210Yes
3320No
4430Yes
Sheet104
Cell Formulas
RangeFormula
E1=SUMPRODUCT((A2:A4)*(B2:B4)*(C2:C4="Yes"))


Adjust Cell references to suit your data.
 
Upvote 0
Is there a way to do this in the case where instead of yes or no, criteria is blank, and a blank is assumed to be a no?
 
Upvote 0
Like this:


Book1
ABCDEF
1Value 1Value 2Criteria440260
2210Yes
3320 C3 is ""
4430Yes
5540C5 is True Blank
6650Yes
Sheet104
Cell Formulas
RangeFormula
E1=SUMPRODUCT((A2:A6)*(B2:B6)*(C2:C6="Yes"))
F1=SUMPRODUCT((A2:A6)*(B2:B6)*(C2:C6=""))
C3=""
 
Last edited:
Upvote 0
Is there a way to do this in the case where instead of yes or no, criteria is blank, and a blank is assumed to be a no?

Do you mean that the data in column C is either not blank or blank. And you want to multiply rows that are not blank in column C?

If yes,...

=SUMPRODUCT((A2:A4)*(B2:B4)*(C2:C4<>""))
 
Upvote 0
I should've said the three options are "yes" "no" or a blank cell. Although not actually blank, but with "" in the cell. So if there is a yes, they should be multiplied and summed, but if there is a no or "" nothing should be done. Is there a way to do that?
 
Upvote 0
I decided to stick with the original calculation and change the contents of the cells i'm multiplying from IFERROR(___,"") to IFERROR(___,0) so the sumproduct works.

Thank you both for the help!
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top