How can we use Multiplication in Sumproduct

GirishDhruva

Active Member
Joined
Mar 26, 2019
Messages
308
Hi Everyone,
Here i am trying to multiply a particular columns using SUMPRODUCT but its giving me the output as '0'

Can i know why is this happening???

Code:
 With Worksheets("Pivot")    finalcolumn = 1 + .Cells(2, 1).End(xlToRight).Column
    .Cells(2, finalcolumn).Select
    Nxt = .Cells(2, .Columns.Count).End(xlToLeft).Offset(, 1).Column
    Hdr = .Range(.Cells(1, 1), .Cells(1, Nxt - 1)).Address(, , xlR1C1)
    Range(.Cells(2, Nxt), .Cells(.Rows.Count, Nxt - 1).End(xlUp).Offset(, 1)).FormulaR1C1 = _
        "=SUMPRODUCT(((" & Hdr & "=""Sum of ABC PM"")/30)*(" & Hdr & "=""EA""),(rc1:rc[-1]))"
End With

Any Suggestions/Solutions for the above code

Regards,
Dhruv
 
=ROUND(SUMPRODUCT(D2/31*G2)+SUMPRODUCT(C2/H2*E2)-SUMPRODUCT(C2/H2*F2),0)

What words are in C1, D1, E1, F1, G1 and H1? I presume those are the header cells yes? Why are we using sumproduct here?

Yes, 1st row contains headers.

If i am not wrong by using this SUMPRODUCT we could reduce the looping(instead of looping in every cell and calculating i tried using SUMPRODUCT)
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
=ROUND(SUMPRODUCT(D2/31*G2)+SUMPRODUCT(C2/H2*E2)-SUMPRODUCT(C2/H2*F2),0)

What words are in C1, D1, E1, F1, G1 and H1? I presume those are the header cells yes? Why are we using sumproduct here?

You havent answered the first question.
 
Upvote 0
Oh sorry, those are C1(row-1,column-C),D1(row-1,column-D),E1(row-1,column-E)..........
I think u haven't seen my workbook, once check my workbook which i have shared.

Regards,
Dhruv
 
Last edited:
Upvote 0
So you want to perform calcualtions based on a column header but have no idea what that column header will be? I doubt you can do that.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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