+ Reply to Thread
Results 1 to 7 of 7

How to convert a list into list of consecutive numbers

  1. #1
    Registered User
    Join Date
    05-15-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    2

    How to convert a list into list of consecutive numbers

    Hello!

    Let me see if I can explain my question in an understandable fashion....

    I have a table containing data for about 2000 ID numbers. Some of these numbers are unique and some are duplicates. I would like to convert the ID numbers into a consecutive list of integers while preserving the unique numbers. For example, if the first column of my table is currently:

    ID#
    18578
    19644
    19644
    20247
    20974
    21361
    21361
    21419

    I would like to change that to something like:

    ID#
    1
    2
    2
    3
    4
    5
    5
    6

    I need to know which records (i.e. which rows of data) are from the same ID# but want to remove the actual ID#.

    Can anyone help with this?

    Thanks!

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to convert a list into list of consecutive numbers

    mr. grieves,

    Welcome to the forum!
    If your list starts in A1, then in B1 type 1 and in B2 and copied down use this formula:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to convert a list into list of consecutive numbers

    Not really understood.

    This is my proposal: Leave Column a alone
    In column b produce a list of the unique numbers from Column A and sort them numerically.
    In column C create a new series of ID Numbers to match the numbers in column B
    In Column D Map the New Numbers to your existing data.

    BRB

  4. #4
    Registered User
    Join Date
    05-15-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: How to convert a list into list of consecutive numbers

    Quote Originally Posted by tigeravatar View Post
    mr. grieves,

    Welcome to the forum!
    If your list starts in A1, then in B1 type 1 and in B2 and copied down use this formula:
    Please Login or Register  to view this content.
    I don't know how, but that worked exactly as I needed it to! Thanks!!

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to convert a list into list of consecutive numbers

    Ok here is my code for the above

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to convert a list into list of consecutive numbers

    Nice Code Tigeravtar.

    But it assumes that all the id numbers are sorted sequentially.

    But I assume that can easily be sorted.

    So the code isn't nice, its excellent.

  7. #7
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to convert a list into list of consecutive numbers

    The following is based on Tigeravtars excellent code.

    Please Login or Register  to view this content.

+ 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