Home > Enterprise >  Why can't I use multiple LIKE NOT in google query?
Why can't I use multiple LIKE NOT in google query?

Time:04-16

I am currently trying to narrow down my data. I want to eliminate certain values that I do not want to pull in the query.

First I want to eliminate the - (dash)

=query(A1:B,"select A where NOT A LIKE '%-%'") 
That works, 

But, if I want to continue to narrow down my data I use

=query(A1:B,"select A where NOT A LIKE '%-%' or NOT A LIKE '%WOLF%'")

That does not work. Instead of narrowing down my data it adds the dash back and keeps wolf . How can I keep using NOT like for multiple strings? enter image description here

CodePudding user response:

Use parentheses to make the logic easier to follow, like this:

=query(A1:A, "where not (A like '%-%' or A like '%WOLF%')", 0)

CodePudding user response:

better to use regex like:

=QUERY(A1:A, "where not A matches '.*-.*|.*WOLF.*'")
  • Related