Formula functions library
Look up every formula function and operator in Attio.
Available on pro and enterprise plans.
Admins can create and manage attributes.
Members can create and manage attributes with Full access to the relevant object or list.
Formula attributes in Attio support a set of built-in functions and operators grouped into several categories: logic, math, date and time, text, type conversion, and attribute history functions. This article lists every available function with its syntax, description, and an example.
To learn how to create formula attributes and use the formula editor, see Formula attributes.
Operators
Operators are symbols built into the formula language. You can use them directly in any formula.
Operator | Description | Example |
|---|---|---|
| Addition |
|
| Subtraction |
|
| Multiplication |
|
| Division |
|
| Equal to |
|
| Not equal to |
|
| Greater than |
|
| Greater than or equal to |
|
| Less than |
|
| Less than or equal to |
|
| Negates a boolean value. |
|
| Returns the left value if it is not null, otherwise returns the right value. Useful for setting a fallback when an attribute might be empty. |
|
Logic functions
Logic functions evaluate conditions and return true or false, or choose between values based on a condition.
Function | Description | Example |
|---|---|---|
| Returns |
|
| Returns true only when both arguments are true. Used to combine multiple conditions. |
|
| Returns true when at least one of the arguments is true. |
|
| Returns the opposite of a boolean value. Converts true to false and false to true. |
|
| Returns the left value when it is not null, otherwise returns the right value. Useful for setting a fallback when an attribute might be empty. Takes exactly two arguments. |
|
Logic functions are most useful when combined with if(). For example, and() lets you check multiple conditions at once:
if(and({Deal value} > 10000, {Deal stage} == "Negotiation"), "High priority", "Normal")
This returns "High priority" only when both conditions are true.
Math functions
Math functions perform calculations on numbers and currency values.
Function | Description | Example |
|---|---|---|
| Calculates the average of an array of numbers or currency values. Returns a single value of the same type as the input. |
|
| Returns e raised to the power of the given number or currency value. |
|
| Returns the natural logarithm (base e) of the given number or currency value. |
|
| Returns the absolute value of a number or currency value, converting negative values to positive. |
|
| Rounds a number or currency value to the specified number of decimal places. |
|
| Rounds a number or currency value up to the nearest integer. |
|
| Rounds a number or currency value down to the nearest integer. |
|
| Returns the maximum value from an array of numbers, currency values, or dates. |
|
| Returns the arithmetic mean of an array of numbers, currency values, or dates. |
|
| Returns the median (middle value) of an array of numbers, currency values, or dates. |
|
| Returns the minimum value from an array of numbers, currency values, or dates. |
|
| Returns the sum of an array of numbers or currency values. Returns a single value of the same type as the input. |
|
| Returns the number of items in an array. |
|
| Returns a new array with duplicate values removed, keeping only unique entries. |
|
| Returns the base raised to the power of the exponent. |
|
| Returns the remainder after dividing the dividend by the divisor. |
|
| Returns a random number between 0 and 1. Takes no arguments. |
|
Date and time functions
Date and time functions let you create, extract, format, and convert date and timestamp values.
Function | Description | Example |
|---|---|---|
| Adds a specified number of time units to a date. The |
|
| Formats a date value as text using a format string. Common tokens: |
|
| Parses a number or text value into a date. Accepts ISO 8601 date strings or numeric timestamps. |
|
| Parses a text or number value into a timestamp. Accepts ISO 8601 datetime strings or numeric Unix timestamps. |
|
| Returns the current date and time as a timestamp. Takes no arguments. Using this function adds a daily recalculation around midnight UTC. |
|
| Returns the current date without a time component. Takes no arguments. Using this function adds a daily recalculation around midnight UTC. |
|
| Extracts the day of the month from a date as a number from 1 to 31. |
|
| Extracts the hour from a date or timestamp as a number from 0 to 23. |
|
| Extracts the year from a date as a four-digit number. |
|
| Extracts the calendar quarter from a date as a number from 1 to 4. |
|
| Extracts the month from a date as a number from 1 to 12. |
|
| Extracts the minutes from a date or timestamp as a number from 0 to 59. |
|
| Extracts the seconds from a date or timestamp as a number from 0 to 59. |
|
| Returns the last day of the month for the given date. |
|
| Converts a date or timestamp to the specified timezone, returning a timestamp. |
|
| Returns the absolute difference between two dates or timestamps in the requested unit. The |
|
Text functions
Text functions search, transform, and measure text values.
Function | Description | Example |
|---|---|---|
| Returns true when text or a text array contains a specific text value. For text, checks if the needle is a substring of the haystack. For arrays, checks if the needle exists as an element. |
|
| Returns true when a text value begins with the search term. The comparison is case-sensitive. |
|
| Returns true when a text value ends with the search term. The comparison is case-sensitive. |
|
| Replaces the first occurrence of a search term within a text value with a replacement term. Search terms are matched as literal text. |
|
| Replaces all occurrences of a search term within a text value with a replacement term. Search terms are matched as literal text. |
|
| Returns the first |
|
| Returns the last |
|
| Splits a text value into a list of parts on a delimiter. A formula can't return a list, so index into the result or pass it to another function. Use |
|
| Splits a text value on a delimiter and returns a single part, counting from zero. Returns empty when there is no part at that index. |
|
| Converts a text value to lowercase. |
|
| Converts a text value to uppercase. |
|
| Returns the length of a text value. |
|
Type conversion functions
Type conversion functions change a value from one attribute type to another. date() and timestamp() also convert values and are listed under Date and time functions.
Function | Description |
|---|---|
| Converts a value to text. Every attribute type is supported, and empty values stay empty. |
| Converts a text or numeric value to a number. If the value can't be parsed as a number, the formula returns an error. |
| Converts a number to a currency value. |
| Converts a value to a checkbox. Non-empty or non-zero values become |
| Converts a number to a rating from 0 to 5. Numbers outside this range are clamped to the nearest valid value. |
| Converts a text value to a phone number. The text needs to include a country code since E.164 format is required. |
Tip: To show a date or timestamp in a readable format, use format_date() instead of text(). text() returns the raw stored value, such as 2024-01-15.
Attribute history functions
These functions are unique to Attio. They use the historical values Attio stores for select and status attributes, letting you query how long a value was set, when it changed, or whether it was ever set.
Note: hasBeenIn(), valueSetAt(), and timeSpentIn() only work with select and status attributes. They are not supported on text, number, date, or other attribute types.
Function | Description | Example |
|---|---|---|
| Returns true when a select option or status appears in the current or historical values for that attribute. Pass a single value or an array of values. Optionally pass a |
|
| Returns the timestamp when the attribute was first set to the given value. Pass |
|
| Returns the total time the attribute has been set to the given value across its history. Pass |
|
| Returns the historical value of an attribute at a specific timestamp. Useful for finding what value an attribute had at a particular point in time. |
|
| Returns the value the attribute had immediately before its current value. Returns an empty value when the attribute has no prior history. Actor reference and interaction attributes are not supported. |
|
Related resources
To learn how to create a formula attribute and use the formula editor, see Formula attributes.
For real examples you can adapt to your own workspace, see Formula attribute examples.
Frequently asked questions
Some functions accept both. hour() and setTimezone() require a timestamp; day(), eomonth(), and dateAdd() work with dates. The date() and timestamp() functions let you convert between the two.
Yes. Functions like sum() and count() work across associated records. For example, count({Associated people > Record ID}) counts the number of people linked through a relationship attribute, and sum() can total a numeric attribute across associated records.
You cannot currently filter an aggregation. For example, you can sum revenue across all associated workspaces, but not across only those on a specific plan. As a workaround, create a formula attribute on the associated record that returns the value when a condition is met and 0 otherwise, then sum that formula.
Most attributes convert as you'd expect, but a few are worth knowing:
Record reference: The linked record's ID, not its name. To get a name, use a path into a text attribute on that record instead.
Actor reference: The actor's display name. For a workspace member, that's their full name, or their email if they haven't set one. If the member has been deactivated or deleted, the value is empty.
Interaction: The display name of the workspace member who owns the interaction, not the interaction's type or time.
Date and timestamp: The raw stored value, not a localized or formatted display. Use
format_date()if you need a readable format.Select and status: The option or stage's title, such as
In Progress.