+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Formula for extraction of text in bracket

  1. #1
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Formula for extraction of text in bracket

    Hi, I'm trying to get a formula to extract some text from a cell. The cells have different length, but the info that I wanted is surrounded with a bracket. Please refer to the attachment. Appreciate if someone can provide me the formula to do so. Thanks a lot in advance.
    Attached Files Attached Files
    Last edited by bernard.x; 12-08-2010 at 02:18 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Formula for extraction of text in bracket

    Hi Bernard,

    For question 1, try:

    =MID(A5,FIND("(",A5)+1,LEN(A5)-FIND("(",A5)-2)

    For question 2 first result, try:

    =MID(E5,FIND("(",E5)+1,FIND(")",E5)-FIND("(",E5)-1)

    For question 2 second result, try:

    =MID(E5,FIND("^",SUBSTITUTE(E5,"(","^",2))+1,FIND("^",SUBSTITUTE(E5,")","^",2))-FIND("^",SUBSTITUTE(E5,"(","^",2))-1)

    The last formula assumes you won't have a ^ symbol in your text. If so, pick another symbol to use.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,611

    Re: Formula for extraction of text in bracket

    An Option:
    Attached Files Attached Files
    Ben Van Johnson

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Formula for extraction of text in bracket

    Ben, if you check your last formula (the second result for question 2) you'll see that it only works in the sample data because the values between the first set of parenthesis is always 4 characters long. If you change it to any other length it fails to return the correct string.

    It pretty much returns a string length from the last set of parenthesis equivalent to the length of the string in the first set.

  5. #5
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Formula for extraction of text in bracket

    Thanks Paul and Ben ! Excellent solution, you guys are awaresome.

+ 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