I am trying to use the below function which works when "not" is removed.
QUERY(Sheet!A:L,"SELECT A,G,H,I,J,K WHERE F='City' AND H='model' AND I>=Number AND (not C contains 'AA1' or not C Contains 'AB1')",1)
I am trying to use the below function which works when "not" is removed.
QUERY(Sheet!A:L,"SELECT A,G,H,I,J,K WHERE F='City' AND H='model' AND I>=Number AND (not C contains 'AA1' or not C Contains 'AB1')",1)
we can test with matches and regex. if it still not working for you then the dataset is insufficient.
=QUERY(Sheet!A:L,
"SELECT A,G,H,I,J,K
WHERE F='City'
AND H='model'
AND I>=Number
AND not C matches 'AA1|AB1'", 1)
Just a postscript to this, if you did want to use Contains it should be
=QUERY(Sheet1!A:L,"SELECT A,G,H,I,J,K WHERE F='City' AND H='Sedan' AND I>=2016 AND not (C contains 'BMW 3 series' or C Contains 'Audi A4')",1)
Your original formula would only exclude a row that contained both BMW 3 series and Audi A4 because
(not C contains 'BMW 3 series' or not C Contains 'Audi A4'",1)
is equivalent to
not (C contains 'BMW 3 series' and C Contains 'Audi A4'",1)
So given the following data
Your formula would retrieve
while the correct result is