Sumproduct/Subtotal Formula Tweak

dcuellar

New Member
Joined
Apr 27, 2015
Messages
42
I have a formula that works for the sum of visible rows in one column if criteria in another column is met. So, like sumif on visible cells of a filtered set of data.

Code:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(Monthly_Detail_Instantis!DX$2,ROW(Monthly_Detail_Instantis!DX$2:Monthly_Detail_Instantis!DX273)-ROW(Monthly_Detail_Instantis!DX$2),0)),--(Monthly_Detail_Instantis!D$2:Monthly_Detail_Instantis!D273=H9))

My issue is I want to add more than one column. I want to specify a range of columns. Instead of adding DX I want to add Columns DX, DY, DZ, etc. I know that I could add that formula to itself and modify for each column, but I was hoping for a better solution.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
It might be better to add those filter conditions to the sumproduct instead, what do you think?
 
Upvote 0
I found that there were many different solutions.

This works.
Code:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(Monthly_Detail_Instantis!CE$2[COLOR=#FF0000]:Monthly_Detail_Instantis!ED$2[/COLOR],ROW(Monthly_Detail_Instantis!CE$2[COLOR=#FF0000]:Monthly_Detail_Instantis!ED273[/COLOR])-ROW(Monthly_Detail_Instantis!CE$2[COLOR=#FF0000]:Monthly_Detail_Instantis!ED$2[/COLOR]),0)),--(Monthly_Detail_Instantis!D$2:Monthly_Detail_Instantis!D273=H9))

This works.
Code:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(Monthly_Detail_Instantis!CE$2:M[COLOR=#FF0000]onthly_Detail_Instantis!ED$2,R[/COLOR]OW(Monthly_Detail_Instantis!CE$2[COLOR=#FF0000]:Monthly_Detail_Instantis!ED273[/COLOR])-ROW(Monthly_Detail_Instantis!CE$2),0)),--(Monthly_Detail_Instantis!D$2:Monthly_Detail_Instantis!D273=H9))

This works.
Code:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(Monthly_Detail_Instantis!CE$2[COLOR=#FF0000]:Monthly_Detail_Instantis!ED$2[/COLOR],ROW(Monthly_Detail_Instantis!CE$2)-ROW(Monthly_Detail_Instantis!CE$2),0)),--(Monthly_Detail_Instantis!D$2:Monthly_Detail_Instantis!D273=H9))

To gain a better understanding I'd like to know why each of these work and if there is anything I should know about these that may give me incorrect data or undesired results.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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