Sometimes, it's not obvious that setting a filter can include a logical expression (or boolean operator, in other words) more than one value in each of the fields, like "From:", "To:", "Has the words:" or "Doesn't have:"

For example, if you want to check whether specific email is designated to either one of two email addresses (or nicknames) you own, you can put in "To:" field something like: OR

So, what if you'd like to create a filter which stars all emails sent to you directly (in to: field) but not when you're in cc: or bcc:?

In that case, your filter will look like this:

In "To:" field put "to:me" and set "doesn't have" field to "cc:me OR bcc:me". In addition to "OR" you can also use operator "AND" and operator "NOT" (which you can also reference to as "-", i.e. minus).

See Google's guide for Boolean operators in searches and filters here.

As a reminded what each boolean operator do, you can use the famous Venn diagram:

Do you know additional useful logical expressions which can be used in search and filters for Gmail? You're welcome to share it here..
AuthorVadim Solovey