CommunityHire an ExpertSign Up
DatabasesFormula reference
Tables and fields

Formula reference: all functions in Softr Databases

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.

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

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

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.

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.
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 to show a fallback value instead.

Operators

OperatorWhat it doesExampleResult
+ - * /Adds, subtracts, multiplies, divides{Price} * 1.1110 when Price is 100
^Raises to a power{Base}^225 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} >= 1000TRUE 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.

CONCATENATE(value1, value2, ...)

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

LEFT

Returns the first characters of a text.

LEFT(text, count)

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

Returns the last characters of a text.

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.

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.

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.

FIND(text_to_find, text, [start])

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

Works like FIND, with the same arguments. Matching is case-sensitive too, so wrap both texts in LOWER to ignore case.

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.

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.

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.

TRIM(text)

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

LOWER

Converts a text to lowercase.

LOWER(text)

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

UPPER

Converts a text to uppercase.

UPPER(text)

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

CAPITALIZE

Makes the first character uppercase and the rest lowercase.

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.

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.

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.

REPT(text, count)

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

T

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

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.

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.

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.

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.

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.

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.

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.

FLOOR(number, [significance])

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

MROUND

Rounds a number to the nearest multiple.

MROUND(number, multiple)

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

ABS

Returns the absolute value of a number.

ABS(number)

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

MOD

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

MOD(number, divisor)

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

SQRT

Returns the square root of a number.

SQRT(number)

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

SUM

Adds numbers.

SUM(number1, number2, ...)

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

AVERAGE

Returns the average of numbers.

AVERAGE(number1, number2, ...)

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

MIN

Returns the smallest number.

MIN(number1, number2, ...)

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

MAX

Returns the largest number.

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.

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.

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.

RAND()

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

RANDBETWEEN

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

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.

TODAY()

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

NOW

Returns the current date and time in UTC.

NOW()

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

DATE

Converts a value to a date, without a time.

DATE(value)

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

DATETIME

Converts a value to a date with a time.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

IS_BEFORE(date1, date2)

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

YEAR

Returns the year of a date.

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.

MONTH(date)

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

DAY

Returns the day of the month.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

NOT(condition)

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

TRUE

Returns the number 1.

TRUE()

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

FALSE

Returns the number 0.

FALSE()

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

BLANK

Returns an empty text.

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.

ISERROR(expression)

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

IFERROR

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

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.

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.

ARRAYJOIN(list, [separator])

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

ARRAYCOMPACT

Removes empty values from a list.

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.

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.

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.

RECORD_ID()

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

Common formulas

GoalFormula
Build a label{City} & " - " & {Country}
Sort records into groupsIF({Revenue} > 10000, "High", "Low")
Days until a deadlineDATETIME_DIFF({Due Date}, TODAY(), "days")
Add 10% to a priceROUND({Price} * 1.1, 2)
Show a date as textDATETIME_FORMAT({Due Date}, "MMM d, yyyy")

For the other limits of Softr Databases, see Limits and specs. For every field type, see Field types.

Use these docs with your AI tools

An AI agent can read this documentation directly. You do not need an account or an API key. Everything here is public and read-only.

Query these docs via MCP

Recommended

Add this server to Claude, Claude Code, Cursor, Mistral, or any tool that supports MCP. Your agent can then search Softr Documentation documentation and read it in full, instead of answering from memory.

https://docs.softr.io/mcp
  • searchFind the passages that answer a question.
  • fetchRead one page in full, as Markdown.
  • list_pagesSee every page in this documentation.

Query these docs over HTTP

The same tools also work as plain web requests. Use this for scripts, or for any tool that does not support MCP. There is one endpoint per tool. Arguments go in the query string, and the answer comes back as JSON.

https://docs.softr.io/api/docs/search?query=custom+domain

Read the OpenAPI description. It is built from the same definitions as the tools, so it always matches what the endpoints do.

Read these docs as Markdown

Add .md to any page URL to get its Markdown source. You can also send the headerAccept: text/markdown to the page URL itself.

To read the whole documentation in one file, open llms-full.txt. For a short index of every page, open llms.txt.