Functions reference
Introduction
This section offers a function cheat sheet, where you can quickly search all available functions and their basic usage methods.
Numeric Functions
This section covers common numeric processing functions, including mathematical operations, statistical calculations, etc.
Name | Description | Input | Output | Example |
---|---|---|---|---|
SUM | Adds numbers together. Equivalent to number1 + number2 + ... |
| Number |
|
AVERAGE | Returns the average value of the numbers. |
| Number |
|
MAX | Returns the maximum value among the given numbers. |
| Number |
|
MIN | Returns the minimum value among the given numbers. |
| Number |
|
ROUND | Rounds a value to a specified number of decimal places. |
| Number |
|
ROUNDUP | Always rounds up, away from zero. |
| Number |
|
ROUNDDOWN | Always rounds down, towards zero. |
| Number |
|
CEILING | Returns the nearest integer multiple that is greater than or equal to the value. |
| Number |
|
FLOOR | Returns the nearest integer multiple that is less than or equal to the value. |
| Number |
|
EVEN | Returns the smallest even number that is greater than or equal to the given value. |
| Number |
|
ODD | Rounds positive values up to the nearest odd number, and negative values down to the nearest odd number. |
| Number |
|
INT | Returns number1 if the logical argument is true, otherwise returns number2. Can also be used to create nested IF statements and to check if a cell is empty. |
| Number |
|
ABS | Returns the absolute value. |
| Number |
|
SQRT | Returns the square root of a non-negative number. |
| Number |
|
POWER | Calculates the specified base to the specified power. |
| Number |
|
EXP | Calculates Euler's number (e) to the specified power. |
| Number |
|
LOG | Calculates the logarithm of a value in the provided base. If not specified, the base defaults to 10. |
| Number |
|
MOD | Returns the remainder of dividing the first argument by the second. |
| Number |
|
Text Functions
Here, you'll find common functions related to text processing, such as string manipulation, formatting, etc.
Name | Description | Input | Output | Example |
---|---|---|---|---|
CONCATENATE | Joins multiple value type arguments into a single text value. |
| Text |
|
FIND | Finds the position of a substring in the specified text. Returns 0 if the substring is not found. |
| Number |
|
SEARCH | Finds the position of a substring in the specified text. Returns empty if the substring is not found. Similar to FIND, but SEARCH returns 0 when the substring is not found. |
| Text or Empty |
|
MID | Extracts a specified number of characters from a specified position. |
| Text |
|
LEFT | Extracts a specified number of characters from the beginning of the string. |
| Text |
|
RIGHT | Extracts a specified number of characters from the end of the string. |
| Text |
|
REPLACE | Replaces a specified number of characters starting at a specified position with replacement text. |
| Text |
|
REGEXP_REPLACE | Replaces all substrings that match a regular expression with replacement text. |
| Text |
|
SUBSTITUTE | Replaces old text with new text. An index number can be specified to replace a specific occurrence of the old text. If no index number is specified, all occurrences of the old text are replaced. |
| Text |
|
LOWER | Converts a string to lowercase. |
| Text |
|
UPPER | Converts a string to uppercase. |
| Text |
|
REPT | Repeats a string a specified number of times. |
| Text |
|
TRIM | Removes whitespace from the beginning and end of a string. |
| Text |
|
LEN | Counts the number of characters in a string. |
| Number |
|
T | Returns the argument if it is text, otherwise returns null. |
| Text or Empty |
|
ENCODE_URL_COMPONENT | Replaces certain characters with their percent-encoded equivalents for URL or URI construction. Does not encode: - _ . ~ |
| Text |
|
Logical Functions
Logical functions mainly involve conditional judgments and logical operations. This section details the use of functions like IF
, AND
, OR
, etc.
Name | Description | Input | Output | Example |
---|---|---|---|---|
IF | Returns |
| String | Number | Boolean | Datetime |
|
SWITCH | Matches an input expression against a series of potential values and returns the corresponding result. A default value can be returned if the input expression matches none of the defined patterns. Can replace many nested IF() formulas in many cases. |
| String | Number | Boolean | Datetime |
|
AND | Returns true if all arguments are true; otherwise, returns false. |
| Boolean |
|
OR | Returns true if any argument is true. |
| Boolean |
|
XOR | Returns true if an odd number of arguments are true. |
| Boolean |
|
NOT | Reverses the logical value of its argument. |
| Boolean |
|
BLANK | Returns a null value. |
| null |
|
ERROR | Returns an error value. |
| Error |
|
IS_ERROR | Returns true if the expression causes an error. |
| Boolean |
|
Date Functions
Date functions help users handle and transform date and time data. This section covers operations such as adding, subtracting, and formatting dates.
Name | Description | Input | Output | Example |
---|---|---|---|---|
TODAY | Returns the current date. |
| Datetime |
|
NOW | Returns the current date and time. |
| Datetime |
|
YEAR | Returns the four-digit year of the date. |
| Number |
|
MONTH | Returns the month of the date as a number between 1 (January) and 12 (December). |
| Number |
|
WEEKNUM | Returns the week number of the year. |
| Number |
|
WEEKDAY | Returns the day of the week as an integer between 0 and 6. An optional second parameter ("Sunday" or "Monday") can be provided to start the week on that day. |
| Number |
|
DAY | Returns the day of the month of the date as a number between 1-31. |
| Number |
|
HOUR | Returns the hour of the date as a number between 0 (12:00am) and 23 (11:00pm). |
| Number |
|
MINUTE | Returns the minute of the date as an integer between 0 and 59. |
| Number |
|
SECOND | Returns the second of the date as an integer between 0 and 59. |
| Number |
|
FROMNOW | Calculates the number of days from the current date to another date. |
| Number |
|
TONOW | Calculates the number of days from another date to the current date. |
| Number |
|
DATETIME_DIFF | Returns the difference in specified units between two dates. The default unit is seconds. (See list of unit specifiers.) |
| Number |
|
WORKDAY | Returns the workday count to the start date, excluding specified holidays |
| Datetime |
|
WORKDAY_DIFF | Returns the number of workdays between date1 and date2. Workdays exclude weekends and an optional list of holidays, formatted as a comma-separated string of ISO-formatted dates. |
| Number |
|
IS_SAME | Compares two dates to a unit and determines if they are the same. If so, returns true, otherwise returns false. |
| Boolean |
|
Array and Other Functions
In addition to the categorized functions above, this section will introduce some functions that handle arrays or other specific types of data.
Function Name | Description | Input | Output | Example |
---|---|---|---|---|
COUNTALL | Returns the count of all elements, including text and blanks. |
| Number |
|
COUNTA | Returns the count of non-empty values. This function counts both numbers and text values. |
| Number |
|
COUNT | Returns the count of numeric items. |
| Number |
|
ARRAY_JOIN | Joins the array of rollup items into a string using a separator. |
| String |
|
ARRAY_UNIQUE | Returns only the unique items in an array. |
| Array |
|
ARRAY_FLATTEN | Flattens an array by removing any array nesting. All items become elements of a single array. |
| Array |
|
ARRAY_COMPACT | Removes empty strings and null values from an array. Retains "false" and strings containing one or more whitespace characters. |
| Array |
|
RECORD_ID | Returns the ID of the current record. |
| String |
|
Last updated