Numeric Functions

This section covers common numeric processing functions, including mathematical operations and statistical calculations.

Function NameDescriptionInputOutputExample
SUMAdds numbers together. Equivalent to number1 + number2 + …number1, [number2, ...]NumberSUM(100, 200, 300) => 600
AVERAGEReturns the average of numbers.number1, [number2, ...]NumberAVERAGE(100, 200, 300) => 200
MAXReturns the largest value among given numbers.number1, [number2, ...]NumberMAX(100, 200, 300) => 300
MINReturns the smallest value among given numbers.number1, [number2, ...]NumberMIN(100, 200, 300) => 100
ROUNDRounds a value to the number of decimal places specified by “precision”.value, [precision]NumberROUND(1.99, 0) => 2 ROUND(16.8, -1) => 20
ROUNDUPAlways rounds up, away from zero.value, [precision]NumberROUNDUP(1.1, 0) => 2 ROUNDUP(-1.1, 0) => -2
ROUNDDOWNAlways rounds down, toward zero.value, [precision]NumberROUNDDOWN(1.9, 0) => 1 ROUNDDOWN(-1.9, 0) => -1
CEILINGReturns the nearest integer multiple greater than or equal to the value.value, [significance]NumberCEILING(2.49) => 3 CEILING(2.49, 1) => 2.5
FLOORReturns the nearest integer multiple less than or equal to the value.value, [significance]NumberFLOOR(2.49) => 2 FLOOR(2.49, 1) => 2.4
EVENReturns the smallest even number greater than or equal to the specified value.valueNumberEVEN(0.1) => 2 EVEN(-0.1) => -2
ODDRounds positive values up to the nearest odd number and negative values down to the nearest odd number.valueNumberODD(0.1) => 1 ODD(-0.1) => -1
INTReturns the integer part of a number.valueNumberINT(1.9) => 1 INT(-1.9) => -2
ABSReturns the absolute value.valueNumberABS(-1) => 1
SQRTReturns the square root of a non-negative number.valueNumberSQRT(4) => 2
POWERCalculates the specified base to the specified power.base, exponentNumberPOWER(2, 2) => 4
EXPCalculates Euler’s number (e) to the specified power.valueNumberEXP(0) => 1 EXP(1) => 2.718
LOGCalculates the logarithm of a value in the provided base. If not specified, base defaults to 10.value, [base=10]NumberLOG(100) => 2 LOG(1024, 2) => 10
MODReturns the remainder after dividing the first parameter by the second.value, divisorNumberMOD(9, 2) => 1 MOD(9, 3) => 0
VALUEConverts a text string to a number.textNumberVALUE("$1,000,000") => 1000000

Text Functions

Here you’ll find common functions for text processing, such as string operations and formatting.

Function NameDescriptionInputOutputExample
CONCATENATEJoins multiple value type parameters into a single text value.text1, [text2, ...]TextCONCATENATE("Hello ", "Teable") => Hello Teable
FINDFinds the position of a substring in specified text. Returns 0 if substring not found.stringToFind, whereToSearch, [startFromPosition]NumberFIND("Teable", "Hello Teable") => 7
SEARCHFinds the position of a substring in specified text. Returns empty if substring not found. Similar to FIND but returns empty instead of 0.stringToFind, whereToSearch, [startFromPosition]Text or EmptySEARCH("Teable", "Hello Teable") => 7
MIDExtracts a specified number of characters from a text string starting at a specified position.text, whereToStart, countTextMID("Hello Teable", 6, 6) => "Teable"
LEFTExtracts a specified number of characters from the start of a string.text, countTextLEFT("2023-09-06", 4) => "2023"
RIGHTExtracts a specified number of characters from the end of a string.text, countTextRIGHT("2023-09-06", 5) => "09-06"
REPLACEReplaces a specified number of characters starting at a specified position with replacement text.text, whereToStart, count, replacementTextREPLACE("Hello Table", 7, 5, "Teable") => "Hello Teable"
REGEXP_REPLACEReplaces all substrings matching a regular expression with replacement text.text, regular_expression, replacementTextREGEXP_REPLACE("Hello Table", "H.* ", "") => "Teable"
SUBSTITUTEReplaces old text with new text. Can specify an index to replace a specific occurrence of old text. If no index specified, replaces all occurrences.text, oldText, newText, [index]TextSUBSTITUTE("Hello Table", "Table", "Teable") => "Hello Teable"
LOWERConverts string to lowercase.textTextLOWER("Hello Teable") => "hello teable"
UPPERConverts string to uppercase.textTextUPPER("Hello Teable") => "HELLO TEABLE"
REPTRepeats text a specified number of times.text, numberTextREPT("Hello!", 3) => "Hello!Hello!Hello!"
TRIMRemoves whitespace characters from the beginning and end of a string.textTextTRIM(" Hello ") => "Hello"
LENCounts the number of characters in a string.textNumberLEN("Hello") => 5
TReturns the parameter if it’s text, otherwise returns empty.valueText or EmptyT("Hello") => "Hello" T(100) => null
ENCODE_URL_COMPONENTReplaces certain characters with encoded equivalents for constructing URLs or URIs. Does not encode: - _ . ~valueTextENCODE_URL_COMPONENT("Hello Teable") => "Hello%20Teable"

Logical Functions

Logical functions primarily deal with conditional judgments and logical operations. This section details the use of functions like IF, AND, OR, etc.

