Subtotal But Exclude Certain Rows

Pixel_Donkey

New Member
Joined
Sep 23, 2011
Messages
12
Hello,

I'm having a problem excluding data from my Subtotal:

excelquestion.jpg


I need to make the subtotal only include:
  • Stone
  • Fabric
  • Glass
  • Paper

And Exclude:
  • Granite
  • Marble
  • Pebble
  • Cobble
  • Brick

How can I do this with a SUBTOTAL or SUMIF statement?

If a SUMIF statement is used I would need to exclude the Hidden rows as I filter this spreadsheet by Date.

Thanks for any help.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hello,

I'm having a problem excluding data from my Subtotal:

excelquestion.jpg


I need to make the subtotal only include:
  • Stone
  • Fabric
  • Glass
  • Paper

And Exclude:
  • Granite
  • Marble
  • Pebble
  • Cobble
  • Brick

How can I do this with a SUBTOTAL or SUMIF statement?

If a SUMIF statement is used I would need to exclude the Hidden rows as I filter this spreadsheet by Date.

Thanks for any help.
If you are applying AutoFilter on the Date range and you want to sum the Value range for Stone, Fabric, Glass, and Paper together...
Rich (BB code):
=SUMPRODUCT( 
    SUBTOTAL(9,OFFSET(C2, ROW(C2:C10)-ROW(C2),,1)), 
    --ISNUMBER(MATCH(A2:A10,{"Stone","Fabric","Glass","Paper"},0))))


If no AutoFilter applied...

Either:
Rich (BB code):
Rich (BB code):
Rich (BB code):
=SUM(SUMIF(A2:A10,{"Stone","Fabric","Glass","Paper"},C2:C10))


Or:
Rich (BB code):
Rich (BB code):
Rich (BB code):
=SUMPRODUCT(
    C2:C10, 
    --ISNUMBER(MATCH(A2:A10,{"Stone","Fabric","Glass","Paper"},0))))



 
Upvote 0
That answered it perfectly, thank you very much! :)

One more question, I'm using:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(C2,ROW(C2:C100)-ROW(C2),,1)),--ISNUMBER(MATCH(A2:A100,{"Stone","Fabric","Glass","Paper"},0)))

9 is a subtotal, how can I change this to an average? Simply changing 9 breaks the formula.
 
Last edited:
Upvote 0
That answered it perfectly, thank you very much! :)

One more question, I'm using:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(C2,ROW(C2:C100)-ROW(C2),,1)),--ISNUMBER(MATCH(A2:A100,{"Stone","Fabric","Glass","Paper"},0)))

9 is a subtotal, how can I change this to an average? Simply changing 9 breaks the formula.

This was quite simple to sort out I just used

=SUMPRODUCT(SUBTOTAL(9,OFFSET(C2,ROW(C2:C100)-ROW(C2),,1)),--ISNUMBER(MATCH(A2:A100,{"Stone","Fabric","Glass","Paper"},0)))/4
 
Upvote 0
Sorry but it didn't work as easily as I hoped.

If I show more than one month /4 doesn't work for the average because 2 months is /8

Any ideas?
 
Upvote 0
I still haven't been able to find an answer for this one :(

Can anyone please help?

Control+shift+enter, not just enter:
Code:
=AVERAGE(
   IF(SUBTOTAL(2,OFFSET(C2,ROW(C2:C10)-ROW(C2),,1)),
   IF(ISNUMBER(MATCH(A2:A10,{"Stone","Fabric","Glass","Paper"},0)),
     $C$2:$C$10)))
 
Upvote 0
Hello,

Code:
=AVERAGE(
   IF(SUBTOTAL(2,OFFSET(C2,ROW(C2:C10)-ROW(C2),,1)),
   IF(ISNUMBER(MATCH(A2:A10,{"Stone","Fabric","Glass","Paper"},0)),
     $C$2:$C$10)))

Code:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(C2,ROW(C2:C100)-ROW(C2),,1)),--ISNUMBER(MATCH(A2:A100,{"Stone","Fabric","Glass","Paper"},0)))

Is there anyway I can turn these into sum's instead of a subtotal. I need to add a line that has the yearly total, not just the filtered subtotal.

Cheers!
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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