+ Reply to Thread
Results 1 to 6 of 6

Please help. poss VBA

  1. #1
    Forum Contributor
    Join Date
    01-25-2005
    Location
    Cardiff, Wales
    MS-Off Ver
    Mac 365 & M/S 365
    Posts
    107

    Please help. poss VBA

    Hi all,

    I have been trying to get a unique ID for a number of entries on my spreadsheet, the way I have came up with this is Initial first name, Initial second name, date of birth & initial of gender.

    It looks like this L-F-12/10/1966-M, but now the number of entries of the spreadsheet is getting greater and greater daily and it would be nice to automate this feature to save a bit of time.

    Is there a way that this can be done, your help is greatly appreciated.

    Cheers

  2. #2
    Forum Contributor
    Join Date
    08-07-2004
    Location
    Ohio, USA
    Posts
    114
    how is your data laid out?
    where should it be going

    first name is in cell A1 (First)
    Second name is in cell A2 (Second)
    Birthdate is in cell A3 99/99/9999
    Gender is in cell A4 Gender

    a formula such as

    = LEFT(N26,1) & LEFT(N27,1) & N28 & LEFT(N29,1)

    would give you FS99/99/99G

    or if you want the "-"

    =LEFT(N26,1) & "-" & LEFT(N27,1) & "-" & N28 & "-" & LEFT(N29,1)

    would give you F-S-99/99/9999-G

  3. #3
    paul.robinson@it-tallaght.ie
    Guest

    Re: Please help. poss VBA

    Assuming first name is in column A, second name is in column B, date of
    birth is in column C and Gender is in column D (as M or F) then in
    column E put the formula
    =Left(A1,1)&"-"&Left(B1,1)&"-"&C1&"-"&D1

    regards
    Paul


  4. #4
    Forum Contributor
    Join Date
    01-25-2005
    Location
    Cardiff, Wales
    MS-Off Ver
    Mac 365 & M/S 365
    Posts
    107
    Thanks both,

    but there seems to be another problem.

    The date is being shown as five numbers, as if the cell hasn't been formated.

    i.e. J-L-29288-M

    I have tried to format the cell which the formula is in, but nothing.

  5. #5
    paul.robinson@it-tallaght.ie
    Guest

    Re: Please help. poss VBA

    Hi
    Try
    =Left(A1,1)&"-"&Left(B1,1)&"-"&text(C1,"dd/mm/yy")&"-"&D1

    regards
    Paul


  6. #6
    Forum Contributor
    Join Date
    01-25-2005
    Location
    Cardiff, Wales
    MS-Off Ver
    Mac 365 & M/S 365
    Posts
    107
    Paul, you are a star !!

    Thanks very much.

+ 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