+ Reply to Thread
Results 1 to 6 of 6

Remove Middle Name From Cell

Hybrid View

  1. #1
    Registered User
    Join Date
    01-18-2016
    Location
    Arizona
    MS-Off Ver
    2016
    Posts
    36

    Remove Middle Name From Cell

    Evening,

    I have a list of names in the following format: Last, First Middle. What I need is a formula that will remove the middle name, and re-arrange the format to First Last with no comma separating the names. Currently the entire name is contained in a single cell and I would like it to remain that way.

    I have:
    Gates, Bill Henry

    I want:
    Bill Gates

    Thank you for your assistance.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Remove Middle Name From Cell

    One way (data in A1)

    =TRIM(MID(SUBSTITUTE(" "&TRIM(SUBSTITUTE($A1,",",""))," ",REPT(" ",125)),125*COLUMNS($A:B),125)&" "&TRIM(MID(SUBSTITUTE(" "&TRIM(SUBSTITUTE($A1,",",""))," ",REPT(" ",125)),125*COLUMNS($A:A),125)))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,445

    Re: Remove Middle Name From Cell

    Hi,

    A shorter version might be

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE(A1,",","")," ",REPT(" ",100)),100,100)&" "&TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(A1,",","")," ",REPT(" ",100)),100)))
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    01-18-2016
    Location
    Arizona
    MS-Off Ver
    2016
    Posts
    36

    Re: Remove Middle Name From Cell

    Thank you both. Anytime I think I'm semi good with Excel, I'm reminded just how much I need to learn when I see formulas like the above. If either of you would like to expand on how the formula works feel free to. I will leave the post open a bit longer before marking as solved in case anyone wants to add anything to the thread. Thx again.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Remove Middle Name From Cell

    SUBSTITUTE($A1,",","") removes the comma, to give Gates Bill Henry.

    Then two bits like this:

    TRIM(MID(SUBSTITUTE(" "&$B1," ",REPT(" ",125)),125*COLUMNS($A:A),125))
    puts a space in front of Gates Bill Henry) and then substitutes 125 spaces for each space in " Gates Bill Henry". The MID part then starts at position 125*COLUMNS($A:A) (125*1=125) and returns the next 125 characters ("Gates" and a load of spaces). Trim removes the. Othe other bit

    TRIM(MID(SUBSTITUTE(" "&$B1," ",REPT(" ",125)),125*COLUMNS($A:b),125))

    does teh same, starting at position 125*COLUMNS($A:b) being 125*2=250, etc....

    Join em up and there's your answer...

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Remove Middle Name From Cell

    Another way:

    =LEFT(TRIM(MID(A1,SEARCH(",",A1)+1,255)),SEARCH(" ",TRIM(MID(A1,SEARCH(",",A1)+1,255)))-1)&" "&LEFT(A1,SEARCH(",",A1)-1)

+ 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. Remove middle name for end of a name string
    By maacmaac in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-30-2022, 04:44 PM
  2. [SOLVED] Remove Middle Initial from end of string or jr, sr, etc.
    By mdnuts in forum Excel General
    Replies: 5
    Last Post: 02-20-2015, 12:29 PM
  3. Replies: 2
    Last Post: 06-20-2012, 04:41 PM
  4. remove the space in the middle
    By christx in forum Excel General
    Replies: 3
    Last Post: 07-02-2007, 11:06 AM
  5. Replies: 1
    Last Post: 01-06-2006, 03:23 PM
  6. Replies: 3
    Last Post: 08-20-2005, 12:05 AM
  7. Replies: 1
    Last Post: 05-09-2005, 07:44 PM

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