+ Reply to Thread
Results 1 to 5 of 5

extract text form text string( extract 5 charactors in front of all left parenthese)

  1. #1
    Registered User
    Join Date
    07-28-2021
    Location
    usa
    MS-Off Ver
    2013
    Posts
    7

    Thumbs up extract text form text string( extract 5 charactors in front of all left parenthese)

    Dear All,

    I need to extract text form text string. there are multiple parentheses in the text string.
    There are multiple parentheses in the text string.
    My goal is to extract 5 charactors in front of all left parenthese.



    First I tried

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE("("&$A2,"(",")"),")",REPT(" ",LEN($A2))),2*LEN($A2)*(COLUMNS($A:A)),LEN($A2)))

    which works well to extract all the context inside the parentheses.

    Then I tried

    =MID(A2,SEARCH("(",A2)-5,SEARCH(")",A2)-SEARCH("(",A2)+7)

    which works well to extract the 5 charactors in front of "(" but it only works for the first "(", not all of them in the test string.

    I don't know how to combine these two to achieve my goal.

    Please kindly help me out here..

    With My Best Regards,

    PS. If anyone could explain the first formula for me that would be great.
    I am thinking if I could just edit a little based on the first formula to achieve my goal here?

    Any help would be greatly appreciated.

    Many thanks,
    Last edited by happyexcel2021; 07-29-2021 at 12:07 PM. Reason: add more information

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,738

    Re: extract text form text string( extract 5 charactors in front of all left parenthese)

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    07-28-2021
    Location
    usa
    MS-Off Ver
    2013
    Posts
    7

    Re: extract text form text string( extract 5 charactors in front of all left parenthese)

    Hi AliGW,
    Thank you for the reminder.
    I will attach my sample workbook right now.

    Thanks,

  4. #4
    Registered User
    Join Date
    07-28-2021
    Location
    usa
    MS-Off Ver
    2013
    Posts
    7

    Thumbs up Re: extract text form text string( extract 5 charactors in front of all left parenthese)

    Dear All,
    Here is the dataset.
    All the numbers are made-up number,
    Now I only could get the context inside the "()"
    I hope I could get the 5 charactors before all the"(".

    Thank you all again!

    Happyexcel2021
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: extract text form text string( extract 5 charactors in front of all left parenthese)

    If you only want the 5 characters in front of the left (open) parenthesis try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    If you want the 5 characters in front of the left (open) parenthesis and what is inside try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that which ever formula you wish to use should be pasted into cell B2 and then dragged over and down.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. Replies: 6
    Last Post: 06-26-2017, 09:04 PM
  2. Extract text between two characters in a string - varing text length
    By luv2birdie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-04-2014, 06:10 PM
  3. [SOLVED] Extract text from a given point in a text string, when data points do not share the given
    By reedersketer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-09-2014, 03:57 PM
  4. [SOLVED] Extract text from a string of text (amend formula to include new criteria)
    By robertguy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-10-2013, 04:53 PM
  5. Extract out charactors from a string
    By davidwgregg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-06-2013, 06:08 AM
  6. Extract phone number front block of text
    By Tech in forum Excel General
    Replies: 6
    Last Post: 08-08-2005, 12:05 PM
  7. [SOLVED] EXTRACT TEXT FROM TEXT STRING:The names are of variable length
    By carricka in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-08-2005, 06:05 AM

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