Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 778
IdoS Avatar asked May 11 '19 18:05

IdoS


People also ask

Does not match in query Google Sheets?

Not Equal to in Query in Google Sheets Using the <> Operator You can use either of the operator <> or != in Query. Both give the same not equal to output.

How do you wildcard a query in Google Sheets?

As a wildcard, Google Sheets can use the asterisk to stand in for any symbol as well as any number of characters. Essentially, it can replace a symbol or character in a search, which means that any character can take its place in the search. For example, b*t can search bit, but, bot, boot, etc.

Can you filter a query in Google Sheets?

The Google Sheets Filter function is a powerful function we can use to filter our data. The Google Sheets Filter function will take your dataset and return (i.e. show you) only the rows of data that meet the criteria you specify (e.g. just rows corresponding to Customer A).


2 Answers

NOT should be before column identifier:

=QUERY(AB:AE,"select AB,AC,AD,AE where NOT AB LIKE '%Info%'",1)
like image 163
TheMaster Avatar answered Nov 02 '22 22:11

TheMaster


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
like image 35
Lukasz Szozda Avatar answered Nov 02 '22 21:11

Lukasz Szozda