subtotal() function doing Data-->subtotal job

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I have a table like the one below. I sorted "Store" column. I want to find the subtotal of east store or subtotal of north store or north store etc. using subtotal() function.

I know after sorting, I can go to Data tab-->subtotal, that is an option
another option maybe I can use SumIf() function. Another option I can use pivot table.

But I wonder, can I use subtotal() function to do exactly what Data-->Subtotal does? Thank you very much.

namestoreitemprice
lindaeasttv662
jackeastdryer444
alexeastcomputer723
alleneasttv356
maryeastdryer792
samnorthwasher452
adamnorthtv998
davidnorthdryer307
ericnorthcomputer464
jimsouthdryer410
timsouthcomputer890
tomsouthwasher899
suesouthtv931
lizsouthdryer739
danawestcomputer459
annawesttv967
kimwestdryer931
louiswestcomputer481
jeffwestwasher737

<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I don't think you can easily use SUBTOTAL() to find, for example, the subtotal for SOUTH, unless you are using Data Filters to select SOUTH entries.

I think in this situation I would use SUMIF (or SUMIFS), or PIVOT TABLE.
 
Upvote 0
You can use subtotal() as a complement to sumproduct, that way it also helps you when you have a filter, eg by item: computer, and you want to get the subtotal of "west", tyr this:

Excel Workbook
ABCDEFG
1namestoreitemprice940
4alexeastcomputer723
10ericnorthcomputer464
12timsouthcomputer890
16danawestcomputer459
19louiswestcomputer481
Hoja3
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,734
Members
449,094
Latest member
dsharae57

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