How do you subtotal a sum?

rizzo93

Active Member
Joined
Jan 22, 2015
Messages
303
Office Version
  1. 365
When I filter a table, I have this formula to tell me how many rows are being displayed as a result of the filtering:


Code:
SUBTOTAL(102,PeriTable[ID])
I now need to do something similar for another column, but in this case I am totaling the numbers contained in these cells. As I filter the table, I need this total to take into account the cells that are being filtered out.


How can I achieve this please?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Last edited:
Upvote 0
Sure, here's a basic example:


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Date

[/TD]
[TD]Product
[/TD]
[TD]Qty
[/TD]
[/TR]
[TR]
[TD]4/15/2019
[/TD]
[TD]apple

[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]4/15/2019
[/TD]
[TD]orange
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]4/15/2019
[/TD]
[TD]grape
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]4/15/2019
[/TD]
[TD]mango
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]4/15/2019
[/TD]
[TD]banana
[/TD]
[TD]7
[/TD]
[/TR]
[TR]
[TD]2/17/2019
[/TD]
[TD]apple
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]2/17/2019
[/TD]
[TD]orange
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]2/17/2019
[/TD]
[TD]grape
[/TD]
[TD]9
[/TD]
[/TR]
[TR]
[TD]2/17/2019
[/TD]
[TD]mango
[/TD]
[TD]8
[/TD]
[/TR]
[TR]
[TD]2/17/2019

[/TD]
[TD]banana
[/TD]
[TD]2

[/TD]
[/TR]
</tbody>[/TABLE]


So we have 10 rows. The sum total comes to 38.

Using the formula I initially provided, it will yield a number of 10 rows. If I filter on just 4/15/2019, that formula will yield 5 rows. All is good to this point.

My goal is to have the sum total change along with the filter. So in this example above, it should show 17.
 
Upvote 0
You can use the same formula, but use 109 instead of 102
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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