---
title: "Formula reference: all functions in Softr Databases"
description: "Every operator and function you can use in a Softr Databases formula field, grouped by kind: text, numbers, dates, logic and lists, with syntax and an example."
canonical: "https://docs.softr.io/databases/formulas"
updated: "2026-12-04"
---

# Formula reference: all functions in Softr Databases

A formula field calculates a value from the other fields of the same record: a total, a label, a due date, a yes or no. The value updates by itself when the fields it uses change. Find the operator or function you need below, copy the example, and swap in your own field names.

![The Projects table with a Project size formula column showing Large for budgets of $15,000 and more and Standard below](/databases/formulas/formula-column.2x.webp)

_A formula field, Project size, that labels each project from its budget._

## How a formula field works

Add the field, write the formula, and Softr works out what kind of value it returns.

1. Add a field to your table and choose **Formula** as the field type.
2. Select **Edit formula** and write the formula. Select **Help me write a formula** to have AI draft one from a description.
3. In the editor, select the **Insert variables** icon to add a field reference.
4. Save the field.

![The field settings of Project size, a Formula field, with the formula IF(Budget >= 15000, "Large", "Standard") outlined and Help me write a formula below](/databases/formulas/formula-editor.2x.webp)

A formula field is read-only. Nobody can type a value into it.

The field has two tabs, **Settings** and **Formatting**. **Formatting** is available only when the formula returns a date or a number. There you choose how the value looks, such as decimal places or the date style. For date styles, see [Date and time formatting](/databases/datetime-formatting).

### Write a formula

- Put a field name in curly brackets: `{Contact Name}`.
- Put text in quotation marks, single or double: `"At Risk"`.
- Write numbers without quotation marks: `0.1`, `1000`.
- Separate the arguments of a function with commas.
- Put one function inside another to build up a result.

```plain
IF({Score} > 90, "A", IF({Score} > 80, "B", "C"))
```

Write function names in capitals, as the examples do.

### Result type

Softr picks the type of the result from the formula. A formula that starts with `SUM` returns a number. One that starts with `DATEADD` returns a date. One that compares values with `=` or `>` returns a checkbox. Anything else returns text.

### When a formula fails

