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 five categories: logic, math, date and time, text, 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.
Formula attributes are currently in Beta.
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. |
|
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. |
|
| 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. |
|
| Replaces the first occurrence of a search term within a text value with a replacement term. |
|
| Replaces all occurrences of a search term within a text value with a replacement term. |
|
| Returns the length of a text value. |
|
Attribute history functions
These functions are unique to Attio. They use the historical values Attio stores for select, status, 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.