PC Review


Reply
Thread Tools Rate Thread

Assigning "Counter" for Groups

 
 
poleenie
Guest
Posts: n/a
 
      6th Nov 2009
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
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      6th Nov 2009
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
 
Reply With Quote
 
poleenie
Guest
Posts: n/a
 
      6th Nov 2009
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 <peter...@verizonXSPAM.net> 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 -


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      6th Nov 2009
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 <peter...@verizonXSPAM.net> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook View - Two level grouping with "Today", "Yesteday" groups. tarasul@gmail.com Microsoft Outlook Discussion 1 15th Nov 2005 11:13 PM
Restricted Groups: "Member of" and add Domain Groups to local Groups Hansi Microsoft Windows 2000 Group Policy 1 5th Mar 2005 03:24 AM
Session("counter") vs. ViewState("counter")...a newbie question The Eeediot Microsoft ASP .NET 3 22nd Dec 2004 09:31 PM
weird sorting when "arrange icons by type" + "show in groups" v.a. Windows XP Basics 0 3rd Jan 2004 07:23 PM
Re: "Assigning" Office XP at "Computer Configuration" level using Group Policy Vsevolod Titov [MSFT] Microsoft Windows 2000 Group Policy 4 15th Dec 2003 03:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:59 PM.