Sumproduct and Blank Rows

rex759

Well-known Member
Joined
Nov 8, 2004
Messages
608
Office Version
  1. 365
Platform
  1. Windows
Hello,

What I want to do is if the number in column C is > 0, multiple it by the number in column D.

Here is my formula:

=SUMPRODUCT(--(C2:C19>0),(C2:C19*E2:E19))

My formula works fine if the range does not include blank cells, otherwise, I get a #value error. I have tried a few variables without success.

Any help is appreciated

C2=IF(A2="","",SUM(A2-B2))


OriginalActualDifferenceCostDiff
23230260
24240270
2526-133-33
2227-544-220
1015555
77770660
464601270
53521231231
32320590
131211212
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
hmmm, that gave me a result of 1431, it should be 298
 
Upvote 0
Try this ARRAY FORMULA (completed using CTRL+SHIFT+ENTER, instead of just ENTER):
=SUM(IFERROR((C2:C19>0)*(C2:C19)*(D2:D19),0))

Is that something you can work with?
 
Upvote 0
I was hoping the formula would be easy to apply this =SUMPRODUCT(--(C2:C12<0),(C2:C12*D2:D12)) if the number in column C was less than zero
 
Upvote 0
I spoke too soon.
When I use this formula, ={SUM(IFERROR((C2:C20>0)*(C2:C20)*(D2:D20),0))} I should get 222.27. Instead, I get 170.18. Is this because of the "-" numbers?


OriginalActualDifferenceCostDiff
2323-1194.22-194.22
24240194.220
2526055.090
22270194.220
1022040
7777055.090
4646055.090
535212020
-155.09-55.09
3232-155.09-55.09
1312-155.09-55.09
2224255.09165.27
 
Upvote 0
How are you getting to 222.27?

=SUMPRODUCT(--(C2:C19>0),C2:C19,E2:E19)
=SUMPRODUCT(--(C2:C20>0),C2:C20,D2:D20)

should work for what you need
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,391
Members
449,080
Latest member
Armadillos

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