Consulting

Results 1 to 4 of 4

Thread: Splitting first, middle initial, and last name

  1. #1

    Splitting first, middle initial, and last name

    I have looked everywhere for an answer on this so I am hoping someone will be able to help me out here!

    If I have names entered in my A column such as:

    Joe Johnson
    Calvin Bryant IV
    Matt K. Smith
    John P. Doe Jr.


    How can I break them up so that the first name, middle initial, and last name with the suffix go in three separate columns? Is this something that would need a VBA code? When looking at other people's answers, their formulas never worked for what my issue is.

    Thanks!

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    You can 99% of the way. Take a name like your Calvin Bryant IV, to us humans we're pretty certain this is first name Colin, lastname Bryant with suffix IV. We could write some code that when letters like IV appear at the end that it's taken to be roman numerals and interpreted as a lastname suffix. But what if you have a name such as Lee Hung XI? Is it Lee Hung the eleventh, or is the last name Xi?

    Are all the names like your examples or are there further variations such as:
    Matt J. W. Johnson
    Harrison K
    Mr. Obama
    Doe John

    This can get quite involved, so could you supply a bigger sample of a few hundred names (you can do a search and replace first if these names are in any way sensitive)?
    Also, re:"I have looked everywhere for an answer on this", try a Google with:
    excel vba split first name last name
    It may come up with something useful.
    Last edited by p45cal; 06-17-2014 at 08:23 AM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  4. #4
    Figured it out! Thanks guys!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •