Search code examples
google-sheetswhere-clause

Refining a Query formula with two 'where' conditions


I need to write a Query formula to pull through unique values from another sheet, excluding rows that contain certain keywords and also excluding any empty rows.

I've written this formula:

=UNIQUE(QUERY('Sheet Name'!A1:AZ,"Select A where A is not null and where not A contains 'STRING'",1))

Unfortunately this gives a VALUE error. It works with either of the 'where' clauses but not with both.

What am I missing?


Solution

  • You don't need to add the seconde 'Where', it just implies that you continue to add conditions into that statement:

    =UNIQUE(QUERY('Sheet Name'!A1:AZ,"Select A where A is not null and not A contains 'STRING'",1))