+ Reply to Thread
Results 1 to 8 of 8

Extracting Middle Name/Initial when name fields look like First Mid Last

  1. #1
    Registered User
    Join Date
    04-30-2011
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    5

    Extracting Middle Name/Initial when name fields look like First Mid Last

    I've uncovered excellent text conversion formulas to extract both the first name and last name from an 800+ column of names that look like:
    Davy J Jones
    Marcus Welby
    Anthony Lazy Denosso
    Janis Joplin
    Mark T Seager
    Mary Jean Post
    Some fields have middle names an/or initials, but not all. I cannot find a formula to extract the middle name and/or initial, that also will result in a blank field if there is no middle name/initial.

    See attached test file....

    Can anyone help?
    Attached Files Attached Files
    Last edited by kmn; 04-30-2011 at 02:18 PM. Reason: add a attachment

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Extracting Middle Name/Initial when name fields look like First Mid Last

    You can use the following for the middle name

    Please Login or Register  to view this content.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Extracting Middle Name/Initial when name fields look like First Mid Last

    With your formulae in B2, D2, and E2

    Try this in C2
    Please Login or Register  to view this content.

    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Extracting Middle Name/Initial when name fields look like First Mid Last

    That woulldn't work for a name like "John Jo Johnson" though

    Try

    =IF(COUNTIF(A2,"* * *"),TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",49)),49,49)),"")
    Audere est facere

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Extracting Middle Name/Initial when name fields look like First Mid Last

    True DLL

    How about then in C2
    Please Login or Register  to view this content.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Extracting Middle Name/Initial when name fields look like First Mid Last

    why not just wrap what you have already in iferror?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Registered User
    Join Date
    05-14-2013
    Location
    Columbus, OHIO
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Extracting Middle Name/Initial when name fields look like First Mid Last

    To convert First Middle Last to Last First Middle:

    =IF(RC[-1] > " ",TRIM(RIGHT(SUBSTITUTE(RC[-1]," ",REPT(" ",255)),255)) & " " & LEFT(RC[-1],FIND(" ",RC[-1])-1) & " " & IF(LEN(RC[-1])-LEN(SUBSTITUTE(RC[-1]," ",""))>1,TRIM(SUBSTITUTE(SUBSTITUTE(RC[-1], LEFT(RC[-1],FIND(" ",RC[-1])-1),""), TRIM(RIGHT(SUBSTITUTE(RC[-1]," ",REPT(" ",255)),255)),"")),""),"")

  8. #8
    Forum Contributor
    Join Date
    12-11-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    232

    Re: Extracting Middle Name/Initial when name fields look like First Mid Last

    Quote Originally Posted by david.f.mayer View Post
    To convert First Middle Last to Last First Middle:

    =IF(RC[-1] > " ",TRIM(RIGHT(SUBSTITUTE(RC[-1]," ",REPT(" ",255)),255)) & " " & LEFT(RC[-1],FIND(" ",RC[-1])-1) & " " & IF(LEN(RC[-1])-LEN(SUBSTITUTE(RC[-1]," ",""))>1,TRIM(SUBSTITUTE(SUBSTITUTE(RC[-1], LEFT(RC[-1],FIND(" ",RC[-1])-1),""), TRIM(RIGHT(SUBSTITUTE(RC[-1]," ",REPT(" ",255)),255)),"")),""),"")
    Ok,
    that is just crazy looking right there.

+ 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