+ Reply to Thread
Results 1 to 5 of 5

Extract string from variable length string

  1. #1
    Forum Contributor
    Join Date
    11-22-2020
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    202

    Lightbulb Extract string from variable length string

    Hi, I have a macro that extracts the first & last name as one string from the data by using 2 x Find/Replace and then a Text To Columns. All Good. Data looks like what i have typed below. Spreadsheet attached.

    Entry
    1. John Smith (4)
    2. Karren Phillips (10)
    3. Jeff Grant (1)
    4. Dale Jones (15)
    5. Heidi Klugger (9)
    6. Janette Morris (8)

    I have seen in this forum that there is a much better way of being able to do it with a cell formula instead of macro. But I cant seem to make them work. (I am starting to understand how much I don't know and the people that contribute to this forum are indeed spectacular :-) )

    From this data, all I am looking for is the name, which is fine to be in one cell. I want to strip off the numbers at the front and the parenthesis and numbers eg (4) at the back.

    Thanks for your help.

    Jeff
    Attached Files Attached Files

  2. #2
    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,929

    Re: Extract string from variable length string

    Try this...
    =MID(LEFT(A2,FIND("(",A2)-2),FIND(".",A2)+2,99)
    copied down
    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

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Extract string from variable length string

    Jeff

    Try this formula.

    =LET(Start, FIND(" ",A2)+1,End,FIND("(",A2)-1,MID(A2,Start,(End-Start)))
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor
    Join Date
    11-22-2020
    Location
    Sydney Australia
    MS-Off Ver
    365
    Posts
    202

    Re: Extract string from variable length string

    As every day passes I am just amazed at the strength of knowledge this forum has. I am truly grateful for its existence and the contributors. Thank you from Australia,

  5. #5
    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,929

    Re: Extract string from variable length string

    Happy to help and thanks for the feedback

+ 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 a variable length number from within a text string
    By Kirk3737 in forum Excel General
    Replies: 2
    Last Post: 10-27-2020, 02:27 PM
  2. [SOLVED] how to extract specific characters from a variable-length string
    By dvess11 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-06-2018, 09:47 PM
  3. Replies: 4
    Last Post: 03-11-2016, 11:14 AM
  4. [SOLVED] Extract variable length string
    By mintymike in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-10-2015, 12:01 PM
  5. [SOLVED] how to extract variable length string
    By isurunk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-11-2014, 01:13 AM
  6. Extract variable length substring from a string
    By charron9 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-24-2013, 11:52 AM
  7. Extract Variable Length Text String
    By sshot1 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-12-2012, 06:21 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