Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 455
cwille Avatar asked Dec 19 '22 06:12

cwille


1 Answers

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,"[\[\(](.*)[\)\]]")
like image 194
zipa Avatar answered Dec 28 '22 08:12

zipa