cwille
cwille

Reputation: 69

Extract text between brackets using google spreadsheets

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.

Upvotes: 6

Views: 16039

Answers (1)

zipa
zipa

Reputation: 27879

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,"[\[\(](.*)[\)\]]")

Upvotes: 15

Related Questions