How to use AND , OR, NOT condition in Gmail filters?


👤 Diwas Poudel    🕒 Oct 14 2021    📁 Fix    📜 0 comment

Gmail is one of the world's most popular email clients. If you are an active Gmail user then Gmail Filter will be useful for you. It helps you find out the specific mail quickly and easily. In this article, I will be explaining to you how to use the "And", "Or", "Not" condition in Gmail Filter.

These (AND, OR, NOT) conditions/operations are logical operators. Conditions are statements that help the user to make decision-based on multiple expressions.

Let's discuss them one by one.

How to Use OR Condition Filter in Gmail?

OR means at least one of the conditions is true.

In Gmail, we can use three symbols representing Or Condition and they are:

  •  |
  • { }
  • OR

Example:
Suppose you want to search all mail send by Mail Id abc@gmail.com OR xyz@gmail.com then type :

from:abc@gmail.com OR to:xyz@gmail.com 

OR

from:abc@gmail.com | to:xyz@gmail.com 

OR

{from:abc@gmail.com to:xyz@gmail.com } 
Note OR is case sensitive so, 'or' does not work like

You can even use 3 or 4 or many Or conditions like

from:a@gmai.com OR from:b@gmail.com OR from:c@gmail.com OR from:d@gmail.com   

But the cleanness one and my favorite is using the curly bracket as shown below.

from:{ a@gmail.com b@gmail.com c@gmail.com d@gmail.com }

If you want to get particular mail to send by you to recipients.

to:({first@email.com second@email.com third@email.com})

If you want to filter among multiple words then we need to use a quotation, like shown below.

"Search1" OR "Search2" OR "Search3" 

Example: Finding out those mail which has "terms of service" OR "privacy policy" in the mail then you
can type below.

"terms of service" OR "privacy policy"

How to use "Not" Condition in Gmail Filter?

NOT conditions make true statement to false statement and false statement to true statement.

For the 'not' condition you can simply use the '-' symbol.

Also Read: How to find archive mail? How to Create archive mail in Gmail?

Example 1:  Filter for finding those mail except send to "abc@gmail.com" look as below:

-to:abc@gmail.com 

Example 2: Suppose you want to forward all messages send to the account except say abc@gmail.com and xyz@gmail.com then your Gmail filters look like this.

(-from(abc@gmail.com OR xya@gmail.com))

How to use "AND" Condition in Gmail Filter?

AND means every condition is true.

  • Evaluation of query from left to right.
  • Scanning from left, if found false then immediately stops

We are using AND condition knowingly and unknowingly. Let's look at the example of popularly used AND Condition in Gmail Filter.

1) Find unread mails from inbox

(in:inbox) and (is:unread)

or simply

(in:inbox) (is:unread)

2) Find emails only send to me

to:me and -cc:*  -bcc:* 

Here, we are requesting mail sends to me and not for any bcc and cc recipients.

FAQ:

How to exclude labels from Gmail Search?

We can take the help of AND and OR Condition operator like below:

(label:MyLabel1 AND NOT label:inbox AND NOT label:MyOldBadLabel1)

This query will include all mail that has MyLabel1 label and exclude mail having inbox label and MyOldBadLabel1.

2 How to Filter emails that are not labeled ?
has:nouserlabels -label:Inbox -label:sent -label:Chats -label:drafts -label:trash