+ Reply to Thread
Results 1 to 8 of 8

add consecutive number for each individual with multiple rows per person

  1. #1
    Registered User
    Join Date
    03-22-2024
    Location
    London, England
    MS-Off Ver
    Microsoft 365
    Posts
    2

    add consecutive number for each individual with multiple rows per person

    Hi

    I have a file that contains multiple rows per individual, each with a different date.

    I'd like to allocate a consecutive incrementing number for each individual, like the 'time' column below. This is just a one-off thing I need to apply to this dataset to allow further analysis - doesn't need to be dynamic.

    I'm unable to attach a file but below is how the data looks (my file has approx 1k records, 200 ID codes). There is unique identifier for each 'person' but a varying number of rows for each person. It's already sorted by ID and date, so the date variable doesn't need to be used. I would like to find a way for excel to add the 'time' column.
    E.g.

    ID. date. time
    ID1 -- 3/apr/15. 1
    ID1 -- 5/june/16. 2
    ID1 -- 2/mar-17. 3
    ID2 -- 1/jan/13. 1
    ID2 -- 5/mar/15. 2

    I feel that there should be a simple way to do this but am struggling to formulate the question. I'd be very grateful for any tips on how to achieve this. Thank you for reading!
    Last edited by phineasgage; 03-22-2024 at 11:50 AM. Reason: mark as solved

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,898

    Re: add consecutive number for each individual with multiple rows per person

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    You could try this in C2 copied down:

    =COUNTIF(A$2:A2,A2)
    Last edited by AliGW; 03-22-2024 at 11:41 AM. Reason: Added suggestion.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-22-2024
    Location
    London, England
    MS-Off Ver
    Microsoft 365
    Posts
    2

    Re: add consecutive number for each individual with multiple rows per person

    Dear AliGW

    That works perfectly - thank you so much!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,898

    Re: add consecutive number for each individual with multiple rows per person

    Glad to have helped.

    If you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  5. #5
    Registered User
    Join Date
    03-23-2024
    Location
    Zambia
    MS-Off Ver
    2010
    Posts
    7
    Please help, I need an excel formula that will check if row 1 contains K,D,S,1,0 and 2, then get their corresponding numbers from row A (same columns), and return the largest number only among these. This formula can be displayed in the yellow cell of row 1, and can be copied to other yellow cells but all using numbers from row A.
    Attached Files Attached Files

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: add consecutive number for each individual with multiple rows per person

    Megavic. DO NOT do this again. One more thread hijacking and you will get a one week ban from this site.

    Kindly READ the forum rules that you agreed to obey:

    https://www.excelforum.com/forum-rul...um-rules2.html

    Aas already requested, start your OWN thread.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: add consecutive number for each individual with multiple rows per person

    NO HELP to be offered to Megavic at Post 5.

  8. #8
    Banned User!
    Join Date
    03-11-2024
    Location
    usa
    MS-Off Ver
    CURRENT
    Posts
    23

    Re: add consecutive number for each individual with multiple rows per person

    To add a time column, you can use the Counter function, which will automatically increment the value by 1 for each new entry for each person. For example, if the ID is in column A, you could enter the formula "=IF(A2<>A1, 1, B1+1)" in the first cell of the time column and copy it down the entire column. This will cause each new person to start at 1, and then subsequent lines for that person will increment the number by 1.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Multiple Rows, Multiple Addresses for Same Person/Name
    By jarrgonn in forum Excel General
    Replies: 3
    Last Post: 07-01-2021, 04:00 PM
  2. Replies: 1
    Last Post: 01-12-2021, 02:22 AM
  3. How do I count the number of consecutive 5 rows with a certain value?
    By xamark_18 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-15-2019, 02:54 AM
  4. Count consecutive dates by person
    By KylerStern in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-14-2015, 04:05 PM
  5. Replies: 4
    Last Post: 05-30-2013, 06:00 PM
  6. Transpose/Pivot multiple rows per person into 1 row per person with fixed columns
    By MaestroEnrique in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2013, 06:35 AM
  7. Consolidating Multiple rows for same person
    By Requiescat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2008, 07:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1