+ Reply to Thread
Results 1 to 11 of 11

formula required to take first letter in 1 cells and add random number to create unique ID

Hybrid View

  1. #1
    Registered User
    Join Date
    03-27-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    5

    Question formula required to take first letter in 1 cells and add random number to create unique ID

    I have 1200 doctor/patient records to input into an excel spreadsheet for import to an online EHR database. I can set up all the normal formulas and formatting but for the life of me not figure out how to create a custom formula to take the first letter of the patient first name and last name and add 6 figures to create a unique patient identifier.

    ie.
    James + Smith+ random 6 figures = JS245318.

    In my spreadsheet the first name is under Column 1, Last name Column 3 and the unique number generated in column 4.

    Any assistance with this would be greatly appreciated.
    Last edited by trosty; 03-27-2014 at 03:54 PM.

  2. #2
    Registered User
    Join Date
    09-24-2013
    Location
    Twin Cities, MN
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    Use this:
    =left(a1,1)&left(c1,1)&d1

  3. #3
    Registered User
    Join Date
    03-27-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    Quote Originally Posted by minnesotaart View Post
    Use this:
    =left(a1,1)&left(c1,1)&d1
    Nope that didn't work for me, Thank you for the prompt reply though. See attached picture to see what happened.
    Attached Images Attached Images

  4. #4
    Registered User
    Join Date
    03-27-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    To be honest it doesn't have to be a random number, it can add 1 count to each new patient. It does though need to be in the first name,last name, number ie.

    SL123456
    AJ123457
    BB123458
    DN123459
    SR123460
    ETC ETC

  5. #5
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,324

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    =LEFT(A2,1)&LEFT(C2,1)&TEXT(RAND()*1000000,"000000")
    Maybe this will work
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  6. #6
    Registered User
    Join Date
    03-27-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    Quote Originally Posted by popipipo View Post
    =LEFT(A2,1)&LEFT(C2,1)&TEXT(RAND()*1000000,"000000")
    Maybe this will work
    Oh yes, That worked perfectly. Thank you so very much.

  7. #7
    Registered User
    Join Date
    09-24-2013
    Location
    Twin Cities, MN
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    "In my spreadsheet the first name is under Column 1, Last name Column 3 and the unique number generated in column 4."

    I misread your original post. I thought you had already generated the numbers and they were in column 4. I interpreted that your question was how to put the 3 pieces together. My bad. Glad you got what you needed.

  8. #8
    Registered User
    Join Date
    03-27-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    Quote Originally Posted by minnesotaart View Post
    "In my spreadsheet the first name is under Column 1, Last name Column 3 and the unique number generated in column 4."

    I misread your original post. I thought you had already generated the numbers and they were in column 4. I interpreted that your question was how to put the 3 pieces together. My bad. Glad you got what you needed.
    Thank you very much for the help anyway.

  9. #9
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    I would suggest you use iteration since random numbers in excel by default don't account for uniqueness.

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    I suggest the following. Enter the formula in column D and then select column D and apply Conditional Formatting, Highlight Cells Rules, Duplicate Values and choose a formatting for cells that are duplicates.

    Formula: copy to clipboard
    =LEFT(A2,1)&LEFT(C2,1)&RANDBETWEEN(100000,999999)


    With this you would have to copy and paste values to get rid of the volatile formula.
    Last edited by newdoverman; 03-29-2014 at 08:32 AM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,825

    Re: formula required to take first letter in 1 cells and add random number to create uniqu

    If you want a unique sequential number, then try this in D1:

    =LEFT(A1)&LEFT(C1)&TEXT(ROWS($1:1),"000000")

    then copy down.

    Hope this helps.

    Pete

+ 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] Random letter or number
    By zyzzyva57 in forum Excel General
    Replies: 8
    Last Post: 03-09-2014, 08:49 AM
  2. Create a formula to chose cells at random
    By dpgirl39 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-10-2008, 10:20 AM
  3. [SOLVED] Create a unique random number
    By Jack in forum Excel General
    Replies: 2
    Last Post: 04-19-2006, 04:20 PM
  4. Random letter and number generator
    By Marie1uk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-23-2006, 02:04 PM
  5. Replies: 12
    Last Post: 10-10-2005, 12:05 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