+ Reply to Thread
Results 1 to 3 of 3

Need formula to split names/column

  1. #1
    Registered User
    Join Date
    04-13-2015
    Location
    QUEENSLAND, AUSTRALIA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Question Need formula to split names/column

    I have a column with names in it. I need to split them into two columns, however I can't use Text to Columns because the names are all formatted differently:

    John Smith
    John & Melinda Smith
    John Harold Smith
    John Harold Abel Smith

    The above example needs to look like this:

    John Smith
    John & Melinda Smith
    John Harold Smith
    John Harold Abel Smith


    I need a way to break it up on the following conditions:

    - If the cell contains an & symbol, break the column after the third space - FirstName & PartnerFirstName | LastName
    - If the cell does not contain an & symbol, break it after the first space.

    When I asked this question awhile ago, I had someone give me this formula:

    B1:
    =IF(ISNUMBER(SEARCH("&",$A3)),TRIM(MID(SUBSTITUTE($A3," ",REPT(" ", 100)),1,300)),TRIM(MID(SUBSTITUTE($A3," ",REPT(" ", 100)),1,100)))

    C1:
    =IF(ISNUMBER(SEARCH("&",$A2)),TRIM(MID(SUBSTITUTE($A2," ",REPT(" ", 100)),300,100)),TRIM(MID(SUBSTITUTE($A2," ",REPT(" ", 100)),100,100)))

    Unfortunately on names such as 'John Harold Smith' (3 or more word names without '&' symbols) were formatted incorrectly. The above example turned into:

    John Charles

    Any help would be appreciated! Thanks

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,366

    Re: Need formula to split names/column

    Not sure but try this, assuming your name on Column A:

    Split 1 (put on Cell C1):
    =IF(ISNUMBER(SEARCH("&",$A1)),LEFT(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1)+1)),LEFT(A1,SEARCH(" ",A1,1)-1))

    Split 2 (put on cell D1):
    =SUBSTITUTE(A1,C1,"")

    and copied down as necessary

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Need formula to split names/column

    Try this formula

    in B1 and pull formula to the right and down

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE("|"&$A1," ","|",IFERROR(IF(FIND("&",$A1),3),1)),"|",REPT(" ",75)),75*COLUMNS($A:A),75))

    Row\Col
    A
    B
    C
    1
    John Smith John Smith
    2
    John & Melinda Smith John & Melinda Smith
    3
    John Harold Smith John Harold Smith
    4
    John Harold Abel Smith John Harold Abel Smith
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Split contents of cell into single names then search for names on different sheet.
    By RichTea88 in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 12-18-2013, 10:53 AM
  2. Replies: 4
    Last Post: 01-17-2013, 03:54 PM
  3. [SOLVED] How do you split last names and two-part first names from one cell?
    By expectedlyunexpected in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 12-06-2012, 05:02 AM
  4. [SOLVED] split comma separated names in a column to a new column
    By letsxcel in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-16-2012, 10:45 AM
  5. Split column of names into multiple columns
    By madaboutgolf in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2011, 04:59 PM

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