- 11 Jan 2024
- 15 Minutes to read
- Print
- DarkLight
- PDF
Airtable formula field reference
- Updated on 11 Jan 2024
- 15 Minutes to read
- Print
- DarkLight
- PDF
This article covers how to use formulas involving numeric, logical, and text operations to streamline your team's and organization's work.
Introduction
All plan types | |
Platform(s) | Web/Browser, Mac app, and Windows app |
Related reading | |
Try it in Airtable |
Formula fields in Airtable overview
Formula fields overview
In a formula, you can reference fields (columns) by name. To return the value of an existing field you can simply input the name of that field:
Price
So for example, if you wanted a formula that calculated a total based on your Price and Quantity fields, that would look something like:
Price * Quantity
Field names with multiple words must be wrapped in curly braces:
MIN({Regular Price}, {Sale Price})
Formulas may include parentheses () to change the order of operations:
(Apples + Oranges) / Guests
Using expressions in Airtable
Using expressions
An expression is created when you combine values, fields, or formulas together and that combination evaluates to a single value. You can create simple expressions, like in the below example (the formula below would return a single value—so it's an expression):
{Sales Tax} * {Price}
You can also chain expressions together, this is especially helpful when using logical operators. For example, the technical pattern for the IF() formula is IF(expression, value1, value2). Taking our above example a step further, let's say we want to know when the total price of our item is over 100:
IF(
{Sales Tax} * {Price} > 100,
"This is over 100",
"This is less than 100"
)
The expression in the above block is {Sales Tax} * {Price} > 100
.
We have created the below Formula Playground base as a space to reference and test any of the formulas below. As the name of the base indicates—we created this Formula Playground base experience with testing in mind for a more hands-on approach to learning and testing out formulas. We recommend creating a personal copy of the below Formula Playground base so you can easily reference it whenever you please.
Formula Playground
NOTE
If this is your first time opening this base, check out this quick demo video for an overview of how this base is structured.
Text operators and functions in Airtable
Text operators
NOTE
To see the below text functions in action, and test them out yourself, check out the Text function examples" table in the Formula Playground.
Operator | Description | Examples |
---|---|---|
| Concatenate text values into a single text value. To concatenate static text, surround it with double quotation marks. To concatenate double quotation marks, you need to use a backslash (\) as an escape character. Equivalent to CONCATENATE(). |
=> Jane - 28
=> "GreatProduct" |
Text functions
NOTE
To see the below text functions in action, and test them out yourself, check out the Text function examples" table in the Formula Playground.
Function | Description | Examples |
---|---|---|
| Join the array of items into a string with a separator. |
=> 1; 2; 3 |
| Joins together the text arguments into a single text value. To concatenate static text, surround it with double quotation marks. To concatenate double quotation marks, you need to use a backslash (\) as an escape character. Equivalent to use of the & operator. |
=> Bob - 43
=> "Bob" |
| Replaces certain characters with encoded equivalents for use in constructing URLs or URIs. Does not encode the following characters: - _ . ~ |
=> chicken%20%26%20waffles |
| Finds an occurrence of stringToFind in whereToSearch string starting from an optional startFromPosition.(startFromPosition is 0 by default.) If no occurrence of stringToFind is found, the result will be 0. Similar to SEARCH(), though SEARCH() returns empty rather than 0 if no occurrence of stringToFind is found. |
=> 13 |
| Extract howMany characters from the beginning of the string. |
=> quick |
| Returns the length of a string. |
=> 15 |
| Makes a string lowercase. |
=> hello! |
| Extract a substring of count characters starting at whereToStart. |
=> brown |
| Replaces the number of characters beginning with the start character with the replacement text. (If you're looking for a way to find and replace all occurrences of old_text with new_text, see SUBSTITUTE().) |
=> dose |
| Repeats string by the specified number of times. |
=> Hi! Hi! Hi! |
| Extract howMany characters from the end of the string. |
=> n fox |
| Searches for an occurrence of stringToFind in whereToSearch string starting from an optional startFromPosition. (startFromPosition is 0 by default.) If no occurrence of stringToFind is found, the result will be empty. Similar to FIND(), though FIND() returns 0 rather than empty if no occurrence of stringToFind is found. |
=> 7 |
| Replaces occurrences of old_text with new_text. You can optionally specify an index number (starting from 1) to replace just a specific occurrence of old_text. If no index number is specified, then all occurrences of old_text will be replaced. (If you're looking for a way to replace characters in a string from a specified start point instead, see REPLACE().) Looking for examples of how you can use SUBSTITUTE()? Check out this blog post on 7 time-saving substitution formulas. |
=> get met
=> get mold |
| Returns the argument if it is text and blank otherwise. |
=> text only
=> blank |
| Removes whitespace at the beginning and end of string. |
=> Hello! |
| Makes string uppercase. |
=> HELLO! |
Logical operators and functions in Airtable
Logical operators
NOTE
To see the below logical functions in action, and test them out yourself, check out the "❓ Logical function examples" table in the Formula Playground.
Operator | Description | Examples |
---|---|---|
| Greater than |
=> TRUE |
| Less than |
=> TRUE |
| Greater than or equal to |
=> TRUE |
| Less than or equal to |
=> TRUE |
| Equal to |
=> TRUE |
| Is not equal to |
=> TRUE |
Logical functions
NOTE
To see the below logical functions in action, and test them out yourself, check out the "❓ Logical function examples" table in the Formula Playground.
Function | Description | Examples |
---|---|---|
| Returns true if all the arguments are true, returns false otherwise. |
=> 1 (if both field values are truthy) |
| Returns a blank value. |
|
| Returns the error value. |
|
| Logical value false. False is represented numerically by a 0. |
=> 0 |
| Returns value1 if the logical expression is true, otherwise it returns value2. Can also be used to make nested IF statements. Can also be used to check if a cell is blank/is empty. |
|
| Returns true if the expression causes an error. |
=> 1 (true because of the "divide by zero" error) |
| Reverses the logical value of its argument. |
|
| Returns true if any one of the arguments is true. |
|
| Takes an expression, a list of possible values for that expression, and for each one, a value that the expression should take in that case. It can also take a default value if the expression input doesn't match any of the defined patterns. In many cases, SWITCH() can be used instead of a nested IF formula. |
=> if the {Status} field is the value "To Do" then this would return "Get this started!"
|
| Logical value true. The value of true is represented numerically by a 1. |
=> 1 |
| Returns true if an odd number of arguments are true. |
=> 0
=> 1 |
Numeric operators and functions in Airtable
Numeric operators
NOTE
To see the below numeric functions in action, and test them out yourself, check out the "#️⃣ Numeric function examples" table in the Formula Playground.
Operator | Description | Examples |
---|---|---|
| Add together two numeric values |
|
| Subtract two numeric values |
|
| Multiply two numeric values |
|
| Divide two numeric values |
|
Numeric functions
NOTE
To see the below numeric functions in action, and test them out yourself, check out the "#️⃣ Numeric function examples" table in the Formula Playground.
Function | Description | Examples |
---|---|---|
| Returns the absolute value. |
=> 5 |
| Returns the average of the numbers. |
=> 3.93 |
| Returns the nearest integer multiple of significance that is greater than or equal to the value. If no significance is provided, a significance of 1 is assumed. |
=> 2
=> 1.1 |
| Count the number of numeric items. |
=> 3 |
| Count the number of non-empty values. This function counts both numeric and text values. |
=> 4 |
| Count the number of all elements including text and blanks. |
=> 5 |
| Returns the smallest even integer that is greater than or equal to the specified value. |
=> 4
=> -2 |
| Computes Euler's number (e) to the specified power. |
=> 2.71828
=> 20.08554 |
| Returns the nearest integer multiple of significance that is less than or equal to the value. If no significance is provided, a significance of 1 is assumed. |
=> 1
=> 1.9 |
| Returns the greatest integer that is less than or equal to the specified value. |
=> 1
=> -2 |
| Computes the logarithm of the value in provided base. The base defaults to 10 if not specified. |
=> 10
=> 3 |
| Returns the largest of the given numbers. |
=> 100 |
| Returns the smallest of the given numbers. |
=> 10 |
| Returns the remainder after dividing the first argument by the second. |
=> 2 |
| Rounds positive value up the the nearest odd number and negative value down to the nearest odd number. |
=> 3
=> -3 |
| Computes the specified base to the specified power. |
=> 27
=> 1 |
| Rounds the value to the number of decimal places given by "precision." (Specifically, ROUND will round to the nearest integer at the specified precision, with ties broken by rounding half up toward positive infinity.) |
=> 4
=> 3 |
| Rounds the value to the number of decimal places given by "precision," always rounding down, i.e., toward zero. (You must give a value for the precision or the function will not work.) |
=> 1
=> -1 |
| Rounds the value to the number of decimal places given by "precision," always rounding up, i.e., away from zero. (You must give a value for the precision or the function will not work.) |
=> 2
=> -2 |
| Returns the square root of a nonnegative number. |
=> 10 |
| Sum together the numbers. Equivalent to number1 + number2 + ... |
=> 6 |
| Converts the text string to a number. Some exceptions apply—if the string contains certain mathematical operators(-,%) the result may not return as expected. In these scenarios we recommend using a combination of VALUE and REGEX_REPLACE to remove non-digit values from the string:
|
=> 1000 |
Date and time functions in Airtable
Date and time functions
Note
Looking for some examples of how you can use formulas with due dates and deadlines? Check out our top 10 time-saving date formulas.
To see the below date and time functions in action, and test them out yourself, check out the "📆 Date and time function examples" table in the Formula Playground.
Function | Description | Examples |
---|---|---|
| Returns the date and time a given record was created. |
=> 2015-11-11T22:18:17 |
| Adds specified "count" units to a datetime. See the list of shared unit specifiers here. For this function we recommend using the full unit specifier, (i.e. use "years" instead of "y"), for your desired unit. |
=> 2019-07-20
=> 2019-07-10 1:02am
|
| Formats a datetime into a string (YYYY-MM-DD). |
=> 2021-12-13 |
| Returns the difference between datetimes in specified units. The difference between datetimes is determined by subtracting [date2] from [date1]. This means that if [date2] is later than [date1], the resulting value will be negative. Default units are seconds. (See list of unit specifiers here.) NOTE 1: NOTE 2: When attempting to use
|
=> 25
=> 1
=> 30 |
| Formats a datetime into a specified string. For an explanation of how to use this function with date fields, click here. View a list of supported format specifiers. |
=> 2019
=> 10 2019 |
| Interprets a text string as a structured date, with optional input format and locale parameters. The output format will always be formatted 'M/D/YYYY h:mm a'. |
=> 3/4/2017 11:00pm |
| Returns the day of the month of a datetime in the form of a number between 1-31. |
=> 17 |
| Returns the hour of a datetime as a number between 0 (12:00am) and 23 (11:00pm). |
=> 7 |
| Determines if [date1] is later than [date2]. Returns 1 if yes, 0 if no. |
=> 0
|
| Determines if [date1] is earlier than [date2]. Returns 1 if yes, 0 if no. |
=> 1
|
| Compares two dates up to a unit and determines whether they are identical. Returns 1 if yes, 0 if no. |
=> 1
=> 0 |
| Returns the date and time of the most recent modification made by a user in a non-computed field in the table. If you only care about changes made to specific fields, you can include one or more field names, and the function will just return the date and time of the most recent change made to any of the specified fields. |
=> 5/9/2019 1:27 a.m.
=> 3/16/2019 6:45 p.m. |
| Returns the minute of a datetime as an integer between 0 and 59. |
=> 31 |
| Returns the month of a datetime as a number between 1 (January) and 12 (December). |
=> 2 |
| While similar to the TODAY() function, NOW() returns the current date AND time. This function updates when the formula is recalculated, when a base is loaded, or otherwise roughly every 15 minutes when a base is open. If the base is closed, it will update approximately every hour only when the base has time-dependent automation triggers or actions, or sync dependencies. | The following examples demonstrate the return if you were to enter NOW() and TODAY() at the same time, 08/06/2020 8:03am formatted as GMT on a 12 hour clock: You can toggle time formatting (GMT/Local, 12/24 hour) on the formatting tab
=> 08/06/2020 8:03am
=> 08/06/2020 12:03am |
| Returns the second of a datetime as an integer between 0 and 59. |
=> 25 |
| Sets a specific locale for a datetime. Must be used in conjunction with DATETIME_FORMAT. A list of supported locale modifiers can be found here. |
=> miércoles, 10 de julio de 2019 0:00 |
| Sets a specific timezone for a datetime. Must be used in conjunction with DATETIME_FORMAT. A list of supported timezone identifiers can be found here. |
=> 7/10/2019 11:00 |
| Formats a datetime into a time-only string (HH:mm:ss). |
=> 7:31:25 |
| Calculates the number of days between the current date and another date. |
=> 25 days
=> 25 days |
| While similar to the NOW() function: TODAY() returns the current date (not the current time, if formatted, time will return 12:00am). This function updates when the formula is recalculated, when a base is loaded, or otherwise roughly every 15 minutes when a base is open. If the base is closed, it will update approximately every hour only when the base has time-dependent automation triggers or actions, or sync dependencies. | The following examples demonstrate the return if you were to enter NOW() and TODAY() at the same time, 08/06/2020 8:03am formatted as GMT on a 12 hour clock: You can toggle time formatting (GMT/Local, 12/24 hour) on the formatting tab
=> 08/06/2020 8:03am
=> 08/06/2020 12:03am |
| Returns the day of the week as an integer between 0 and 6, inclusive. You may optionally provide a second argument (either "Sunday" or "Monday") to start weeks on that day. If omitted, weeks start on Sunday by default. Example: |
=> 3 (for Wednesday) |
| Returns the week number in a year. You may optionally provide a second argument (either "Sunday" or "Monday") to start weeks on that day. If omitted, weeks start on Sunday by default. Example:
|
|
| Returns a date that is numDays working days after startDate. Working days exclude weekends and an optional list of holidays, formatted as a comma-separated string of ISO-formatted dates. |
=> 2020-11-02
|
| Counts the number of working days between startDate and endDate. Working days exclude weekends and an optional list of holidays, formatted as a comma-separated string of ISO-formatted dates. |
=> 10
|
| Returns the four-digit year of a datetime. |
=> 2021 |
Array functions Airtable
Array functions
NOTE
Array functions can only be used in rollup fields or when the input field is a lookup field.
NOTE
To see the below array functions in action, and test them out yourself, check out the "[] Array function examples" table in the Formula Playground.
Function | Description | Examples |
---|---|---|
| Removes empty strings and null values from the array. Keeps "false" and strings that contain one or more blank characters. | values = [1,2,3,"",null,false," "]
=> [1,2,3,false," "] |
| Flattens the array by removing any array nesting. All items become elements of a single array. | values = [[1,2,"",3],[false]]
=> [1,2,3,false] |
| Join the array of rollup items into a string with a separator. | values = [1,2,3]
=> "1; 2; 3" |
| Returns only unique items in the array. | values = [1,2,3,3,2,1]
=> [1,2,3] |
| Returns a subset of the array from the first index number—starting from 1. Optionally specify an end index to stop. Use negative numbers to begin to count from the end of the array. |
ARRAYSLICE(values, 2, 3) => ["B", "C"] when values are ["A", "B", "C", "D"]
|
Record functions in Airtable
Record functions
NOTE
To see the below record functions in action, and test them out yourself, check out the "✍️ Record function examples" table in the Formula Playground.
Function | Description | Examples |
---|---|---|
| Returns the creation time of the current record. |
|
| Returns the date and time of the most recent modification made by a user in a non-computed field in the table. If you only care about changes made to specific fields, you can include one or more field names, and the function will just return the date and time of the most recent change made to any of the specified fields. |
|
| Returns the ID of the current record. |
|
REGEX functions in Airtable
REGEX functions
NOTE
Regular expressions (or REGEX) can be used to match character combinations within text strings. Airtable's REGEX functions are implemented using the RE2 regular expression library. You'll find more information specific to REGEX functions in this support article.
To see the below REGEX functions in action, and test them out yourself, check out the "🔎 REGEX function examples" table in the Formula Playground.
Function | Description | Examples |
---|---|---|
| Returns whether the input text matches a regular expression. |
|
| Returns the first substring that matches a regular expression. |
|
| Substitutes all matching substrings with a replacement string value. |
|