Subtotal filtered columns

I have read several posts on this issue and none do what I want.


Say I have 4 columns and 7 rows. I want to filter Column 3 on a criteria. When I filter I now have 3 rows instead of 7 displayed ( Not necessarily starting at Row 2 but maybe Row 4 if that is where the first data is from that filter). I want to total only the values of Column 4 that match the filter in Column 2 (which may change next time I filter).


Unflitered Table Example

RowNameSexAge

1

JohnM12
2SidM25
3AndyM17
4BettyF63
5SusanF48
6AshleyF39
7MikeM15

I want the total ages of the women so the filtered table looks like this

RowNameSexAge
4

Betty

F63
5SusanF48
6AshleyF39

So the answer should be 150. And if I filter on Males the table would look like this

RowNameSexAge
1JohnM12
2SidM25
3AndyM17
7MikeM15

And the answer should be 69

Airport Extreme 802.11ac

Posted on Apr 8, 2018 8:24 PM

Reply
31 replies

Apr 9, 2018 4:49 PM in response to kevinfromherndon

An easy way to see the sum you want is to select the column (click on the column letter) then look at the bottom of the Numbers window where you will see Sum, Average, etc. of only the visible cells of that column. If you need the sum on the table, such as for printing the table, you can drag the sum up to the table and place it in a cell. I realize this is not a totally automated way of doing things but it is very flexible and a possible solution given we have no subtotal function.

Apr 10, 2018 6:17 AM in response to kevinfromherndon

Hi Kevin,


Add a new column E as the trigger for a filter (Column "Show?" Text is Show):

User uploaded file

Pop-Up Menu in Footer Row C9

User uploaded file

Formula in E2 (and Fill Down)

=IF(C$9="Show All","Show",IF(C2=C$9,"Show",""))

User uploaded file

Now choose M from the Pop-Up Menu in C9

User uploaded file

SUM in D9 sums only the visible rows. This is what is going on "behind the curtain"

User uploaded file

=SUMIF(E,"Show",D)


Tidy up by hiding Column E (and I changed C9 to F)

User uploaded file

Give this a try and we can help you extend the idea to other columns.


Regards,

Ian.

Apr 9, 2018 7:29 AM in response to kevinfromherndon

Hi Kevin,


Drop down lists (in Numbers, called Pop-Up Menus) will work.

Numbers is designed to work by "pulling" relevant data from a Database table into several small tables, each with a purpose. Think of the small tables as "Presentations" for display or printing. Then there is no need to filter or select to print part of the Database. Simply move (cut and paste) your summary table(s) to another sheet. Formulas will automatically adjust. Print only that sheet.

User uploaded file

In each small summary table, A2 is a Pop-Up Menu:

User uploaded file


User uploaded file

Formula in B2 =SUMIF(Database::F,A2,Database::D)


Regards,

Ian.

Apr 9, 2018 6:02 AM in response to Yellowbox

Thanks. That is helpful but not ideal. In reality my table has about 10 columns and each column has about 3-4 choices I might want to sort by and total. So that makes a lot of footer rows, formulas and calculations. Is it possible to make cell C10 a variable based on the value of the top cell in the filtered table which in this case would be row 4 ? It is too bad Classifications were eliminated. That would have been the perfect solution for me. So easy in excel to just use SUBTOTAL.

Apr 10, 2018 8:59 AM in response to kevinfromherndon

Almost. Let's say you already have a SUM that sums the whole column. Then filter the table, select the visible cells, and drag the 'SUM' token into another cell. Now when you "unfilter" the table the original SUM will still sum the whole column but the other cell into which you dragged the token from below will still show the subtotal.


It's a little scary that Badunit found his own advice via a search. He may be one of those people who have "forgotten" more than the rest of us ever knew to begin with.🙂


SG

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Subtotal filtered columns

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.