SUMPRODUCT with SUBTOTAL

Joined
Dec 3, 2008
Messages
33
Hi there,

I have a small question about a spreadsheet I'm trying to create.

I have a sheet with a country in column A and a material number in column B and the number of contracts in column D.

Above that I have totals per country, at the moment I'm using a SUMPRODUCT formula to get the totals per country in column D.

Code:
=SUMPRODUCT((A17:A2461 = C2)*(D17:D2461))

But what I would really like is to be able to do is also filter on the material number in column B and also get the totals per material number in the above totals (so basically if I filter on 1 material I would get the totals per country on that specifically).

I have googled this and I assume I need to add the subtotal formula somewhere into the above formula, I have tried but I can't seem to get anything to work.

Any help would be greatly appreciated.

Thanks in advance,

Ian
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi Ian

If you use a Pivot Table you'll get a list with quantities / country / material.

As for the formula, try:

=SUMPRODUCT((A17:A2461 = C2)*SUBTOTAL(3,OFFSET(B17:B2461,ROW(B17:B2461)-ROW(INDEX(B17:B2461,1)),0,1))*(D17:D2461))
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,513
Members
452,921
Latest member
BBQKING

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