For an overview of formula fields, please refer to the Guide to Formula, Lookup, Count, and Rollup fields.
Formulas may involve functions, numeric operations, logical operations, and text operations that operate on fields.
In a formula, you can reference columns by name. For example, if you wanted a formula that calculated the total based on the price and quantity, the formula would look like:
Price * Quantity
Column names with multiple words should be wrapped in braces:
MIN({Regular Price}, {Sale Price})
Formulas may include parentheses () to change the order of operations:
(Apples + Oranges) / Guests
Below you can find details on all of the formula operators and functions, broken down by the type of data they operate on.
Logical operators and functions
Numeric operators and functions
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(). |
Name & " - " & Age => Jane - 28 "\""&{Product Name}&"\"" => "GreatProduct" |
Function |
Description | Examples |
ARRAYJOIN([item1, item2, item3], separator) |
Join the array of items into a string with a separator. |
ARRAYJOIN([1,2,3], "; ") => 1; 2; 3 |
CONCATENATE(text1, [text2, ...]) |
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. |
CONCATENATE(Name," - ", Age) => Bob - 43 CONCATENATE("\"",{Product Name},"\"") => "GreatProduct" |
FIND(stringToFind, whereToSearch,[startFromPosition]) |
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. |
FIND("fox", "quick brown fox") => 13 |
LEFT(string, howMany) |
Extract howMany characters from the beginning of the string. |
LEFT("quick brown fox", 5) => quick |
LEN(string) |
Returns the length of a string. |
LEN("quick brown fox") => 15 |
LOWER(string) |
Makes a string lowercase. |
LOWER("Hello!") => hello! |
MID(string, whereToStart, count) |
Extract a substring of count characters starting at whereToStart. |
MID("quick brown fox", 6, 5) => brown |
REPLACE(string, start_character, number_of_characters, replacement) |
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().) |
REPLACE("database", 2, 5, "o") => dose |
REPT(string, number) |
Repeats string by the specified number of times. |
REPT("Hi! ", 3) => Hi! Hi! Hi! |
RIGHT(string, howMany) |
Extract howMany characters from the end of the string. |
RIGHT("quick brown fox", 5) => n fox |
SEARCH(stringToFind, whereToSearch,[startFromPosition]) |
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. |
SEARCH("World", "Hello World") => 7 |
SUBSTITUTE(string, old_text, new_text, [index]) |
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().) |
SUBSTITUTE("gold mold", "old", "et") => get met SUBSTITUTE("gold mold", "old", "et", 1) => get mold |
T(value1) |
Returns the argument if it is text and blank otherwise. |
T("text only") => text only T(42) => blank |
TRIM(string) |
Removes whitespace at the beginning and end of string. |
TRIM(" Hello! ") => Hello! |
UPPER(string) |
Makes string uppercase. |
UPPER("Hello!") => HELLO! |
Logical operators and functions
Operator |
Description | Examples |
> |
Greater than |
3 > 2 => TRUE |
< |
Less than |
2 < 3 => TRUE |
>= |
Greater than or equal to |
3 >= 3 => TRUE |
<= |
Less than or equal to |
2 <= 2 => TRUE |
= |
Equal to |
2 = 2 => TRUE |
!= |
Is not equal to |
3 != 2 => TRUE |
Function |
Description | Examples |
AND(logical1, [logical2, ...]) |
Returns true if all the arguments are true, returns false otherwise. |
AND(Finished, Reviewed) |
BLANK() |
Returns a blank value. |
IF(Price > 1000000, BLANK(), "Wow, that's pretty expensive") |
ERROR() |
Returns the error value. |
IF(total < 0, ERROR(), "OK") |
FALSE() |
Logical value false. |
FALSE() |
IF(logical, value1, value2) |
Returns value1 if the logical argument 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. |
IF(Sales > 50, "Win", "Lose") IF(WaterTemp > 100, IF(WaterTemp < 212, "just right", "too hot"), "too cold") IF(Date = BLANK(), "Please enter date", "Date entered") |
ISERROR(expr) |
Returns true if the expression causes an error. |
ISERROR(2/0) |
NOT(boolean) |
Reverses the logical value of its argument. |
NOT(Total > 50) |
OR(logical1, [logical2, ...]) |
Returns true if any one of the arguments is true. |
OR(Finished, Reviewed) |
TRUE() |
Logical value true. |
IF(Total > 50, TRUE(), FALSE()) |
XOR(logical1, [logical2, ...]) |
Returns true if an odd number of arguments are true. |
XOR(TRUE(), Done, Final) |
Numeric operators and functions
Operator |
Description | Examples |
+ |
Add together two numeric values |
Size + 2 |
- |
Subtract two numeric values | Price - 3.00 |
* |
Multiply two numeric values |
Price * Quantity |
/ |
Divide two numeric values |
Price / {Num People} |
Function |
Description | Examples |
ABS(value) |
Returns the absolute value. |
ABS(-5) => 5 |
AVERAGE(number1, [number2, ...]) |
Returns the average of the numbers. |
AVERAGE(2.3, 5.7, 6.8) => 3.93 |
CEILING(value, [significance]) |
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. |
CEILING(1.01) => 2 CEILING(1.01, 0.1) => 1.1 |
COUNT(number1, [number2, ....]) |
Count the number of numeric items. |
COUNT(1,2,3,"","four") => 3 |
COUNTA(textOrNumber1, [number2, ....]) |
Count the number of non-empty values. This function counts both numeric and text values. |
COUNTA(1,2,3,"","four") => 4 |
COUNTALL(textOrNumber1, [number2, ....]) |
Count the number of all elements including text and blanks. |
COUNTALL(1,2,3,"","four") => 5 |
EVEN(value) |
Returns the smallest even integer that is greater than or equal to the specified value. |
EVEN(2.2) => 4 EVEN(-1.6) => -2 |
EXP(power) |
Computes Euler's number (e) to the specified power. |
EXP(1) => 2.71828 EXP(3) => 20.08554 |
FLOOR(value, [significance]) |
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. |
FLOOR(1.99) => 1 FLOOR(1.99, 0.1) => 1.9 |
INT(value) |
Returns the greatest integer that is less than or equal to the specified value. |
INT(1.99) => 1 INT(-1.99) => -2 |
LOG(number, base=10) |
Computes the logarithm of the value in provided base. The base defaults to 10 if not specified. |
LOG(1024, 2) => 10 LOG(1000) => 3 |
MAX(number1, [number2, ...]) |
Returns the largest of the given numbers. |
MAX(Amount, 1000) |
MIN(number1, [number2, ...]) |
Returns the smallest of the given numbers. |
MIN(Amount, 0.0) |
MOD(value1, divisor) |
Returns the remainder after dividing the first argument by the second. |
MOD(meters, 1000) |
ODD(value) |
Rounds positive value up the the nearest odd number and negative value down to the nearest odd number. |
ODD(1.1) => 3 ODD(-1.1) => -3 |
POWER(base, power) |
Computes the specified base to the specified power. |
POWER(3, 3) => 27 POWER(7, 0) => 1 |
ROUND(value, precision) |
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.) |
ROUND(3.5, 0) => 4 ROUND(3.4, 0) => 3 |
ROUNDDOWN(value, precision) |
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.) |
ROUNDDOWN(1.9, 0) => 1 ROUNDDOWN(-1.9, 0) => -1 |
ROUNDUP(value, precision) |
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.) |
ROUNDUP(1.1, 0) => 2 ROUNDUP(-1.1, 0) => -2 |
SQRT(value) |
Returns the square root of a nonnegative number. |
SQRT(100) => 10 |
SUM(number1, [number2, ...]) |
Sum together the numbers. Equivalent to number1 + number2 + ... |
SUM(savings, checking, investments) |
VALUE(text) |
Converts the text input to a number. |
VALUE("$1000") => 1000 |
Function |
Description | Examples |
CREATED_TIME() |
Returns the date and time a given record was created. |
CREATED_TIME() => 2015-11-11T22:18:17 |
DATEADD([date], [#], 'units') | Adds specified "count" units to a datetime. |
DATEADD(Date, 10, 'days') => 10/9/2015 12:00am |
DATESTR([date]) | Formats a datetime into a string (YYYY-MM-DD). |
DATESTR({Date}) => 2015-11-12 |
DATETIME_DIFF([date1], [date2], 'units') |
Returns the difference between datetimes in specified units. Default units are seconds. (See list of unit specifiers here.) 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. |
DATETIME_DIFF({Date}, TODAY(), 'days') => 15 |
DATETIME_FORMAT([date], '[specified output format]') | Formats a datetime into a specified string. For an explanation of how to use this function with date fields, click here. For a list of supported format specifiers, please click here. |
DATETIME_FORMAT(TODAY(), 'DD-MM-YYYY') => 10-11-2015 |
DATETIME_PARSE(date, ['input format'], ['locale']) | 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'. |
DATETIME_PARSE("4 Mar 2017 23:00", 'D MMM YYYY HH:mm') => 3/4/2017 11:00pm |
DAY([date]) | Returns the day of the month of a datetime in the form of a number between 1-31. |
DAY({Completion date}) => 24 |
HOUR([datetime]) | Returns the hour of a datetime as a number between 0 (12:00am) and 23 (11:00pm). |
HOUR({Completion date}) => 9 |
IS_AFTER([date1], [date2]) | Determines if [date1] is later than [date2]. Returns 1 if yes, 0 if no. |
IS_AFTER({Deadline}, TODAY()) => 0 |
IS_BEFORE([date1], [date2]) | Determines if [date1] is earlier than [date2]. Returns 1 if yes, 0 if no. |
IS_BEFORE({Deadline}, TODAY()) => 1 |
IS_SAME([date1], [date2], [unit]) | Compares two dates up to a unit and determines whether they are identical. Returns 1 if yes, 0 if no. |
IS_SAME({Date 1}, {Date 2}, 'hour') => 0 |
MINUTE([datetime]) | Returns the minute of a datetime as an integer between 0 and 59. |
MINUTE(NOW()) => 31 |
MONTH([date]) | Returns the month of a datetime as a number between 1 (January) and 12 (December). |
MONTH({Completion date}) => 10 |
SECOND([datetime]) | Returns the second of a datetime as an integer between 0 and 59. |
SECOND(CREATED_TIME()) => 53 |
SET_LOCALE([date], [locale_modifier]) | 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. |
DATETIME_FORMAT(SET_LOCALE(NOW(), 'ru'), 'lll') => 9 июня 2016 г., 23:49 |
SET_TIMEZONE([date], [tz_identifier]) | 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. |
DATETIME_FORMAT(SET_TIMEZONE(NOW(), 'Australia/Sydney'), 'M/D/YYYY h:mm') => 11/12/2015 7:16pm |
TIMESTR([date/timestamp]) | Formats a datetime into a time-only string (HH:mm:ss). |
TIMESTR(NOW()) => 04:52:12 |
TONOW([date]), FROMNOW([date]) | Calculates the number of days between the current date and another date. |
TONOW({Date}) => 25 days |
TODAY(), NOW() | Returns the current date and time. (Note that the results of these functions change only when the formula is recalculated or a base is loaded. They are not updated continuously.) |
NOW() => 11/12/2015 12:00am |
WEEKDAY([date]) | Returns the day of the week as an integer between 0 (Sunday) and 6 (Saturday). |
WEEKDAY({Date}) => 4 |
WEEKNUM([date]) | Returns the week number of the year. |
WEEKNUM({Date}) => 46 |
WORKDAY(startDate, numDays, [holidays]) | 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. |
WORKDAY({Launch date}, 100, '2017-09-04, 2017-10-09, 2017-11-10') => 6/20/2017 |
YEAR([date]) | Returns the four-digit year of a datetime. |
YEAR({Completion date}) => 2015 |
Note that array functions can only be used in rollup fields, or when the input field is a linked record or lookup.
Function |
Description | Examples |
ARRAYCOMPACT([item1, item2, item3]) |
Removes empty strings and null values from the array. Keeps "false" and strings that contain one or more blank characters. |
ARRAYCOMPACT([1,2,"",3,false," ", null]) => [1,2,3,false," "] |
ARRAYFLATTEN([item1, item2, item3]) |
Flattens the array by removing any array nesting. All items become elements of a single array. |
ARRAYFLATTEN([1,2," ",3,],[false]) => [1,2,3,false] |
ARRAYJOIN([item1, item2, item3], separator) |
Join the array of items into a string with a separator. |
ARRAYJOIN([1,2,3], "; ") => "1; 2; 3" |
ARRAYUNIQUE([item1, item2, item3]) |
Returns only unique items in the array. |
ARRAYUNIQUE([1,2,3,3,1]) => "[1,2,3]" |
Function |
Description | Examples |
CREATED_TIME() |
Returns the creation time of the current record. |
"Created on " & CREATED_TIME() |
RECORD_ID() |
Returns the ID of the current record. |
"https://awesomeservice.com/view?recordId=" & RECORD_ID() |