+ Reply to Thread
Results 1 to 2 of 2

Code to generate a unique reference

  1. #1
    Forum Contributor
    Join Date
    04-22-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    329

    Code to generate a unique reference

    Good day all once again,

    I need a code that will generate a unique reference based on a users inputted name, eg. if the name entered in cell "A1" = "John" & the surname in cell "B1" = "Smith", then I need a returned value of "JS1", however if later a new user registers as Jerry Smythe the code will lookup for the same initials & the returned value would then be "JS2", any assistance as always will be greatly appreciated, thank you all & have a great day - Marco

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

    Re: Code to generate a unique reference

    you could use in c1 filled down
    =IF(A1="","",LEFT(A1)&LEFT(B1)&SUMPRODUCT(--(LEFT($A$1:A1)=LEFT(A1)),--(LEFT($B$1:B1)=LEFT(B1))))
    Attached Files Attached Files
    Last edited by martindwilson; 02-24-2013 at 08:22 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

+ 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