Zach Smith
Zach Smith

Reputation: 8961

String manipulation on column in Google Sheet Query

Is it possible to do a string manipulation of data in a Google Sheet query?

I want to do something like the following:

=QUERY(someRange!A:Z, SELECT A, SUBSTITUTE(B, "OCH", ""))

The idea being that all rows' column B is 'OCHXXXXXXX' where X is a digit. I would like to get rid of the chars.

On a side note... Is this possible in MySQL? How?

Upvotes: 0

Views: 2229

Answers (2)

Chris Hick
Chris Hick

Reputation: 3094

This formula might work for you:

=QUERY({Sheet1!A:A,ARRAYFORMULA(SUBSTITUTE(Sheet1!B:B,"OCH","")),Sheet1!C:Z})

Upvotes: 2

Ed Nelson
Ed Nelson

Reputation: 10259

I would suggest:

=arrayformula(REGEXREPLACE(somerange!B:B, "OCH", ""))

Upvotes: 1

Related Questions