#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 150
Default Subtotals

I have 2 columns of data that I need subtotals on both.

Group Start Time
7750 8:00 am
7750 8:00 am
7750 8:30 am
7750 8:30 am
7750 8:30 am
7751 7:30 am
7751 7:30 am
7751 8:30 am

In the above example I would like the outcome to be:

Group Start Time Count
7750 8:00 am 2
7750 8:30 am 3
7751 7:30 am 2
7751 8:30 am 1

Of course I can subtotal either column but I'm not sure how I can subtotal
them together to achieve the desired outcome. My goal is to run a macro that
would do this for me all at once.

Any help you can provide would be much appreciated!

Many thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,081
Default Subtotals

First step is to highlight the range of data, then use Data-Filter-Advanced
filter.
Choose to Copy to a new location, and check Unique records only.

Now assuming your two original columns are in A & B, and the unique,
filtered data is in colmns D & E, both starting in row 2, use this formula in
F2 and copy it down

=SUMPRODUCT(--($A$2:$A$92=D2),--($B$2:$B$92=E2))

adjust the ranges to reflect your own data


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Subtotals

As much as I like writing code, I don't think you need it here. Assuming
your data starts at row 2, and is in columns A and B, a formula such as this
somewhere on row 2, perhaps in column C? will show you the count for a
Group/Start Time combination when it first appears in the series:
=IF(OR(A2<A1,B2<B1),SUMPRODUCT(--(A$2:A$65536=A2),--(B$2:B$65536=B2)),"")
Put that formula in C2 (or as I said, any column on row 2 other than A or B)
and then fill it down as far as your data entries go. You can fill it on
down the sheet later as more entries are added also.

A variation of this would be to be able to enter a group number in a cell
(as D2) and a start time in another (as E2) and then put this formula in F2
=SUMPRODUCT(--(A$2:A$65536=D2),--(B$2:B$65536=E2))
and as you change entries in D2 and E2, the result will change to show you
the subtotal for that pairing in columns A and B.

Hope this helps you find a solution.


"Stan" wrote:

I have 2 columns of data that I need subtotals on both.

Group Start Time
7750 8:00 am
7750 8:00 am
7750 8:30 am
7750 8:30 am
7750 8:30 am
7751 7:30 am
7751 7:30 am
7751 8:30 am

In the above example I would like the outcome to be:

Group Start Time Count
7750 8:00 am 2
7750 8:30 am 3
7751 7:30 am 2
7751 8:30 am 1

Of course I can subtotal either column but I'm not sure how I can subtotal
them together to achieve the desired outcome. My goal is to run a macro that
would do this for me all at once.

Any help you can provide would be much appreciated!

Many thanks!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtotals problem: Excel 2003 (not, AFAIK, the nested subtotals bug) AndyCotgreave Excel Discussion (Misc queries) 3 October 24th 07 11:32 AM
Subtotals: Nested subtotals below higher subtotal RobN Excel Discussion (Misc queries) 1 July 20th 06 09:04 PM
How do I copy an outline w/ subtotals & paste just the subtotals av Excel Discussion (Misc queries) 1 June 20th 05 11:35 PM
Problem with nested subtotals, placing secondary subtotals BELOW . Dawn Cameron Excel Discussion (Misc queries) 1 June 3rd 05 10:13 PM
why are nested subtotals coming out below outer subtotals? Hendy Excel Worksheet Functions 2 January 18th 05 08:09 PM


All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"