+ Reply to Thread
Results 1 to 5 of 5

Lots of text data, need to assign unique numeric values

  1. #1
    Registered User
    Join Date
    07-14-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    43

    Lots of text data, need to assign unique numeric values

    Hi,
    Here's my situation.

    I will post a rudimentary example:
    Account Name/Column A
    Truman school, San Diego
    Truman school, San Diego
    Truman school, San francisco
    Truman school, Atlanta
    Truman school, Atlanta


    In column B, I would like it to assign a unique numeric id based on the TEXT only.

    So Truman school, San Diego gets a string of numbers: 1234
    Truman school, san fran: 1235
    Truman school, Atlanta: 1236

    My spreadsheet is about 6,000 records with a great deal of the above situation going on. So school names are identical with different locations assigned. I am trying to import to a database and don't want a lot of duplicate records. That's why I'm trying to assign a numeric value.

    Any help would be appreciated.

    Thank you!
    Last edited by dawsonsoo; 08-28-2009 at 09:18 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Lots of text data, need to assign unique numeric values

    At the top of column B enter the number before your first desired code...

    e.g. in B1 enter 1233

    Then in B2 enter formula:

    =IF(COUNTIF($A$2:A2,A2)=1,MAX($B$1:B1)+1,"")

    and copy down..

    You can then copy/paste special >> Values over the formulas... so that they become hard coded.. and then delete B1.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Lots of text data, need to assign unique numeric values

    If you want codes repeated for duplicate...then use formula in B2:

    =MAX($B$1:B1)+IF(COUNTIF($A$2:A2,A2)=1,1,0) copied down.

    Note: Both these formulas assume data is grouped by as per your example.

  4. #4
    Registered User
    Join Date
    07-14-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: Lots of text data, need to assign unique numeric values

    This Worked beautifully and I can't thank you enough! formula #2 especially helped.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Lots of text data, need to assign unique numeric values

    You are welcome.

    Please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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