Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Assigning "Counter" for Groups

I have a dataset like this:

ID Date
10 1/2/2009
10 1/2/2009
10 1/2/2009
11 2/3/2009
11 2/3/2009
11 4/5/2009
11 4/5/2009
12 5/5/2009
12 5/5/2009
12 6/6/2009

Basically, there can be multiple dates for each. How do I group them
based on ID and and groups of different dates to create a new variable
called DateGroup?

ID Date DateGroup
10 1/2/2009 1
10 1/2/2009 1
10 1/2/2009 1
11 2/3/2009 1
11 2/3/2009 1
11 4/5/2009 2
11 4/5/2009 2
12 5/5/2009 1
12 5/5/2009 1
12 6/6/2009 2

Any help would be appreciated!!

Pauline
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Assigning "Counter" for Groups

How did you know that 1/2/2009 and 2/3/2009 should be grouped together?

poleenie wrote:

I have a dataset like this:

ID Date
10 1/2/2009
10 1/2/2009
10 1/2/2009
11 2/3/2009
11 2/3/2009
11 4/5/2009
11 4/5/2009
12 5/5/2009
12 5/5/2009
12 6/6/2009

Basically, there can be multiple dates for each. How do I group them
based on ID and and groups of different dates to create a new variable
called DateGroup?

ID Date DateGroup
10 1/2/2009 1
10 1/2/2009 1
10 1/2/2009 1
11 2/3/2009 1
11 2/3/2009 1
11 4/5/2009 2
11 4/5/2009 2
12 5/5/2009 1
12 5/5/2009 1
12 6/6/2009 2

Any help would be appreciated!!

Pauline


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Assigning "Counter" for Groups

Sorry for the confusion. I'm counting within the same ID, so the
counter resets itself when there is a new ID. It will stay the same if
the date is the same (within ID).

On Nov 6, 3:19*pm, Dave Peterson wrote:
How did you know that 1/2/2009 and 2/3/2009 should be grouped together?





poleenie wrote:

I have a dataset like this:


ID Date
10 1/2/2009
10 1/2/2009
10 1/2/2009
11 2/3/2009
11 2/3/2009
11 4/5/2009
11 4/5/2009
12 5/5/2009
12 5/5/2009
12 6/6/2009


Basically, there can be multiple dates for each. How do I group them
based on ID and and groups of different dates to create a new variable
called DateGroup?


ID Date * * * *DateGroup
10 1/2/2009 *1
10 1/2/2009 *1
10 1/2/2009 *1
11 2/3/2009 *1
11 2/3/2009 *1
11 4/5/2009 *2
11 4/5/2009 *2
12 5/5/2009 *1
12 5/5/2009 *1
12 6/6/2009 *2


Any help would be appreciated!!


Pauline


--

Dave Peterson- Hide quoted text -

- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Assigning "Counter" for Groups

With your data in A2:Bxxx (headers in row 1),

try this in C2:
=IF(A2<A1,1,IF(B2=B1,C1,C1+1))

(and drag down as far as you need)

This does assume that your data is sorted nicely.

poleenie wrote:

Sorry for the confusion. I'm counting within the same ID, so the
counter resets itself when there is a new ID. It will stay the same if
the date is the same (within ID).

On Nov 6, 3:19 pm, Dave Peterson wrote:
How did you know that 1/2/2009 and 2/3/2009 should be grouped together?





poleenie wrote:

I have a dataset like this:


ID Date
10 1/2/2009
10 1/2/2009
10 1/2/2009
11 2/3/2009
11 2/3/2009
11 4/5/2009
11 4/5/2009
12 5/5/2009
12 5/5/2009
12 6/6/2009


Basically, there can be multiple dates for each. How do I group them
based on ID and and groups of different dates to create a new variable
called DateGroup?


ID Date DateGroup
10 1/2/2009 1
10 1/2/2009 1
10 1/2/2009 1
11 2/3/2009 1
11 2/3/2009 1
11 4/5/2009 2
11 4/5/2009 2
12 5/5/2009 1
12 5/5/2009 1
12 6/6/2009 2


Any help would be appreciated!!


Pauline


--

Dave Peterson- Hide quoted text -

- Show quoted text -


--

Dave Peterson
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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
for each c in range.. how set counter "minus 1"? mino[_2_] Excel Programming 4 July 9th 08 07:33 AM
How do I set up a "roll over" counter in excel 2003? mcorson Excel Worksheet Functions 1 March 6th 07 09:10 PM
multiple file uploading - runtime error'13': type mismatch "While Counter <= UBound(FName)" Sinner Excel Discussion (Misc queries) 3 March 1st 07 09:44 AM
Need help with "Headline Counter" spreadsheet... Cloy Excel Discussion (Misc queries) 1 November 21st 06 10:04 AM


All times are GMT +1. The time now is 10:46 PM.

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

About Us

"It's about Microsoft Excel"