When a formula cannot compute, the cell stays empty. A division by zero, a misspelled function and an invalid regular expression all give an empty cell. Wrap a formula in [IFERROR](#iferror) to show a fallback value instead.

## Operators

| Operator          | What it does                                   | Example                            | Result                   |
| ----------------- | ---------------------------------------------- | ---------------------------------- | ------------------------ |
| `+` `-` `*` `/`   | Adds, subtracts, multiplies, divides           | `{Price} * 1.1`                    | 110 when Price is 100    |
| `^`               | Raises to a power                              | `{Base}^2`                         | 25 when Base is 5        |
| `&`               | Joins text                                     | `{First Name} & " " & {Last Name}` | Jane Doe                 |
| `=` `!=` `<>`     | Equal, not equal (`!=` and `<>` mean the same) | `{Status} = "Open"`                | TRUE when Status is Open |
| `<` `<=` `>` `>=` | Compares values                                | `{Total} >= 1000`                  | TRUE when Total is 1500  |

Use parentheses to set the order of a calculation, such as `({Price} + {Shipping}) * {Quantity}`.

## Text functions

### CONCATENATE

Joins values into one text.

```plain
CONCATENATE(value1, value2, ...)
```

Example: `CONCATENATE({First Name}, " ", {Last Name})` returns `Jane Doe`.

### LEFT

Returns the first characters of a text.

```plain
LEFT(text, count)
```

Example: `LEFT({Project Name}, 3)` returns `Web` when Project Name is `Website Redesign`.

### RIGHT

Returns the last characters of a text.

```plain
RIGHT(text, count)
```

Example: `RIGHT({Product Code}, 4)` returns `1234` when Product Code is `ITEM-1234`.

### MID

Returns part of a text, from a start position for a number of characters. Positions start at 1.

```plain
MID(text, start, count)
```

Example: `MID({Product Code}, 6, 4)` returns `1234` when Product Code is `ITEM-1234-XYZ`.

### LEN

Returns the number of characters in a text, spaces included.

```plain
LEN(text)
```

Example: `LEN({Description})` returns `16` when Description is `Softr is awesome`.

### FIND

Returns the position of a text inside another text, or 0 when it is not there. Matching is case-sensitive. Positions start at 1.

```plain
FIND(text_to_find, text, [start])
```

Example: `FIND("Softr", {App Name})` returns `12` when App Name is `Build with Softr`.

### SEARCH

Works like FIND, with the same arguments. Matching is case-sensitive too, so wrap both texts in [LOWER](#lower) to ignore case.

```plain
SEARCH(text_to_find, text, [start])
```

Example: `SEARCH(LOWER("softr"), LOWER({App Name}))` returns `12` when App Name is `Build with SOFTR`.

### REPLACE

Replaces a number of characters, from a start position, with new text.

```plain
REPLACE(text, start, count, new_text)
```

Example: `REPLACE({Product Code}, 6, 4, "5678")` returns `ITEM-5678-XYZ` when Product Code is `ITEM-1234-XYZ`.

### SUBSTITUTE

Replaces every occurrence of a text with another text.

```plain
SUBSTITUTE(text, old_text, new_text)
```

Example: `SUBSTITUTE({Title}, "Old", "New")` returns `New Project` when Title is `Old Project`.

### TRIM

Removes the spaces at the start and the end of a text.

```plain
TRIM(text)
```

Example: `TRIM({User Input})` returns `Hello` when User Input is `Hello`.

### LOWER

Converts a text to lowercase.

```plain
LOWER(text)
```

Example: `LOWER({Email})` returns `user@example.com` when Email is `User@Example.com`.

### UPPER

Converts a text to uppercase.

```plain
UPPER(text)
```

Example: `UPPER({Status})` returns `PENDING` when Status is `pending`.

### CAPITALIZE

Makes the first character uppercase and the rest lowercase.

```plain
CAPITALIZE(text)
```

Example: `CAPITALIZE({Status})` returns `In progress` when Status is `in PROGRESS`.

### PROPER

Makes the first letter of each word uppercase and the rest lowercase.

```plain
PROPER(text)
```

Example: `PROPER({Full Name})` returns `Jane Doe` when Full Name is `jane doe`.

### DOMAIN

Returns the domain of a URL or an email address.

```plain
DOMAIN(url_or_email)
```

Example: `DOMAIN({Website})` returns `www.example.com` when Website is `https://www.example.com/page`. For `jane@example.com`, it returns `example.com`.

### REPT

Repeats a text a number of times.

```plain
REPT(text, count)
```

Example: `REPT("*", 5)` returns `*****`.

### T

Returns the value if it is text, and an empty text if it is anything else.

```plain
T(value)
```

Example: `T({Name})` returns `Jane` when Name is `Jane`. It returns an empty text when the value is a number or a date.

### STRINGIFY

Converts any value to text.

```plain
STRINGIFY(value)
```

Example: `STRINGIFY({Price})` returns `100` as text when Price is 100.

## Regular expression functions

These functions use Java regular expression syntax. A pattern that is invalid or too complex to evaluate leaves the cell empty.

### REGEX\_MATCH

Returns TRUE when the whole text matches the pattern.

```plain
REGEX_MATCH(text, pattern)
```

Example: `REGEX_MATCH({Code}, "[A-Z]{3}-[0-9]+")` returns TRUE when Code is `ABC-123`.

### REGEX\_EXTRACT

Returns the first part of the text that matches the pattern, or an empty text.

```plain
REGEX_EXTRACT(text, pattern)
```

Example: `REGEX_EXTRACT({Code}, "[0-9]+")` returns `1234` when Code is `ITEM-1234-XYZ`.

### REGEX\_REPLACE

Replaces every match of the pattern with a replacement text.

```plain
REGEX_REPLACE(text, pattern, replacement)
```

Example: `REGEX_REPLACE({Phone}, "\D", "")` returns `1234567890` when Phone is `(123) 456-7890`.

## Number functions

### ROUND

Rounds a number to a number of decimal places. The default is 0.

```plain
ROUND(number, [decimals])
```

Example: `ROUND({Total Cost}, 2)` returns `123.46` when Total Cost is 123.456.

### CEILING

Rounds a number up to the next whole number, or to the next multiple of `significance`.

```plain
CEILING(number, [significance])
```

Example: `CEILING({Price}, 10)` returns `30` when Price is 23.

### FLOOR

Rounds a number down to the previous whole number, or to the previous multiple of `significance`.

```plain
FLOOR(number, [significance])
```

Example: `FLOOR({Price}, 10)` returns `20` when Price is 27.

### MROUND

Rounds a number to the nearest multiple.

```plain
MROUND(number, multiple)
```

Example: `MROUND({Revenue}, 1000)` returns `93000` when Revenue is 93291.13.

### ABS

Returns the absolute value of a number.

```plain
ABS(number)
```

Example: `ABS({Balance})` returns `50` when Balance is -50.

### MOD

Returns the remainder of a division. A divisor of 0 returns 0.

```plain
MOD(number, divisor)
```

Example: `MOD({Total Items}, 3)` returns `1` when Total Items is 10.

### SQRT

Returns the square root of a number.

```plain
SQRT(number)
```

Example: `SQRT({Area})` returns `4` when Area is 16.

### SUM

Adds numbers.

```plain
SUM(number1, number2, ...)
```

Example: `SUM({Price1}, {Price2})` returns `300` when Price1 is 100 and Price2 is 200.

### AVERAGE

Returns the average of numbers.

```plain
AVERAGE(number1, number2, ...)
```

Example: `AVERAGE({Score1}, {Score2}, {Score3})` returns `90` when the scores are 80, 90 and 100.

### MIN

Returns the smallest number.

```plain
MIN(number1, number2, ...)
```

Example: `MIN({Bid1}, {Bid2})` returns `450` when Bid1 is 500 and Bid2 is 450.

### MAX

Returns the largest number.

```plain
MAX(number1, number2, ...)
```

Example: `MAX({Revenue Q1}, {Revenue Q2})` returns `1200` when Q1 is 1000 and Q2 is 1200.

### COUNT

Counts the items in a list that are not empty, such as the values of a lookup field.

```plain
COUNT(list)
```

Example: `COUNT({Tasks Lookup})` returns `3` when the lookup holds `Task1`, `Task2` and `Task3`.

### NUMBER

Converts a value to a number. It returns 0 when the value is not a number.

```plain
NUMBER(value)
```

Example: `NUMBER({Quantity Text})` returns `42` when Quantity Text is `42`, and `0` when it is `abc`.

### RAND

Returns a random decimal from 0 up to, but not including, 1.

```plain
RAND()
```

Example: `RAND()` returns a value such as `0.4517`.

### RANDBETWEEN

Returns a random whole number between a low and a high number.

```plain
RANDBETWEEN(low, high)
```

Example: `RANDBETWEEN(1, 100)` returns a value such as `42`.

## Date and time functions

Date functions take a date field or a text such as `"2025-06-15"` or `"2025-06-15 14:30:00"`. They return dates as text in the format `yyyy-MM-dd`, or `yyyy-MM-dd HH:mm:ss` when the value has a time. Softr stores and calculates all times in UTC.

### TODAY

Returns today's date in UTC.

```plain
TODAY()
```

Example: `TODAY()` returns `2025-05-29` on May 29, 2025.

### NOW

Returns the current date and time in UTC.

```plain
NOW()
```

Example: `NOW()` returns `2025-05-29 16:42:10`.

### DATE

Converts a value to a date, without a time.

```plain
DATE(value)
```

Example: `DATE("2025-06-15 14:30:00")` returns `2025-06-15`.

### DATETIME

Converts a value to a date with a time.

```plain
DATETIME(value)
```

Example: `DATETIME("2025-06-15T14:30:00")` returns `2025-06-15 14:30:00`.

### DATESTR

Returns a date as text in the format `yyyy-MM-dd`.

```plain
DATESTR(date)
```

Example: `DATESTR({Start Date})` returns `2025-06-01` when Start Date is June 1, 2025.

### DATETIME\_FORMAT

Turns a date into text with a pattern you choose. The patterns are listed in [Date and time formatting](/databases/datetime-formatting).

```plain
DATETIME_FORMAT(date, pattern)
```

Example: `DATETIME_FORMAT({Due Date}, "MM/dd/yyyy")` returns `06/15/2025` when Due Date is June 15, 2025.

### DATETIME\_PARSE

Turns a text into a date, using a pattern that describes the text.

```plain
DATETIME_PARSE(text, pattern)
```

Example: `DATETIME_PARSE({Date Text}, "MM/dd/yyyy")` returns `2025-12-31` when Date Text is `12/31/2025`.

### SET\_TIMEZONE

Shows a date with a time in another time zone. Use a time zone name such as `America/New_York`. A date without a time returns nothing.

```plain
SET_TIMEZONE(date, time_zone)
```

Example: `SET_TIMEZONE({Event Date}, "America/New_York")` returns `2025-05-29 10:00:00` when Event Date is `2025-05-29 14:00:00` UTC.

### DATEADD

Adds a number of units to a date. Use a negative number to subtract. The unit is `seconds`, `minutes`, `hours`, `days`, `weeks`, `months` or `years`, in singular or plural.

```plain
DATEADD(date, count, unit)
```

Example: `DATEADD({Start Date}, 7, "days")` returns `2025-06-08` when Start Date is June 1, 2025.

### DATETIME\_DIFF

Returns the difference between two dates as a whole number, `date1` minus `date2`. The result is negative when `date2` is later. The unit is `seconds`, `minutes`, `hours`, `days`, `months` or `years`. The default is `seconds`.

```plain
DATETIME_DIFF(date1, date2, [unit])
```

Example: `DATETIME_DIFF({Due Date}, TODAY(), "days")` returns the days left until the due date.

### EDATE

Moves a date by a number of months and keeps the day. When the day does not exist in the new month, the result is the last day of that month.

```plain
EDATE(date, [months])
```

Example: `EDATE({Start Date}, 3)` returns `2025-04-30` when Start Date is January 31, 2025.

### EOMONTH

Returns the last day of the month, a number of months after the date. The default is 0, the same month.

```plain
EOMONTH(date, [months])
```

Example: `EOMONTH({Start Date}, 1)` returns `2025-07-31` when Start Date is June 15, 2025.

### WORKDAY

Returns the date a number of working days after the start date. Working days are Monday to Friday. Add holiday dates to skip them too.

```plain
WORKDAY(start_date, days, [holiday1, holiday2, ...])
```

Example: `WORKDAY({Start Date}, 5)` returns `2025-06-09` when Start Date is Monday, June 2, 2025.

### WORKDAY\_DIFF

Returns the number of working days between two dates, counting both dates. Add holiday dates to skip them.

```plain
WORKDAY_DIFF(start_date, end_date, [holiday1, holiday2, ...])
```

Example: `WORKDAY_DIFF("2025-06-02", "2025-06-09")` returns `6`. With `"2025-06-04"` as a holiday, it returns `5`.

### IS\_SAME

Returns TRUE when two dates are the same.

```plain
IS_SAME(date1, date2)
```

Example: `IS_SAME({Start Date}, {End Date})` returns TRUE when both are June 1, 2025.

### IS\_AFTER

Returns TRUE when `date1` is later than `date2`.

```plain
IS_AFTER(date1, date2)
```

Example: `IS_AFTER({Due Date}, TODAY())` returns TRUE when Due Date is still ahead.

### IS\_BEFORE

Returns TRUE when `date1` is earlier than `date2`.

```plain
IS_BEFORE(date1, date2)
```

Example: `IS_BEFORE({Start Date}, TODAY())` returns TRUE when Start Date has passed.

### YEAR

Returns the year of a date.

```plain
YEAR(date)
```

Example: `YEAR({Due Date})` returns `2025` when Due Date is June 15, 2025.

### MONTH

Returns the month of a date, from 1 to 12.

```plain
MONTH(date)
```

Example: `MONTH({Due Date})` returns `6` when Due Date is June 15, 2025.

### DAY

Returns the day of the month.

```plain
DAY(date)
```

Example: `DAY({Due Date})` returns `15` when Due Date is June 15, 2025.

### HOUR

Returns the hour, from 0 to 23. It returns 0 when the value has no time.

```plain
HOUR(datetime)
```

Example: `HOUR({Meeting})` returns `14` when Meeting is `2025-06-15 14:30:00`.

### MINUTE

Returns the minute, from 0 to 59. It returns 0 when the value has no time.

```plain
MINUTE(datetime)
```

Example: `MINUTE({Meeting})` returns `30` when Meeting is `2025-06-15 14:30:00`.

### SECOND

Returns the second, from 0 to 59. It returns 0 when the value has no time.

```plain
SECOND(datetime)
```

Example: `SECOND({Meeting})` returns `45` when Meeting is `2025-06-15 14:30:45`.

### WEEKDAY

Returns the day of the week as a number. By default the week starts on Sunday, so 1 is Sunday and 7 is Saturday. Pass `"monday"` to start on Monday, so 1 is Monday and 7 is Sunday.

```plain
WEEKDAY(date, [start_day])
```

Example: `WEEKDAY({Due Date}, "monday")` returns `1` when Due Date is Monday, June 2, 2025.

### WEEKNUM

Returns the week number of the year. By default the week starts on Sunday. Pass `"monday"` to start on Monday.

```plain
WEEKNUM(date, [start_day])
```

Example: `WEEKNUM({Due Date})` returns `23` when Due Date is June 2, 2025.

### DAYS\_IN\_MONTH

Returns the number of days in the month of a date. Without a date, it uses the current month.

```plain
DAYS_IN_MONTH([date])
```

Example: `DAYS_IN_MONTH({Due Date})` returns `28` when Due Date is February 15, 2025.

### CREATED\_TIME

Returns the date and time the record was created, in UTC.

```plain
CREATED_TIME()
```

Example: `DATETIME_FORMAT(CREATED_TIME(), "MM/dd/yyyy")` returns `05/29/2025` for a record created on May 29, 2025.

### LAST\_MODIFIED\_TIME

Returns the date and time the record last changed, in UTC.

```plain
LAST_MODIFIED_TIME()
```

Example: `DATETIME_FORMAT(LAST_MODIFIED_TIME(), "MM/dd/yyyy")` returns `05/28/2025` for a record last changed on May 28, 2025.

## Logic functions

### IF

Returns one value when a condition is true and another when it is false. Without a third argument, a false condition returns an empty value.

```plain
IF(condition, value_if_true, [value_if_false])
```

Example: `IF({Total} > 1000, "Large order", "Small order")` returns `Large order` when Total is 1500.

### SWITCH

Compares a value with a list of cases and returns the result of the first match. The last argument is the default result.

```plain
SWITCH(value, case1, result1, case2, result2, ..., default)
```

Example: `SWITCH({Priority}, 1, "High", 2, "Medium", 3, "Low", "Unknown")` returns `Medium` when Priority is 2.

### AND

Returns TRUE when every argument is true.

```plain
AND(condition1, condition2, ...)
```

Example: `AND({Price} > 50, {Quantity} > 0)` returns TRUE when Price is 75 and Quantity is 2.

### OR

Returns TRUE when at least one argument is true.

```plain
OR(condition1, condition2, ...)
```

Example: `OR({Status} = "Open", {Status} = "In progress")` returns TRUE when Status is `Open`.

### XOR

Returns TRUE when an odd number of arguments are true, and FALSE otherwise.

```plain
XOR(condition1, condition2, ...)
```

Example: `XOR({Option A}, {Option B})` returns TRUE when only one of the two is checked, and FALSE when both are.

### NOT

Reverses a TRUE or FALSE value.

```plain
NOT(condition)
```

Example: `NOT({Completed})` returns FALSE when Completed is checked.

### TRUE

Returns the number 1.

```plain
TRUE()
```

Example: `IF(TRUE(), "Always", "Never")` returns `Always`.

### FALSE

Returns the number 0.

```plain
FALSE()
```

Example: `IF(FALSE(), "Always", "Never")` returns `Never`.

### BLANK

Returns an empty text.

```plain
BLANK()
```

Example: `IF({Name} = "", BLANK(), {Name})` returns an empty text when Name is empty.

### ISERROR

Returns TRUE when the expression fails, such as a division by zero.

```plain
ISERROR(expression)
```

Example: `ISERROR({Total} / {Count})` returns TRUE when Count is 0.

### IFERROR

Returns the expression, or a fallback value when the expression fails.

```plain
IFERROR(expression, fallback)
```

Example: `IFERROR({Total} / {Count}, 0)` returns `0` when Count is 0.

### ERROR

Makes the formula fail on purpose, which leaves the cell empty.

```plain
ERROR()
```

Example: `IF({Quantity} < 0, ERROR(), {Quantity} * {Price})` leaves the cell empty when Quantity is negative.

## List functions

List functions work on a field that holds several values, such as a lookup or a multi-select. They return text with the values separated by commas.

### ARRAYJOIN

Joins the values of a list into one text. The default separator is a comma and a space.

```plain
ARRAYJOIN(list, [separator])
```

Example: `ARRAYJOIN({Tags Lookup}, " | ")` returns `Red | Blue` when the lookup holds `Red` and `Blue`.

### ARRAYCOMPACT

Removes empty values from a list.

```plain
ARRAYCOMPACT(list)
```

Example: `ARRAYCOMPACT({Tasks Lookup})` returns `Task1, Task2` when the lookup holds `Task1`, an empty value and `Task2`.

### ARRAYUNIQUE

Removes duplicate values from a list.

```plain
ARRAYUNIQUE(list)
```

Example: `ARRAYUNIQUE({Categories Lookup})` returns `A, B` when the lookup holds `A`, `B` and `A`.

### ARRAYSLICE

Returns part of a list, from a start position up to, but not including, an end position. Positions start at 1.

```plain
ARRAYSLICE(list, start, [end])
```

Example: `ARRAYSLICE({Tags Lookup}, 2, 4)` returns `B, C` when the lookup holds `A`, `B`, `C` and `D`.

## Record functions

### RECORD\_ID

Returns the unique ID of the record. A **Record ID** field type returns the same value without a formula.

```plain
RECORD_ID()
```

Example: `RECORD_ID()` returns the ID of the record the formula sits in.

## Common formulas

| Goal                     | Formula                                      |
| ------------------------ | -------------------------------------------- |
| Build a label            | `{City} & " - " & {Country}`                 |
| Sort records into groups | `IF({Revenue} > 10000, "High", "Low")`       |
| Days until a deadline    | `DATETIME_DIFF({Due Date}, TODAY(), "days")` |
| Add 10% to a price       | `ROUND({Price} * 1.1, 2)`                    |
| Show a date as text      | `DATETIME_FORMAT({Due Date}, "MMM d, yyyy")` |

For the other limits of Softr Databases, see [Limits and specs](/databases/limits). For every field type, see [Field types](/databases/field-types).
