Home > Mobile >  Google Sheets With OR in Query
Google Sheets With OR in Query

Time:09-19

I am using OR criteria in query to exclude data with specific text but it seems that OR criteria is not working. Check The below image in which I used the query function to exclude data where Column B is 'West' or 'East' but the its not working.

Click To See The Image

Any help on above will be appreciated.

Formula used:-

=QUERY(A1:B14,"Select * Where A is not null and (B<>'West' or B<>'East')")

CodePudding user response:

A1 is not null, B1 is not "East". Both are true for C1. You're looking for and. See De Morgan's law: When you negate, you use and.

=QUERY(A1:B14,"Select * Where A is not null and B<>'West' and B<>'East'")

Or

=QUERY(A1:B14,"Select * Where A is not null and not (B='West' or B='East')")

CodePudding user response:

use:

=QUERY(A1:B14, "where A is not null and not B matches 'West|East'", )
  • Related