Creating segments using AND/OR logic can often be a point of confusion, especially when segment results display information you're not expecting to see.
In this document, we'll explain both "AND" logic and "OR" logic and explain how each works when using positive conditions (eg, is in list, tag exists, etc) and negative conditions (eg, not in list, tag does not exist, etc).
"AND" logic condition
With the “AND” logic condition, our system will include contacts who meet all conditions in your segment. Using “AND” logic narrows the amount of contacts that match because each of these conditions must be met.
Below are three examples illustrating "AND" logic and what outcomes you can expect to see:
Example 1: "AND" Logic with positive conditions
Let's say you are creating a segment that is using “AND” logic with the following positive conditions:
Our system will look for and include contacts who meet all three of the conditions. A contact that does not meet any of three conditions will not be included in the segment.
Example 2: "AND" logic with negative conditions
Now, let's say you are creating a segment using “AND” logic with negative conditions:
Our system will look for and include only contacts who do not have all of the tags listed in your segment.
For example, if a contact does have the “Newsletter” tag but not the other two tags, they will not be included in your segment. This is because they failed the “Tag does not exist Newsletter” condition.
It may be easier to think of “AND” logic with negative conditions as “NOR” statements. For example, contact does not have the tag, “Newsletter,” nor do they have the tag, “Presenters,” nor do they have the tag, “Conference.”
Example 3: "AND" logic with both positive and negative conditions
As a third example, let's say you are creating a segment that uses a mix of positive and negative conditions with the “AND” logic:
Our system will include contacts who have both the “Newsletter” and “Conference” tags and who do not have the “Presenters” tag. If a contact has all three tags, they will not be included in this segment because they do not meet the “tag does not exist Presenters” condition.
"OR" logic condition
With the “OR” logic condition, our system will look at each condition independently. This means that contacts only need to meet one of your conditions in order to be included. Conditions in this type of segment are NOT dependent on each other so “OR” conditions will broaden your results.
Below are three examples illustrating "OR" logic and what outcomes you can expect to see:
Example 1: "OR" Logic with positive conditions
Let's say you are creating a segment that is using “OR” logic with positive conditions:
This is how our system looks for and includes contacts based on this type of segment:
- We will first check to see if any of your contacts have the "Newsletter" tag. If we locate any contacts with that tag, they are included in your segment.
- We will then check to see if any of your contacts have the "Presenters" tag. If we locate any contacts with that tag, they too are included in your segment.
- Lastly, we will then check to see if any of your contacts have the "Conference" tag. If we locate any contacts who have that tag, they too are included in your segment.
Because these conditions are independent of each other, it will include contacts who meet only one out of three of your conditions. For example, if a contact does have the "Newsletter" tag, but does not have the other two tags, they will still be included in your segment.
Example 2: "OR" logic with negative conditions
Now, let's say you are creating a segment using “OR” logic with negative conditions:
This is how our system looks for and includes contacts based on this type of segment:
- We will first check to see if any of your contacts do NOT have the "Newsletter" tag. If we locate any contacts that do not have that tag, they are included in your segment.
- We will then check to see if any of your contacts do NOT have the "Presenters" tag. If we locate any contacts that do not have that tag, they too are included in your segment.
- Lastly, we will check to see if any of your contacts do NOT have the tag, "Conference." If we locate any contacts that do not have that tag, they too are added to your segment.
Again, a contact only needs to meet one of those conditions in order to be included your segment. It does not matter if they do not meet the other conditions. They will still be included in your segment.
This means that if a contact does NOT have the "Newsletter" tag but DOES have the "Presenters" tag, they will be included in your segment. This is because they met the “Tag does NOT exist Newsletter” condition.
If you want to exclude contacts who do not have the "Newsletter" tag, who do not have the "Presenters" tag, and who do not have the "Conference" tag, then we recommend using an “And” statement rather than an “Or” statement.
Example 3: "OR" logic with both positive and negative conditions
As a third example, let's say you are creating a segment that uses a mix of positive and negative statements with the “OR” logic condition:
This is how our system looks for and includes contacts based on this type of segment:
- We first look for contacts who have the "Newsletter" tag. If we locate any contacts who have that tag, they are included in your segment.
- We then look for contacts who do NOT have the "Presenters" tag. If we locate any contacts who do NOT have that tag, they too are included in your segment.
- Lastly, we'll look for contacts who DO have the tag, "Conference." If we locate any contacts who DO have that tag, they too are added to your segment.
If a contact has both the "Newsletter" tag and the "Presenters" tag, they will be included in your segment. This is because they met the “Tag Exists Newsletter” condition.