+ Reply to Thread
Results 1 to 4 of 4

Find the row number of an ID in relation to the first time that ID appears

  1. #1
    Registered User
    Join Date
    08-24-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    3

    Find the row number of an ID in relation to the first time that ID appears

    I have a file with a list of IDs that are repeated a number of times. The IDs will always be duplicated in a group, if at all. I want to add a column that gives the position of the ID in relation to the first time that it appears (essentially indexing duplicates). I have attached an example but I'm also writing it below.

    If anyone knows anything that can do this for me any help would be greatly appreciated.



    ID Position in list of itself
    61 1
    61 2
    61 3
    51 1
    71 1
    81 1
    81 2
    81 3
    91 1
    91 2
    91 3
    91 4
    Attached Files Attached Files
    Last edited by cfoxc; 12-10-2012 at 06:13 PM.

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Find the row number of an ID in relation to the first time that ID appears

    In B2 use
    Please Login or Register  to view this content.
    Copy down
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Find the row number of an ID in relation to the first time that ID appears

    based on your example if your file, try this in C2 (i used C2, so i could compare with your answers), copied down...

    =IF(A2=A1,C1+1,1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    08-24-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Find the row number of an ID in relation to the first time that ID appears

    Oh my god, thank you. It seems so obvious now - I think I was just staring at this for too long!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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