Search code examples
arraysgoogle-sheetsgoogle-sheets-formulamatchgoogle-query-language

Can you use and/or together in a Query function on google sheets


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)

Solution

  • 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)