---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/cohorts/cel/common-filtering-patterns#article
headline: Common filtering patterns
description: Examples of filter criteria for common Twilio Cohorts audience-segmentation patterns.
url: https://www.twilio.com/docs/cohorts/cel/common-filtering-patterns
inLanguage: en
dateModified: 2026-09-23T10:34:53.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# Common filtering patterns

## Filter by a single trait

```txt
profile.trait.Account.plan == "enterprise"
```

## Combine multiple trait conditions

```txt
profile.trait.Account.status == "active" && profile.trait.Account.country == "US"
```

## Exclude profiles that match a condition

Use `!` to invert a condition. Field access has higher precedence than `!`, so you don't need parentheses around a single field reference.

```txt
!profile.trait.Account.isTest && profile.trait.Account.status == "active"
```

## Match against a list of values

Use `in` instead of chaining several `==` comparisons with `||`.

```txt
profile.trait.Account.country in ["US", "CA", "MX"]
```

## Filter on an address

Because address references always return lists, check for membership or presence instead of comparing them directly to a string.

```txt
"jane@example.com" in profile.address.email
```

```txt
has(profile.address.phone)
```

## Combine a trait condition with an address condition

```txt
profile.trait.Account.status == "active" && profile.address.email.exists(e, e.endsWith("@example.com"))
```

## Numeric range

```txt
profile.trait.Account.lifetimeValue >= 100 && profile.trait.Account.lifetimeValue < 1000
```

## Guard a comparison with a presence check

If a trait might be missing and you want to exclude those profiles explicitly, pair the comparison with `has()`.

```txt
has(profile.trait.Account.lastPurchaseDate) && profile.trait.Account.lastPurchaseDate > timestamp("2026-01-01T00:00:00Z")
```

## Combine values with arithmetic

You can also apply arithmetic operators to combine multiple traits into a single derived condition.

```txt
profile.trait.Account.lifetimeValue - profile.trait.Account.totalRefunds > 500
```

```txt
profile.trait.Engagement.emailOpens + profile.trait.Engagement.smsClicks >= 10
```

## Match a concatenated string

String concatenation with `+` lets you build a composite value to compare against.

```txt
profile.trait.Contact.firstName + " " + profile.trait.Contact.lastName == "Jane Doe"
```

## Filter with a conditional expression

Use the ternary operator (`?:`) when the condition you want to filter on depends on another trait. It evaluates a condition and returns one Boolean when it's true and another when it's false.

```txt
profile.trait.Account.plan == "enterprise" ? profile.trait.Account.lifetimeValue > 10000 : profile.trait.Account.lifetimeValue > 1000
```

## Next steps

* Review [operators and precedence](/docs/cohorts/cel/operators-and-precedence) when combining several conditions.
* Review the complete [functions reference](/docs/cohorts/cel/functions).
