Extract text between brackets using google spreadsheets

13,401

You have regular brackets so use:

=REGEXEXTRACT(X3,"\((.*)\)")

Or change your formula to

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

If you have both () and [] in your data you can use:

=REGEXEXTRACT(X3,"[\[\(](.*)[\)\]]")
Share:
13,401
cwille
Author by

cwille

Updated on June 08, 2022

Comments

  • cwille
    cwille about 2 years

    I want to extract the text between brackets in a cell (X3), but the usual excel formulas give a parse error in google spreadsheets.

    For example:

    =MID(X3,FIND("[",X3)+1,FIND("]",X3)-FIND("[",X3)-1)
    

    How to fix this parse error?

    Thanks in advance.

  • cwille
    cwille about 7 years
    It still doesn't work (parse error) A screenshot of my spreadsheet on the link below: drive.google.com/open?id=0B1fiv0AmtbFBQTVKYVF6LThfaGM
  • zipa
    zipa about 7 years
    @cwille That is a link for locked drive document.
  • zipa
    zipa about 7 years
    @cwille Both formulas work, the problem might be in X3
  • cwille
    cwille about 7 years
  • zipa
    zipa about 7 years
    Your brackets aren't [] they are ()
  • roadsunknown
    roadsunknown over 5 years
    @zipa Super weak at Regex, if I wanted just [], what would the regex be?