Jerry
Jerry

Reputation: 107

How to query match a split string in Google Sheets?

How to take a professional photograph

I want to query the above sentence and see if each word above 4 letters is contained within a list.

I want the output to be the words that match.

Ex: professional, photograph

I tried split + query + regex to no avail :(

Upvotes: 0

Views: 1207

Answers (2)

Jerry
Jerry

Reputation: 107

With Mike's help, I figured it out!

=FILTER(SPLIT(B3," "),LEN(SPLIT(B3," "))>4)

Thanks Mike!

Upvotes: 2

Mike Steelson
Mike Steelson

Reputation: 15318

Try

=arrayformula(sum(--REGEXMATCH(filter(split(A1," "),len(split(A1," "))>3),TEXTJOIN("|",,list))))=counta(filter(split(A1," "),len(split(A1," "))>3))

with list = list of words, A1 the sentence

enter image description here

Upvotes: 1

Related Questions