Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
for each c in range.. how set counter "minus 1"? | Excel Programming | |||
How do I set up a "roll over" counter in excel 2003? | Excel Worksheet Functions | |||
multiple file uploading - runtime error'13': type mismatch "While Counter <= UBound(FName)" | Excel Discussion (Misc queries) | |||
Need help with "Headline Counter" spreadsheet... | Excel Discussion (Misc queries) |