+ Reply to Thread
Results 1 to 5 of 5

Splitting names

  1. #1
    Registered User
    Join Date
    03-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    48

    Splitting names

    Hi

    I have written the following formula to split a name field into first and last names. It also has an error check where the last name only is given.

    It all works perfectly when there is a first and last name, but it misses off the first character when there is a surname only.

    Can anyone help please?

    =UPPER(IF(ISERROR(FIND(" ",A1,1)),LEFT(A1,FIND("",A1,1)-1),LEFT(A1,FIND(" ",A1,1))))

    The above formula is used to find the leftmost character before the space and works perfectly every time.

    =UPPER(IF(ISERROR(FIND(" ",Q3,1)),RIGHT(Q3,LEN(Q3)-FIND("",Q3,1)),RIGHT(Q3,LEN(Q3)-FIND(" ",Q3,1)-0)))

    This formula works perfectly where there is a first name, but always returns the last name minus the first character where there is only a last name given.

    I have attached a spreadsheet showing this.

    Thanks

    Ken
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Splitting names

    If there are no spaces, then you want to bring the entire "name" into Col D so the formula in D should be

    =UPPER(IF(ISERROR(FIND(" ",A1,1)),A1,RIGHT(A1,LEN(A1)-FIND(" ",A1,1)-0)))

    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Contributor
    Join Date
    08-01-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Splitting names

    =UPPER(IF(ISERROR(FIND(" ",A1,1)),RIGHT(A1,LEN(A1)-FIND("",A1,1)+1),RIGHT(A1,LEN(A1)-FIND(" ",A1,1)-0)))does this work for you?

  4. #4
    Registered User
    Join Date
    03-15-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Splitting names

    SOLVED

    Thanks guys

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Splitting names

    @ rwl518p

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

+ 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