> ## 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.

# Coming from Marketo: formulas in MK

> See how Marketo Smart List rules, Velocity, formula fields, and campaign flow logic map to filters and formulas in MK, and what does not translate.

If you build in Marketo today, MK formulas will feel familiar in some ways and different in others. A formula is a short expression that works out an answer from one record's data. Marketo has several features that cover the same ground: Smart List rules, formula fields, and the conditions in a Smart Campaign flow. Velocity scripting is not one of them. It writes content into an email, so its MK equivalent is Liquid in the email. This article maps each feature to its MK equivalent and points out what does not translate.

## How the pieces line up

The idea is similar, but the mechanics differ. Do not expect a one-to-one match.

| In Marketo | In MK | The main difference | | |
| - | - | - | - | - |
| Smart List rule: field **is**, **contains**, **is empty**, **is not empty** | The built-in filters on a list | These four cover most rules. They combine with AND only. | | |
| Smart List rule: field **is not**, **is any**, **not contains**, **starts with** | A formula filter | The built-in picker has no "is not," "is any," or "starts with." Use `!=`, `.includes()`, and `.startsWith()`. | | |
| Rule: number **greater than**, **less than**, **at least**, **between** | A formula filter | Compare with `>`, `<`, `>=`, and `<=`. | | |
| Smart List **any** or custom logic such as `1 and (2 or 3)` | A formula filter | Write the logic yourself with `&&`, \` | | \`, and parentheses. |
| Rule: **Member of Program** | A campaign membership filter on a list | Keeps people who are members of a campaign, and optionally only those in a given state. This is a built-in filter, not a formula. | | |
| Rule: **Member of Smart List** (a list built from other lists) | No equivalent | A list cannot use another list as a filter. See [Lists built from other lists](#lists-built-from-other-lists). | | |
| Rule: **Member of static list** | No equivalent | Same as above. | | |
| Activity rules such as **Filled Out Form** or **Opened Email**, and "in past N days" | No equivalent | List filters and formulas read a record's data, not its activity history. Formulas also have no clock. | | |
| Velocity scripting and tokens | Not formulas. Merge fields and Liquid in the email | Velocity writes display content into a message. A formula works out data for a list or a rule. See [Velocity scripting and tokens](#velocity-scripting-and-tokens). | | |
| A formula field, such as a concatenated string | A formula column | The column works out its answer when the list loads. It does not create a field or store a value. | | |
| Choices and conditions in a Smart Campaign flow | Policy and motion formulas | An admin sets these up. See [Where you can use formulas in MK](https://docs.allgoodhq.com/mk/formulas/where-you-can-use-formulas.md). | | |

## Rebuild a Smart List with a formula

A common Smart List finds senior people by job title. In Marketo, it often looks like this: **Job Title contains** "chief information security officer" or "CISO", **or** a title that contains "Chief," "VP," or "Vice Pres" **and** also contains "information" or "security." That is custom filter logic with several values in each rule.

In MK, one formula filter covers it:

```
exists($`person.title`) && (['chief information security officer', 'ciso'].some(t => $`person.title`.toLowerCase().includes(t)) || (['chief', 'vp', 'vice pres'].some(t => $`person.title`.toLowerCase().includes(t)) && ['information', 'security'].some(t => $`person.title`.toLowerCase().includes(t))))
```

| Title | After |
| - | - |
| `'CISO'` | `true` (stays) |
| `'VP, Security Engineering'` | `true` (stays) |
| `'Vice President of Information Systems'` | `true` (stays) |
| `'Chief Marketing Officer'` | `false` (leaves) |
| `'Security Analyst'` | `false` (leaves) |
| No value | `false` (leaves) |

Three differences from Marketo:

* Each list of words in square brackets works like the comma-separated values in one Marketo rule. A title passes when it contains any one of them.
* Text matches are case-sensitive in formulas, so the formula changes the title to lowercase first. Marketo's "contains" ignores capitalization.
* The `exists()` check comes first. Without it, a person with no title can pass a test that starts with "not." See [Handle blank and messy values in formulas](https://docs.allgoodhq.com/mk/formulas/handle-blank-values.md).

## Lists built from other lists

Many Marketo setups build audiences in layers. A "base audience" list excludes everyone in several suppression lists, and other lists then say "Member of Smart List" that base audience. Marketo lets those layers go many levels deep.

A list in MK cannot use another list as a filter, and a formula cannot do it either. A formula reads one record's data and nothing else. Two ways to get the same result in MK:

* Write each layer's rules as one formula that repeats the conditions.
* Move a repeated condition into a field on the record, so every list can test the field. A **derived field** such as a job level or region is the usual way. An admin sets these up with policies. See [Where you can use formulas in MK](https://docs.allgoodhq.com/mk/formulas/where-you-can-use-formulas.md).

Marketo segment fields, such as "Job Level Segment is Leader," behave the same way. They are fields written by a rule, and they carry over as fields.

## Replace a long list of values

Marketo rules often hold long lists: a list of free email domains to exclude, or a list of countries. A formula takes the list in square brackets:

```
exists($`person.email`) && !['@gmail.com', '@yahoo.com', '@hotmail.com'].some(d => $`person.email`.toLowerCase().includes(d))
```

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

For a list with dozens of values, such as a competitor domain list, a formula gets long. Ask an admin whether a derived field is a better fit. For more ready-made formulas, see [Formula recipes](https://docs.allgoodhq.com/mk/formulas/recipes.md#keep-only-work-email-addresses).

## Velocity scripting and tokens

Velocity and formulas do different jobs, so they do not map to each other. Velocity runs inside an email or page and writes out **display** content: a greeting that changes by person, a date, a list of items. A formula works out **data**: whether a record belongs in a list, or what a column shows. A formula never writes anything into an email.

The MK equivalent of Velocity is a merge field plus Liquid in the email. Liquid has `if`, `for`, and filters for dates and text. See [Personalizing an email](https://docs.allgoodhq.com/mk/content/email/emails/personalizing-an-email.md), [Liquid recipes for emails](https://docs.allgoodhq.com/mk/content/email/emails/liquid-recipes.md), and the [token comparison for email](https://docs.allgoodhq.com/mk/content/email/coming-from-marketo-hubspot.md#tokens-compared).

| You want | In Marketo | In MK |
| - | - | - |
| A greeting name that falls back to "there" | Velocity `#if` or a token default | In an email: `{{ person.firstName \| default: "there" }}` |
| A label that depends on a field | Velocity `#if` and `#elseif` | In an email: Liquid `if` and `elsif`. In a list column: a formula |
| The 4th Wednesday of next month | A Velocity script using the Java calendar | Liquid in the email. See [Find the Nth weekday of a month](https://docs.allgoodhq.com/mk/content/email/emails/liquid-recipes.md#find-the-nth-weekday-of-a-month) |

The two share a few ideas, such as a fallback and a choice between two values. In a list column you write a choice as `condition ? a : b`, and in an email you write it as a Liquid `if`. Date math is where they differ most. Formulas in lists have no clock and no date functions, so a formula cannot find "the 4th Wednesday." Liquid in an email can, because it knows when the email sends.

## Formula fields

Marketo has formula fields that work out a value from other fields, such as one that joins text. The closest MK equivalent is a formula column. The idea is the same: a value worked out from other fields.

Three things differ:

* A formula column works out its answer when the list loads. It does not create a field on the record or store the result.
* Other lists, emails, and rules cannot use a formula column as a field. Add the formula again wherever you need it.
* The data on the record never changes.

If you need a worked-out value to be a real, stored field, ask an admin. That is a setup task, not a list formula.

## Smart Campaign flow logic

A Smart Campaign flow in Marketo has choices that send a lead down one path or another. MK keeps this kind of logic in policy gates and motion guards, which use formulas. An admin sets up policy formulas. Motion guards are read-only in the product today. See [Where you can use formulas in MK](https://docs.allgoodhq.com/mk/formulas/where-you-can-use-formulas.md).

## Data cleanup carries over

Smart Lists built over years tend to hold small data problems: a value spelled two ways, such as "Engagement" and "Enagement," or text with stray spaces. These cause misses in any system. In a formula, change the capitalization and trim the text before you compare, as in ``$`person.title`.trim().toLowerCase()``. See [Formula gives a blank, wrong, or error result](https://docs.allgoodhq.com/mk/formulas/not-working.md).

## What to try first

1. Pick one Smart List that uses only is, contains, and "any" logic, and rebuild it as a list in MK. Use the built-in filters for the simple rules and a formula filter for "is not" or "this or that."
2. Open the [formula recipes](https://docs.allgoodhq.com/mk/formulas/recipes.md) for starting points.
3. Read [Handle blank and messy values in formulas](https://docs.allgoodhq.com/mk/formulas/handle-blank-values.md) before you save a list. Blank fields behave differently than they do in Smart Lists.

You will see a list in MK that matches the Smart List you rebuilt. Compare the counts, and look at a few records on each side.

## Related articles

* [What formulas are and when to use one](https://docs.allgoodhq.com/mk/formulas/what-formulas-are.md)
* [Filter a list with a formula](https://docs.allgoodhq.com/mk/formulas/filter-a-list.md)
* [Formula recipes](https://docs.allgoodhq.com/mk/formulas/recipes.md)
* [Coming from Marketo or HubSpot: email](https://docs.allgoodhq.com/mk/content/email/coming-from-marketo-hubspot.md)

If a Marketo build does not translate the way this article describes, contact allGood support. Include what you built in Marketo and what you expected in MK.


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