Formula functions
Every function you can use in formula fields and Formula rules, with its syntax, what it returns and an example.
- Who can use this
- Account owner, Manager
Every function you can use in formula fields and Formula rules, with its syntax, what it returns and an example.
These are all the functions you can use in formulas. Function names ignore capitals (round works like ROUND). Arguments in square brackets are optional. The same list, with a button to insert each function, is in the Function Reference under a formula's Expression box.
Unless a row says otherwise, a function given an empty value returns empty. In the examples, field names such as amount or dueDate stand for fields of your module.
| Function | Returns | What it does | Example |
|---|---|---|---|
IF(condition, then, else) | Any | then when the condition is true, otherwise else. An empty condition counts as false. | IF(amount > 1000, "Large", "Small") |
AND(a, b, …) | Yes/No | True when every argument is true. | AND(status = "paid", amount > 0) |
OR(a, b, …) | Yes/No | True when any argument is true. | OR(priority = "High", overdue) |
NOT(value) | Yes/No | Reverses a condition. | NOT(isClosed) |
SWITCH(value, match1, result1, …, [default]) | Any | The result paired with the first match, else the default (or empty). | SWITCH(country, "AE", "UAE", "SA", "Saudi Arabia", "Other") |
COALESCE(a, b, …) | Any | The first argument that is not empty. | COALESCE(mobile, phone, "No number") |
IFNULL(value, fallback) | Any | The value, or the fallback when it is empty. | IFNULL(discount, 0) |
ISNULL(value) | Yes/No | True when the value is empty (nothing, or blank text). | ISNULL(email) |
ISBLANK(value) | Yes/No | Same as ISNULL. | ISBLANK(notes) |
| Function | Returns | What it does | Example |
|---|---|---|---|
CONCAT(a, b, …) | Text | Joins the arguments as text; empty values add nothing. | CONCAT(firstName, " ", lastName) gives Alex Morgan |
UPPER(text) | Text | Upper case. | UPPER(code) |
LOWER(text) | Text | Lower case. | LOWER(email) |
TRIM(text) | Text | Removes spaces at the start and end. | TRIM(name) |
LEN(text) | Number | Number of characters. | LEN(description) |
LEFT(text, count) | Text | The first count characters. | LEFT(postcode, 3) |
RIGHT(text, count) | Text | The last count characters. | RIGHT(cardNumber, 4) |
MID(text, start, count) | Text | count characters from position start (the first character is 1). | MID("INV-2026-0001", 5, 4) gives 2026 |
SUBSTRING(text, start, count) | Text | Same as MID. | SUBSTRING(reference, 1, 3) |
REPLACE(text, search, replacement) | Text | Replaces every occurrence of search. | REPLACE(phone, " ", "") |
REGEXMATCH(text, pattern, [flags]) | Yes/No | True when the text matches the regular expression. Flag "i" ignores case. | REGEXMATCH(code, "^[A-Z]{2}-[0-9]+$") |
REGEX(text, pattern, [flags]) | Yes/No | Same as REGEXMATCH. | REGEX(email, "@example\\.com$", "i") |
REGEXEXTRACT(text, pattern, [group]) | Text | The first part of the text that matches, or capture group 1 to 9; empty when nothing matches. | REGEXEXTRACT(reference, "([0-9]+)$", 1) |
Regular expressions are checked for safety: patterns that could run very slowly (nested repeats such as (a+)+, back-references, lookarounds) are refused with "Regular expression refused: …". Very long patterns are refused too, and a very long text gives an empty result.
| Function | Returns | What it does | Example |
|---|---|---|---|
TEXT(value, [decimals]) | Text | Turns a value into text; numbers get a fixed number of decimals, rounded half away from zero. | TEXT(1.005, 2) gives 1.01 |
VALUE(text) | Number | Turns text into a number; empty when it is not one. | VALUE("42") gives 42 |
NUMBER(text) | Number | Same as VALUE. | NUMBER(quantityText) |
FX(amount, from, to, [date]) | Number | Converts an amount between currencies at the exchange rate of date (default today), rounded to the target currency's decimals; empty when there is no rate for that date. Formula fields only, not Formula rules. | FX(total, "EUR", "USD", invoiceDate) |
Exchange rates come from Settings → Currencies.
| Function | Returns | What it does | Example |
|---|---|---|---|
ABS(n) | Number | Absolute value. | ABS(-5) gives 5 |
ROUND(n, [decimals]) | Number | Rounds half away from zero to decimals places (default 0). Negative decimals round to tens, hundreds… | ROUND(1234, -2) gives 1200 |
ROUNDCUR(amount, currency) | Number | Rounds a money amount to the currency's own decimals (JPY 0, USD 2, KWD 3; an unknown code rounds to 2). Empty when the currency is not a 3-letter code. | ROUNDCUR(total, "KWD") |
TAX(amount, class, [date]) | Number | Tax on an amount before tax for a tax class (for example "standard", "reduced") at your business location's rates on date (default today), rounded to the workspace currency. Uses Settings → Tax; empty when it cannot be worked out. | TAX(subtotal, "standard") |
FLOOR(n) | Number | Rounds down. | FLOOR(4.7) gives 4 |
CEIL(n) | Number | Rounds up. | CEIL(4.2) gives 5 |
MOD(n, divisor) | Number | Remainder of n ÷ divisor, with the sign of n; empty when the divisor is 0. | MOD(10, 3) gives 1 |
POWER(base, exponent) | Number | base raised to exponent; empty when undefined or out of range. | POWER(1.05, years) |
SQRT(n) | Number | Square root; empty for negative numbers. | SQRT(area) |
For a whole document's tax, set up the module in your tax settings instead of using TAX.
These work on the values you list, not on related records (use a Rollup field for that).
| Function | Returns | What it does | Example |
|---|---|---|---|
SUM(a, b, …) | Number | Sum; empty values are skipped; empty when there are none. | SUM(price, shipping, fee) |
AVG(a, b, …) | Number | Average of the non-empty values. | AVG(score1, score2, score3) |
MIN(a, b, …) | Number | Smallest value. | MIN(quote1, quote2) |
MAX(a, b, …) | Number | Largest value. | MAX(0, balance) |
COUNT(a, b, …) | Number | How many arguments are not empty. | COUNT(phone, email, website) |
Dates are read in your workspace's time zone.
| Function | Returns | What it does | Example |
|---|---|---|---|
NOW() | Date & time | The current date and time. | IF(dueDate < NOW(), "Overdue", "OK") |
TODAY() | Date | Today's date in the workspace time zone. | DATEDIFF(dueDate, TODAY(), "days") |
YEAR(date) | Number | The year. | YEAR(createdAt) |
MONTH(date) | Number | The month, 1 to 12. | MONTH(invoiceDate) |
DAY(date) | Number | The day of the month. | DAY(birthday) |
HOUR(dateTime) | Number | The hour, 0 to 23. | HOUR(createdAt) |
MINUTE(dateTime) | Number | The minute, 0 to 59. | MINUTE(startTime) |
WEEKDAY(date, [type]) | Number | Day of the week. Type 1 (default): Sunday = 1 … Saturday = 7; type 2: Monday = 1 … Sunday = 7; type 3: Monday = 0 … Sunday = 6. | WEEKDAY(deliveryDate, 2) |
DATEDIFF(end, start, [unit]) | Number | The difference in "days" (default; calendar days, time of day ignored), "hours", "minutes", "seconds", "months" or "years". | DATEDIFF(NOW(), createdAt, "days") |
DATEADD(date, n, unit) | Date or date & time | Adds n "days", "months", "years", "hours", "minutes" or "seconds". Month ends clamp (31 January + 1 month = 28 February); a date stays a date. | DATEADD(startDate, 30, "days") |
NOW() and TODAY() are recalculated whenever a record is shown, but sorting and filtering use the value saved with the record. See Formulas.
| Message or symptom | Why | What to do |
|---|---|---|
| "Unknown function …()" | The formula uses a function that is not in this list. | Use a function from this page. |
| "…() takes 1–2 arguments, got 3" (numbers vary) | Wrong number of arguments. | Check the function's syntax above. |
| "Regular expression refused: …" | The pattern could run very slowly. | Simplify the pattern. |
| "FX() is not available in calculate rules…" | FX was used in a Formula rule. | Use a formula field for the conversion. |