Search code examples
regexgoogle-sheetsformula

How do I get my regexextract forumula to work in google sheets?


I'm trying to use regexextract on a list of cells in google sheets. I've tested the regular expression and it works for the string I'm trying to extract, but when I use it in google sheets, it seems to be splitting the output into a few different columns.

I tried using this formula:

=REGEXEXTRACT(C107,"[+-]?([0-9]*[.])?[0-9]+X[+-]?([0-9]*[.])?[0-9]+X[+-]?([0-9]*[.])?[0-9]+")

and was expecting this string:

WASHER SS 3.2X6X0.5 A4

to output:

3.2X6X0.5

But instead I was getting: 3. [Blank column] 0.

Split into 3 cells. Hope I've explained this problem clearly enough, and thanks in advance for reading this!


Solution

  • You can use:

    =REGEXEXTRACT(C107,".+ (\d.+) ")