IdoS
IdoS

Reputation: 560

Google Query - "NOT LIKE" Statement Doesn't work

The following line doesn't work:

=QUERY(AB:AE,"select AB,AC,AD,AE where AB NOT LIKE '%Info%'",1)

Throws:

Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "AH "" at line 1, column 26. Was expecting one of: "(" ... "("

However, this one does:

=QUERY(AB:AE,"select AB,AC,AD,AE where AB LIKE '%Info%'",1)

Upvotes: 15

Views: 20870

Answers (2)

TheMaster
TheMaster

Reputation: 50472

NOT should be before column identifier:

=QUERY(AB:AE,"select AB,AC,AD,AE where NOT AB LIKE '%Info%'",1)

Upvotes: 27

Lukasz Szozda
Lukasz Szozda

Reputation: 175766

Probably column AB is nullable:

=QUERY(AB:AE,"select AB,AC,AD,AE where AB NOT LIKE '%Info%' OR AB IS NULL",1)

The Three-Valued Logic of SQL

AB + (NOT AB) + (NULL in column AB) <=> entire set

Upvotes: 3

Related Questions