+ Reply to Thread
Results 1 to 10 of 10

Need excel formula to create unique usernames.

  1. #1
    Registered User
    Join Date
    11-09-2012
    Location
    San Francisco
    MS-Off Ver
    Excel 2010
    Posts
    7

    Need excel formula to create unique usernames.

    I really need to get this done as soon as possible. Any help will be greatly appreciated. I would look in seperate threads but after surfing the net for about 3 hours I cannot find anything that will help me in this situation. I am using Microsoft Excel 2010, btw.

    So far I have a column A which has the firstname and Column B which has the last name of the users and i want to make a unique user name for them. I use the formula =LOWER(CONCATENATE(LEFT(A2,1),LEFT(B2,5),)) to create a username e.g. John Smith being jsmith; however there are multiple John Smiths that I need to create usernames for. Is there a way to use an IF function to tell if the username already exists and if so to add a digit, starting with 0, on to the the username making it unique, e.g. if i have 4John Smiths the usernames would be jsmith0, jsmith1, jsmith2, and jsmith3, etc...?

    If there is not way to do this using a formula can someone please point me in the direction of asking the proper people?

    This issue is very urgent as i need to create usernames daily and about 1500 per year in mass. The person who used to handle user name creation is no longer here, but I feel most comfortable doing this in excel.

    Thank You for all your help!

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

    Re: Need excel formula to create unique usernames.

    This is possible with the match function but very dangerous.

    imagine that you get the formulas working and then decide to insert another user, or even to sort the users.

    Sorting by any criteria, Age, ***, Firstname, Surname, Date Of Birth, Payroll number, will reorganise your users in the column.

    Unfortunately all your added numbers will change. Wooooooops.

    I therefore think you need to use a Macro to do this.

    This Macro will use the match function, but once allocated the added number can be fixed using the copy paste value function.

    There are numerous ways that the macro could operate. but possible the bestway is using a userform. So what data do you need to collect for each user?

    Please consider that while I ponder on this.

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

    Re: Need excel formula to create unique usernames.

    Something like this?
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-27-2012
    Location
    London
    MS-Off Ver
    Excel 2007-2010
    Posts
    59

    Re: Need excel formula to create unique usernames.

    Hey,

    Formulas on Row 2:
    Column A is First Name, John
    Column B is Surname, Smith
    Column C is non unique username, formula =Lower(TRIM(left(A2,1)))&Lower(TRIM(B2))
    Column D is Unique username, formula =IF(COUNTIF(C:C,C2)=1,C2&"0",C2&COUNTIF($C$2:C2,C2)-1)

    HOWEVER, I have only tested this on a small made up sample. This will leave all unique usernames as dynamic usernames based on active formulas. Therefore if the data is changed or users inserted randomly in the table and not at the bottom of the table the usernames will update and not be the same as the usernames you have issued to users.

    I would consider this a very risky method unless incorporated into a macro which creates a static user database.

    HTH
    Last edited by Break_Point; 03-01-2013 at 04:11 PM. Reason: matching your username style jsmith1

  5. #5
    Registered User
    Join Date
    11-09-2012
    Location
    San Francisco
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Need excel formula to create unique usernames.

    I always pre-sort the data before Im going to create the usernames. This is more like a one time thing. I do not need to keep the file after the usernames are created.

    Basically, what ill be doing is pulling a list of all users and usernames from our LDAP server and compiling them to and excel file. Afterward I will merge this list with new user data and by sorting the users that do not have usernames last copy the formula to those users. Once this process is done i basically copy the usernames, create passwords for them in a seperate program, and finally insert them through a mass import to their respective LDAP ou's.

    Ultimately I would like to stay away from a macro because no one in my office except for me knows how to run macro's nor do i have the time to teach them. In case of my absence I need someone to be able to do this one the fly perferable with a formula; but if there is no other way i can settle for anything at this point.

    Thanks again for all your help! Im really lost on this one.

  6. #6
    Registered User
    Join Date
    11-09-2012
    Location
    San Francisco
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Need excel formula to create unique usernames.

    To popipipo

    This seems like it might work for my uses. Im going to test it out and get back to you.

    Once again thanks for the help.

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

    Re: Need excel formula to create unique usernames.

    I would use something like this.

    There is a lot of functionality built in.

    I will try add complete this project tomorrow, but I thought you might like a preliminary view.

    I have got the find button working for birthdays and payroll numbers.
    when searching birthdays ( usernames and first and last names will be similar ), the userform populates the combobox

    selecting a item from the combobox will populate the userform and highlight an entry. Delete will delete that entry.

    entering a payroll number and pressing find will populate the userform and highlight an entry. Delete will delete that entry.

    pressing clear will clear the userform
    Attached Files Attached Files

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

    Re: Need excel formula to create unique usernames.

    Ok

    I Have finished this project to my satisfaction.

    Enjoy it and feel free to adapt it as required.
    Attached Files Attached Files

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Need excel formula to create unique usernames.

    This is possible with the match function but very dangerous.

    imagine that you get the formulas working and then decide to insert another user, or even to sort the users
    what? why would you do that?

    formula is this filled down
    =IF(A2="","",LEFT(A2)&" "&B2&SUMPRODUCT(--(LEFT($A$1:A2)=LEFT(A2)),--($B$1:B2=B2)))
    or
    =IF(A2="","",LEFT(A2)&" "&B2&(SUMPRODUCT(--(LEFT($A$1:A2)=LEFT(A2)),--($B$1:B2=B2))-1))
    Last edited by martindwilson; 03-02-2013 at 05:17 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  10. #10
    Registered User
    Join Date
    07-28-2016
    Location
    Sonoma, California
    MS-Off Ver
    2013
    Posts
    1

    Re: Need excel formula to create unique usernames.

    Similar circumstance but have new accounts to add to existing accounts using the next number available. For example: In list A jsmith may already has jsmith1, jsmith2, jsmith3. In list B I have an addition jsmith I would like to import the next number, jsmith4. What is the formula for comparing the two lists and returning the value of last number after jsmith in list B? If not a duplicate then return jsmith0 in list b.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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