Subtotal Function

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,941
I thought this may be a good place for this. I came across a co-workers spreadsheet and they had it set up where they were doing subtotals of a column, but for some reason were also using subtotals for the row totals, but were never hiding or unhiding the rows. BUT the weird thing I noticed is that the subtotal did not work on rows that had subtotals in them as well (See G1 for the total of that column?)
Excel Workbook
ABCDEFG
1521273434426441447340
2LocationJanFebMarchAprilMayYTD Total
315179336333187753176
426228797632227313217
536201313036241120
64840611606992192375
754669011418325942934
811119561475714562241
945885552971973451982
105607971944574323128
1124966141668496592784
1269039235984492993172
Sheet1
Cell Formulas
RangeFormula
B1=SUBTOTAL(9,B3:B12)
C1=SUBTOTAL(9,C3:C12)
D1=SUBTOTAL(9,D3:D12)
E1=SUBTOTAL(9,E3:E12)
F1=SUBTOTAL(9,F3:F12)
G1=SUBTOTAL(9,G3:G12)
G3=SUBTOTAL(9,B3:F3)
G4=SUBTOTAL(9,B4:F4)
G5=SUBTOTAL(9,B5:F5)
G6=SUBTOTAL(9,B6:F6)
G7=SUBTOTAL(9,B7:F7)
G8=SUBTOTAL(9,B8:F8)
G9=SUBTOTAL(9,B9:F9)
G10=SUBTOTAL(9,B10:F10)
G11=SUBTOTAL(9,B11:F11)
G12=SUBTOTAL(9,B12:F12)

Can anyone explain why this phenomenon is happening? It seemed really strange to me.
 

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.
Well excel help says
"If there are other subtotals within ref1, ref2,… (or nested subtotals), these nested subtotals are ignored to avoid double counting."

So probably cause of that :)
 
Upvote 0
How funny - I've never seen subtotals of a row before! That's kind of interesting. Note: one other feature of subtotaling that's also kind of neat (but probably rarely used) is the extra arguments for ignoring hidden rows. I've probably encountered cases where I might have employed this feature (but of course forgot about it at the time ;) )
 
Upvote 0
Well excel help says
"If there are other subtotals within ref1, ref2,… (or nested subtotals), these nested subtotals are ignored to avoid double counting."

So probably cause of that :)
I never think to look there because I am use to the vba help, which is of no help. :biggrin:

How funny - I've never seen subtotals of a row before! That's kind of interesting. Note: one other feature of subtotaling that's also kind of neat (but probably rarely used) is the extra arguments for ignoring hidden rows. I've probably encountered cases where I might have employed this feature (but of course forgot about it at the time :wink: )
Yes I have used the 109 feature quite a few times, but don't always remember it and then come back to something and wonder why I didn't put it in there in the first place.

Thanks for the answers. It makes me wonder why it was built to ignore the answers of other subtotals? I'm not sure I can always buy the double counting argument.
 
Last edited:
Upvote 0
SUBTOTAL has a few tricks up its sleeve, some of them annoying.
I recently got caught with a table that always left the last row visible, regardless of what I filtered by. Turns out that one column had a SUBTOTAL where a SUM would have worked too. Changing to SUM made the filter work properly again.

Denis
 
Upvote 0
SUBTOTAL has a few tricks up its sleeve, some of them annoying.
I recently got caught with a table that always left the last row visible, regardless of what I filtered by. Turns out that one column had a SUBTOTAL where a SUM would have worked too. Changing to SUM made the filter work properly again.

Denis

That problem came up a few weeks back with a suggestion I made in another thread, think it was VoG pointed out that it can be prevented if the subtotal column is excluded from the filter range, though not much use if you need to filter on subtotal.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,749
Members
452,940
Latest member
rootytrip

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