> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allgoodhq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Formula recipes

> Copy-ready formulas for list filters and columns, with before and after examples, plus Salesforce and fixed-date examples you adapt to your own fields.

Copy a recipe, paste it into the **ƒx** box, and change the values to match your data. Recipes are grouped by where you use them: the **Filters** section of a list or the **Columns** section. Each one shows a before and after so you can check it against a real record. New to formulas? Start with [What formulas are and when to use one](https://docs.allgoodhq.com/mk/formulas/what-formulas-are.md).

Every recipe in the first two sections uses standard `person` and `company` fields, so it works in any account. The Salesforce and date recipes use placeholder field names. Replace them with names from your own **Data Shape** page. See [How formulas find your data](https://docs.allgoodhq.com/mk/formulas/how-formulas-find-your-data.md).

In every table, the quotes around text show where it starts and ends. The quotes are not part of the value. Rows marked "same formula" use the formula from the row above.

## Filter recipes

Paste these into **Filters**. Each gives back true or false. Every one starts with an `exists()` check, so records with a blank field leave the list. See [Handle blank and messy values in formulas](https://docs.allgoodhq.com/mk/formulas/handle-blank-values.md) for why.

### Keep only work email addresses

Leaves out people whose email is on a free provider. Add or remove domains to suit you.

```
exists($`person.email`) && !['gmail.com', 'yahoo.com', 'outlook.com', 'hotmail.com'].includes($`person.email`.toLowerCase().split('@')[1])
```

| Email | After |
| - | - |
| `'ana@Acme.com'` | `true` (stays) |
| `'Bo@GMAIL.com'` | `false` (leaves) |
| No value | `false` (leaves) |

### Keep senior titles

Matches any title that contains one of the words, in any capitalization.

```
exists($`person.title`) && ['vp', 'director', 'head of', 'chief'].some(t => $`person.title`.toLowerCase().includes(t))
```

| Title | After |
| - | - |
| `'VP of Sales'` | `true` |
| `'Chief Of Staff'` | `true` |
| `'Analyst'` | `false` |
| No value | `false` |

Words match anywhere in the title, so `'vp'` also matches a title with those letters inside a longer word. Check your results on a few real records.

### Leave out interns and students

```
exists($`person.title`) && !['intern', 'student', 'assistant'].some(t => $`person.title`.toLowerCase().includes(t))
```

| Title | After |
| - | - |
| `'Marketing Intern'` | `false` |
| `'Director'` | `true` |
| No value | `false` |

### Keep companies in a size band

```
exists($`company.employeeCount`) && $`company.employeeCount` >= 100 && $`company.employeeCount` < 1000
```

| Employee count | After |
| - | - |
| `250` | `true` |
| `1200` | `false` |
| No value | `false` |

### Find records missing key details

Keeps people who lack at least one of the three.

```
!exists($`person.email`, $`person.firstName`, $`person.title`)
```

| Email | First name | Title | After |
| - | - | - | - |
| `'a@b.co'` | `'A'` | `'X'` | `false` |
| `'a@b.co'` | `''` | `'X'` | `true` |

### Keep people in one of several lifecycle stages

```
['lead', 'mql', 'sql'].includes($`person.lifecycleStage`)
```

| Lifecycle stage | After |
| - | - |
| `'mql'` | `true` |
| `'customer'` | `false` |
| No value | `false` |

### Keep people who have not unsubscribed

```
$`person.lifecycleStage` == 'lead' && $`person.consent` != 'unsubscribed'
```

| Lifecycle stage | Consent | After |
| - | - | - |
| `'lead'` | `'subscribed'` | `true` |
| `'lead'` | `'unsubscribed'` | `false` |

> [!NOTE]
>
> A person with no consent value passes `!= 'unsubscribed'`, because no value is not equal to that text. If you want only people with a known consent, add `exists($`person.consent`) &&` at the start.

### Match an email ending

Use this for a school or country domain.

```
exists($`person.email`) && $`person.email`.toLowerCase().endsWith('.edu')
```

| Email | After |
| - | - |
| `'a@mit.edu'` | `true` |
| `'a@acme.com'` | `false` |

## Column recipes

Paste these into **Columns**. Each gives back a value for every row. Most return no value for a blank field, so the cell stays empty instead of showing `0` or the word `null`.

### Show a full name, even when a piece is missing

```
(($`person.firstName` ?? '') + ' ' + ($`person.lastName` ?? '')).trim()
```

| First name | Last name | After |
| - | - | - |
| `'Ann'` | `'Lee'` | `'Ann Lee'` |
| `'Ann'` | No value | `'Ann'` |
| No value | No value | `''` (empty text) |

### Show initials

```
(($`person.firstName` ?? '').charAt(0) + ($`person.lastName` ?? '').charAt(0)).toUpperCase()
```

| First name | Last name | After |
| - | - | - |
| `'jordan'` | `'rivera'` | `'JR'` |
| `'Ann'` | No value | `'A'` |
| No value | No value | `''` |

### Fix a name typed in odd capitalization

```
exists($`person.firstName`) ? $`person.firstName`.charAt(0).toUpperCase() + $`person.firstName`.slice(1).toLowerCase() : null
```

| First name | After |
| - | - |
| `'jORDAN'` | `'Jordan'` |
| No value | No value (empty cell) |

### Show the email domain

```
exists($`person.email`) ? $`person.email`.split('@')[1] : null
```

| Email | After |
| - | - |
| `'jordan@acme.com'` | `'acme.com'` |
| No value | No value |

### Clean up a phone number

Removes dashes, spaces, and parentheses.

```
$`person.phone`.replaceAll('-', '').replaceAll(' ', '').replaceAll('(', '').replaceAll(')', '')
```

| Phone | After |
| - | - |
| `'(415) 555-2671'` | `'4155552671'` |
| No value | No value |

### Shorten a long title

```
$`person.title`.slice(0, 20)
```

| Title | After |
| - | - |
| `'Senior Manager, Demand Generation'` | `'Senior Manager, Dema'` |
| `'VP'` | `'VP'` |

### Label seniority

```
exists($`person.title`) ? (['vp', 'director', 'head of', 'chief'].some(t => $`person.title`.toLowerCase().includes(t)) ? 'Senior' : 'Other') : null
```

| Title | After |
| - | - |
| `'Director, Demand Gen'` | `'Senior'` |
| `'Analyst'` | `'Other'` |
| No value | No value |

### Show city and state together

```
exists($`company.city`, $`company.state`) ? $`company.city` + ', ' + $`company.state` : ($`company.city` ?? $`company.state`)
```

| City | State | After |
| - | - | - |
| `'Austin'` | `'TX'` | `'Austin, TX'` |
| `'Austin'` | No value | `'Austin'` |
| No value | `'TX'` | `'TX'` |

### Fill a blank with a label

```
$`company.industry`.trim() || 'Unknown'
```

| Industry | After |
| - | - |
| `'Software'` | `'Software'` |
| `'  '` (spaces only) | `'Unknown'` |
| No value | `'Unknown'` |

### Show revenue in millions

```
exists($`company.annualRevenue`) ? $`company.annualRevenue` / 1000000 : null
```

| Annual revenue | After |
| - | - |
| `2500000` | `2.5` |
| No value | No value |

### Bucket revenue into bands

```
exists($`company.annualRevenue`) ? ($`company.annualRevenue` >= 10000000 ? 'Over $10M' : $`company.annualRevenue` >= 1000000 ? '$1M to $10M' : 'Under $1M') : 'Unknown'
```

| Annual revenue | After |
| - | - |
| `25000000` | `'Over $10M'` |
| `2500000` | `'$1M to $10M'` |
| `500` | `'Under $1M'` |
| No value | `'Unknown'` |

## Salesforce recipes

Records that arrive from Salesforce carry the field names Salesforce uses, under a record type such as `sfdc_lead` or `sfdc_contact`. The names below are examples. Check yours on **Data Shape**, and replace the record type and field names in each formula.

### Filters

| You want to keep | Formula |
| - | - |
| Leads in one of two statuses | ``$`sfdc_lead.Status` == 'Open - Not Contacted' \|\| $`sfdc_lead.Status` == 'Working - Contacted'`` |
| Leads from certain sources | ``['Web', 'Webinar', 'Partner Referral'].includes($`sfdc_lead.LeadSource`)`` |
| Leads from companies with 200 or more employees | ``exists($`sfdc_lead.NumberOfEmployees`) && $`sfdc_lead.NumberOfEmployees` >= 200`` |
| People whose lead and contact emails disagree | ``exists($`sfdc_lead.Email`, $`sfdc_contact.Email`) && $`sfdc_lead.Email`.toLowerCase() != $`sfdc_contact.Email`.toLowerCase()`` |

Here is how the first one works out.

| Status | After |
| - | - |
| `'Working - Contacted'` | `true` |
| `'Closed - Converted'` | `false` |
| No value | `false` |

The last filter compares two fields on the same person, which a built-in filter cannot do. The person must have both a lead and a contact record.

### Columns

| You want to show | Formula | Before | After |
| - | - | - | - |
| Converted or open | ``flag($`sfdc_lead.IsConverted`) ? 'Converted' : 'Open'`` | `true` | `'Converted'` |
| Same formula | same | `false` or no value | `'Open'` |
| Salesforce company, tidied, else the standard company name | `` exists($`sfdc_lead.Company`) ? $`sfdc_lead.Company`.trim() : $`person.companyName` `` | `' Acme '` | `'Acme'` |

## Date recipes

Formulas have no clock, so you cannot ask for "the last 30 days." You can compare a date field to a fixed date, as long as the field is stored as year-month-day text. A value with a time on it sorts after the same date without one, so use the next day as the cutoff.

| You want to keep | Formula |
| - | - |
| Created on or before January 1, 2026 | ``exists($`sfdc_lead.CreatedDate`) && $`sfdc_lead.CreatedDate` < '2026-01-02'`` |
| Created in the first quarter of 2026 | ``exists($`sfdc_lead.CreatedDate`) && $`sfdc_lead.CreatedDate` >= '2026-01-01' && $`sfdc_lead.CreatedDate` < '2026-04-01'`` |

| Created date | First formula | Second formula |
| - | - | - |
| `'2026-01-01T08:30:00.000Z'` | `true` | `true` |
| `'2026-02-15'` | `false` | `true` |
| `'2026-04-01'` | `false` | `false` |

To show only the date or the year in a column, cut the text:

| You want to show | Formula | Before | After |
| - | - | - | - |
| The date only | ``exists($`sfdc_lead.CreatedDate`) ? $`sfdc_lead.CreatedDate`.slice(0, 10) : null`` | `'2026-01-01T08:30:00.000Z'` | `'2026-01-01'` |
| The year only | ``exists($`sfdc_lead.CreatedDate`) ? $`sfdc_lead.CreatedDate`.slice(0, 4) : null`` | same | `'2026'` |

## Related articles

* [Handle blank and messy values in formulas](https://docs.allgoodhq.com/mk/formulas/handle-blank-values.md)
* [Filter a list with a formula](https://docs.allgoodhq.com/mk/formulas/filter-a-list.md)
* [Add a calculated column to a list](https://docs.allgoodhq.com/mk/formulas/add-a-calculated-column.md)
* [Formula reference: concepts, functions, and operators](https://docs.allgoodhq.com/mk/formulas/reference.md)

If a recipe gives an answer you cannot explain, contact allGood support. Include the formula, one record where the result is wrong, and the result you expected.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.