Formula SUBTOTAL within SUMPRODUCT

Guinaba

Board Regular
Joined
Sep 19, 2018
Messages
217
Office Version
  1. 2016
Platform
  1. Windows
Hi guys,

I am using the below formula to sum up all the rows on col. K based on the condition "Green", however if I try to add another condition say...--($M$62:$M$1056="Square") keeping both in the formula, the formula doesn't work. Any suggestion?

Ok =SUMPRODUCT(SUBTOTAL(109,OFFSET(K$62,ROW(K$62:K$1056)-ROW(K$62),,1)),--($J$62:$J$1056="Green"))

Not ok =SUMPRODUCT(SUBTOTAL(109,OFFSET(K$62,ROW(K$62:K$1056)-ROW(K$62),,1)),--($J$62:$J$1056="Green"),--($M$62:$M$1056="Square"))

Cheers
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
It is working my end:

Maybe you could show us some data with it not working using the XL2BB addin?
 
Upvote 0
Works fine for me as well
Fluff.xlsm
BJKLM
625green1square
6352
643
65green4square
665
676
Data
Cell Formulas
RangeFormula
B62B62=SUMPRODUCT(SUBTOTAL(109,OFFSET(K$62,ROW(K$62:K$1056)-ROW(K$62),,1)),--($J$62:$J$1056="Green"))
B63B63=SUMPRODUCT(SUBTOTAL(109,OFFSET(K$62,ROW(K$62:K$1056)-ROW(K$62),,1)),--($J$62:$J$1056="Green"),--($M$62:$M$1056="Square"))


Fluff.xlsm
ABJKLM
621green1square
6312
643
665
676
Data
Cell Formulas
RangeFormula
B62B62=SUMPRODUCT(SUBTOTAL(109,OFFSET(K$62,ROW(K$62:K$1056)-ROW(K$62),,1)),--($J$62:$J$1056="Green"))
B63B63=SUMPRODUCT(SUBTOTAL(109,OFFSET(K$62,ROW(K$62:K$1056)-ROW(K$62),,1)),--($J$62:$J$1056="Green"),--($M$62:$M$1056="Square"))
 
Upvote 0
Glad it's sorted & thanks for letting us know.
 
Upvote 0
Not sure what happened to my post (XL2BB part is missing under the ':') but glad you got it working.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

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