Function NameDescriptionInputOutputExample
IFReturns value1 if the logical parameter is true, otherwise returns value2. Can be used for nested IF statements and checking if cells are empty.logical, value1, value2String | Number | Boolean | DatetimeIF(2 > 1, "A", "B") => "A" IF(2 > 1, TRUE, FALSE) => TRUE
SWITCHMatches an input expression against a series of values and returns the corresponding result. Can return a default value if no match is found. Can often replace nested IF() formulas.expression, [pattern, result]..., [default]String | Number | Boolean | DatetimeSWITCH("B", "A", "Value A", "B", "Value B", "Default Value") => "Value B"
ANDReturns true if all parameters are true; otherwise returns false.logical1, [logical2, ...]BooleanAND(1 < 2, 5 > 3) => true AND(1 < 2, 5 < 3) => false
ORReturns true if any parameter is true.logical1, [logical2, ...]BooleanOR(1 < 2, 5 < 3) => true OR(1 > 2, 5 < 3) => false
XORReturns true if an odd number of parameters are true.logical1, [logical2, ...]BooleanXOR(1 < 2, 5 < 3, 8 < 10) => false XOR(1 > 2, 5 < 3, 8 < 10) => true
NOTInverts the logical value of its parameter.booleanBooleanNOT(1 < 2) => false NOT(1 > 2) => true
BLANKReturns a null value.-nullBLANK() => null IF(2 > 3, "Yes", BLANK()) => null
ERRORReturns an error value.messageErrorIF(2 > 3, "Yes", ERROR("Calculation")) => "#ERROR: Calculation"
IS_ERRORReturns true if the expression causes an error.exprBooleanIS_ERROR(ERROR()) => true

Date Functions

Date functions help users process and transform date and time data. This section covers operations like adding, subtracting, and formatting dates.

Function NameDescriptionInputOutputExample
TODAYReturns the current date.-DatetimeTODAY() => "2023-09-08 00:00"
NOWReturns the current date and time.-DatetimeNOW() => "2023-09-08 16:50"
YEARReturns the four-digit year of a date.dateNumberYEAR("2023-09-08") => 2023
MONTHReturns the month of a date as a number between 1 (January) and 12 (December).dateNumberMONTH("2023-09-08") => 9
WEEKNUMReturns the week number of the year.dateNumberWEEKNUM("2023-09-08") => 36
WEEKDAYReturns the day of the week as an integer between 0 and 6. You can optionally provide a second parameter (“Sunday” or “Monday”) to start the week on that day.date, [startDayOfWeek]NumberWEEKDAY("2023-09-08", "Monday") => 5
DAYReturns the day of the month as a number between 1-31.dateNumberDAY("2023-09-08") => 8
HOURReturns the hour of a date as a number between 0 (12:00am) and 23 (11:00pm).dateNumberHOUR("2023-09-08 16:50") => 16
MINUTEReturns the minute of a date as an integer between 0 and 59.dateNumberMINUTE("2023-09-08 16:50") => 50
SECONDReturns the seconds of a date as an integer between 0 and 59.dateNumberSECOND("2023-09-08 16:50:30") => 30
FROMNOWCalculates the number of days between the current date and another date.date, unitNumberFROMNOW({Date}, "day") => 25
TONOWCalculates the number of days between the current date and another date.date, unitNumberTONOW({Date}, "day") => 25
DATETIME_DIFFReturns the datetime difference in specified units. Default unit is seconds. (See unit specifier list.)date1, date2, [unit]NumberDATETIME_DIFF("2022-08-01", "2023-09-08", "day") => 403
WORKDAYReturns the workday date offset from the start date, excluding specified holidaysdate, count, [holidayStr]DatetimeWORKDAY("2023-09-08", 200) => "2024-06-14 00:00:00"
WORKDAY_DIFFReturns 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 format dates.date1, date2, [holidayStr]NumberWORKDAY_DIFF("2023-06-18", "2023-10-01") => 75
IS_SAMECompares two dates to a unit and determines if they are the same. Returns true if they are, false otherwise.date1, date2, [unit]BooleanIS_SAME("2023-09-08", "2023-09-10") => false
IS_AFTERDetermines if date1 is later than date2. Returns true if it is, false otherwise.date1, date2, [unit]BooleanIS_AFTER("2023-09-10", "2023-09-08") => true IS_AFTER("2023-09-10", "2023-09-08", "month") => false

Array and Other Functions

In addition to the above categories, this section introduces functions for handling arrays and other specific data types.

Function NameDescriptionInputOutputExample
COUNTALLReturns the count of all elements, including text and blanks.value1, [value2, ...]NumberCOUNTALL(100, 200, "", "Teable", TRUE()) => 5
COUNTAReturns the count of non-empty values. This function counts both numbers and text values.value1, [value2, ...]NumberCOUNTA(100, 200, 300, "", "Teable", TRUE) => 4
COUNTReturns the count of numeric items.value1, [value2, ...]NumberCOUNT(100, 200, 300, "", "Teable", TRUE) => 3
ARRAY_JOINJoins an array of rollup items into a string using a separator.array, [separator]StringARRAY_JOIN(["Tom", "Jerry", "Mike"], "; ") => "Tom; Jerry; Mike"
ARRAY_UNIQUEReturns only the unique items in an array.arrayArrayARRAY_UNIQUE([1, 2, 3, 2, 1]) => [1, 2, 3]
ARRAY_FLATTENFlattens an array by removing any array nesting. All items become elements of a single array.arrayArrayARRAY_FLATTEN([1, 2, " ", 3, true], ["ABC"]) => [1, 2, 3, " ", true, "ABC"]
ARRAY_COMPACTRemoves empty strings and null values from an array. Preserves “false” and strings containing one or more whitespace characters.arrayArrayARRAY_COMPACT([1, 2, 3, "", null, "ABC"]) => [1, 2, 3, "ABC"]
RECORD_IDReturns the ID of the current record.-StringRECORD_ID() => "recxxxxxx"