Formula function reference
Every operator and function you can use in a formula field, with what each one takes and returns.
Available on Enterprise. Earlier plans can differ
This page lists every operator and function the formula editor accepts. For how formulas treat blank values, currencies and related records, see Formula fields.
Who can use it
Section titled “Who can use it”Only owners and admins write formulas. See Formula fields for what plans without formula fields can do instead.
Find a function in the app
Section titled “Find a function in the app”In the formula editor, click Variables and search the Functions section. Each function shows a short description and a worked example.
In the tables below, ? marks an optional argument and ... means you can pass as many values as you like.
Operators
Section titled “Operators”| Operator | Meaning | Same as |
|---|---|---|
+ - * / |
Add, subtract, multiply, divide | add, sub, mul, div |
== != |
Equal to, not equal to | eq, neq |
> >= < <= |
Greater than, greater than or equal to, less than, less than or equal to | gt, gte, lt, lte |
&& || ! |
And, or, not | and, or, not |
a ? b : c |
If a is true, b; otherwise c |
if(a, b, c) |
Use parentheses to choose which calculation runs first: ({ARR} - {Cost}) / {ARR}. A minus sign in front of a value makes it negative: -{Discount}.
| Function | What it does |
|---|---|
add(a, b) |
Adds two numbers. Same as a + b. |
sub(a, b) |
Subtracts b from a. Same as a - b. |
mul(a, b) |
Multiplies two numbers. Same as a * b. |
div(a, b) |
Divides a by b. Same as a / b. Dividing by zero gives a blank. |
sum(a, ...) |
Adds any number of values together, or totals a field across related records. |
avg(a, ...) |
The average of the values, or of a field across related records. |
count(relatedValues) |
How many related records there are, or how many have a value in a field. Works only on related records. |
Rounding
Section titled “Rounding”| Function | What it does |
|---|---|
round(value, decimalPlaces?) |
Rounds to the nearest whole number, or to decimalPlaces decimal places. round(1.239, 2) is 1.24. |
floor(value) |
Rounds down to a whole number. |
ceil(value) |
Rounds up to a whole number. |
abs(value) |
The value without its sign. |
Rounding a currency amount keeps its currency.
Bounds
Section titled “Bounds”| Function | What it does |
|---|---|
min(a, ...) |
The smallest number or earliest date, from the values you pass or across related records. |
max(a, ...) |
The largest number or latest date, from the values you pass or across related records. |
clamp(value, lowerBound, upperBound) |
Keeps value between the two bounds. clamp(12, 1, 10) is 10. |
min and max compare numbers with numbers or dates with dates, never a mix of the two.
Comparison
Section titled “Comparison”| Function | What it does |
|---|---|
eq(a, b) |
True when the values are equal. Same as a == b. |
neq(a, b) |
True when the values differ. Same as a != b. |
gt(a, b) / gte(a, b) |
True when a is greater than (or equal to) b. Numbers, currency and dates. |
lt(a, b) / lte(a, b) |
True when a is less than (or equal to) b. Numbers, currency and dates. |
eq and neq work on any type. The four ordering comparisons work on numbers, currency and dates, and both sides must be the same kind; you can’t use > to compare text, or a date with a number.
For what a comparison with a blank value returns, see How blank values work.
Logic and conditions
Section titled “Logic and conditions”| Function | What it does |
|---|---|
and(a, ...) |
True when every value is true. Same as a && b. |
or(a, ...) |
True when any value is true. Same as a || b. |
not(value) |
Turns true into false and false into true. Same as !value. |
if(condition, whenTrue, whenFalse) |
Picks one of two values based on a condition. |
case(condition1, result1, ..., default?) |
Returns the result for the first condition that’s true. The last default is optional. |
Only the branch a condition picks is calculated, so you can guard a division: if({Total} != 0, {Won} / {Total}, 0).
case is easier to read than nested ifs when you put records into bands. See the tiers example.
| Function | What it does |
|---|---|
concat(a, ...) |
Joins text values, including text from related records, with no separator. |
join(relatedText, delimiter) |
Joins text from related records with a separator. join({Opportunities.Stage.label}, ", ") gives something like "Open, Won". |
upper(text) / lower(text) |
Converts text to upper or lower case. |
trim(text) |
Removes spaces at the start and end. |
len(text) |
The number of characters in the text. |
left(text, count) / right(text, count) |
The first or last count characters. |
mid(text, start, count) |
count characters starting at position start (the first character is 1). |
replace(text, search, replacement) |
Replaces every occurrence of search. replace("555-1234", "-", "") is "5551234". |
contains(text, search) |
True when the text contains search. |
find(text, search) |
The position of the first match (starting at 1), or 0 when there’s no match. |
split(text, delimiter, index) |
Splits the text on delimiter and returns piece number index (starting at 1). split("jane@acme.com", "@", 2) is "acme.com". |
text(value) |
Turns a number, currency amount or date into text. text(year({Close date})) is "2026" for a close date in 2026. |
The other text functions accept text only. To put a number or date in a text label, wrap it in text first. For example, concat("Q", text(quarter({Close date})), " ", text(year({Close date}))) gives something like "Q4 2026".
text writes a number without thousands separators, so a year reads 2026. A currency amount keeps its currency format, such as $1,234.50, and a date reads like October 14, 2026, in UTC.
| Function | What it does |
|---|---|
dateDiff(startDate, endDate, unit) |
The number of whole units from startDate to endDate. Negative when endDate is earlier. |
dateAdd(date, amount, unit) |
Moves a date by amount units. A negative amount moves it earlier. |
year(date) |
The four-digit year. |
quarter(date) |
The calendar quarter, 1 to 4. |
month(date) |
The month, 1 to 12. |
day(date) |
The day of the month, 1 to 31. |
today() |
Today’s date in your workspace’s time zone. |
The unit must be written in quotes, as one of "seconds", "minutes", "hours", "days", "weeks", "months" or "years". For example, dateDiff({Created at}, {Close date}, "days").
year, quarter, month and day read the date in UTC.
today() works in any formula that doesn’t return a date. For example, dateDiff(today(), {Close date}, "days") counts the days left until the close date, and today() > {Close date} is true once the close date has passed. Formulas that use it recalculate every night, shortly after midnight in your workspace’s time zone. There’s no function for the current time.
Currency
Section titled “Currency”| Function | What it does |
|---|---|
convertCurrency(value, "USD", rate) |
Converts an amount into another currency at the rate you give. |
This is the only way to combine amounts held in different currencies. Write the currency as a quoted ISO 4217 code, such as "USD" or "EUR". For example, using an illustrative rate of 1.1476, convertCurrency({Amount (EUR)}, "USD", 1.1476) turns €100 into $114.76. Supply the rate you want to use; this example isn’t a live exchange rate.
Blank values
Section titled “Blank values”| Function | What it does |
|---|---|
isBlank(value) |
True when the value is empty or not set. Empty text counts as blank; 0 and an unchecked checkbox don’t. |
isSet(value) |
True when the value is present. |
coalesce(a, ...) |
The first value that’s set, from the values you pass or across related records. coalesce({Q3}, 0) treats a blank as zero. |
Functions that work on related records
Section titled “Functions that work on related records”These functions can summarize a field across every related record (a rollup): sum, avg, count, min, max, concat, join and coalesce. count and join work only on related records. For how rollups handle blanks and which relationships they can use, see Total related records with a rollup.