+ Reply to Thread
Results 1 to 8 of 8

extract name based on condition

  1. #1
    Forum Contributor
    Join Date
    07-20-2009
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    203

    extract name based on condition

    hi,

    is there a way that i can choose what to extract in a certain name? let say the name is Ma. angela jones, i dont want to extract the "Ma." so ill extract "jones". the other sample is Jones, Rick C. so i'll extract jones not "c.". bottom line is i'm not gonna extract if only 2 or 1 letter/s in the first or last cell.


    thanks for help

  2. #2
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: extract name based on condition

    what happened to "angela" and "rick"??

    Please explain clearly what data you have and what you want the result to be, by giving explicit examples of pre- and post- solution
    When I say semicolon, u say comma!

  3. #3
    Forum Contributor
    Join Date
    07-20-2009
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    203

    Re: extract name based on condition

    hi L-Drr!

    Sorry for the confusion. Let say if cell A1 is "Ma. angela jones" and i want to extract the first name so 'ill use a formula in B1 "=LEFT(A1,FIND(" ",A1,1)-1)". But since the result is only 2 letters (Ma.), instead of extracting the first name ill extract the last name to get "jones". forget "angela".

    i have a list of names in A1. the problem is, there's a lot of names with "Ma.", or the middle name is in the first position (C. Rick, Jones) that's why i want this formula so there would be no duplicate once i extract the names.

    thanks you so much!

  4. #4
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: extract name based on condition

    So to rephrase: the formula should result in the first piece of text (up to the first space), unless this is 3 characters or less, in which case the result should be the last piece of text (from the last space untill the end). Am I right?

  5. #5
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: extract name based on condition

    Can you please upload a sample work book

  6. #6
    Forum Contributor
    Join Date
    07-20-2009
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    203

    Re: extract name based on condition

    here's the sample workbook for reference. thanks to both of you!
    Attached Files Attached Files

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: extract name based on condition

    Based on your sample data, use this, copied down...
    =IF(SEARCH(" ",A2,1)<=4,MID(A2,SEARCH(" ",A2,SEARCH(" ",A2,1)+1)+1,99),LEFT(A2,SEARCH(" ",A2,1)-1))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  8. #8
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: extract name based on condition

    Quote Originally Posted by FDibbins View Post
    Based on your sample data, use this, copied down...
    =IF(SEARCH(" ",A2,1)<=4,MID(A2,SEARCH(" ",A2,SEARCH(" ",A2,1)+1)+1,99),LEFT(A2,SEARCH(" ",A2,1)-1))
    Exactly what I was thinking of except for the MID(second space, 99 characters) I would have gone for RIGHT(LEN minus second space), but I guess it's pretty safe to say there are no Phillipine namnes with more than 99 characters

+ 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] Extract data based upon Yes/No condition
    By dramadog in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-07-2012, 05:15 PM
  2. Extract from multiple worksheets based on one condition and output to new workbook
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 01-23-2012, 05:05 PM
  3. Select worksheet based on condition & populate cell based on condition
    By beth1069 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-19-2011, 01:27 PM
  4. I wanT to extract Multiple-Records based on a condition.
    By all4excel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-15-2007, 02:00 PM
  5. [SOLVED] Extract String based on condition
    By Send Object Command - Two attachments in forum Excel General
    Replies: 4
    Last Post: 11-02-2005, 06:17 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