Notion formulas let you calculate values, transform text, and make decisions inside database properties. Many users struggle because the syntax differs from Excel or Google Sheets. You need to understand the correct operators, functions, and data types to build reliable formulas. This article explains every operator and built-in function available in Notion formulas, with practical examples for each category.
Formulas work on database properties of type Formula. You can reference other properties by name, use constants, and nest functions. The result updates automatically when source data changes. Knowing the exact syntax prevents errors and saves editing time.
Key Takeaways: Notion Formula Operators and Functions
- Arithmetic operators + – / % ^: Perform basic math on number properties and constants.
- Comparison operators == != > < >= <=: Return true or false for conditional logic.
- Logical operators and or not: Combine multiple conditions inside if() statements.
- String functions concat(), slice(), replace(), contains(): Manipulate text from title or text properties.
- Date functions now(), dateAdd(), dateSubtract(), formatDate(): Calculate deadlines, durations, and formatted date strings.
Notion Formula Basics: Data Types and Syntax Rules
Every Notion formula returns one of four data types: string, number, boolean (true/false), or date. You cannot mix types in an operation without explicit conversion. For example, adding a number to a string produces an error. Use the format() function to convert numbers to strings, or toNumber() to convert strings to numbers.
Property names in formulas are case-sensitive. If a property is named “Unit Price”, you must write prop("Unit Price") exactly. Constants like true, false, and empty are lowercase. Comments are not supported inside formulas. The formula editor shows a red underline on syntax errors and a preview of the result.
Data Type Conversion Functions
Notion provides five conversion functions. format() converts any value to a string. toNumber() converts a string that looks like a number to an actual number. unaryMinus() flips the sign of a number. abs() returns the absolute value. round() rounds to the nearest integer. Use ceil() and floor() for explicit rounding up or down.
Arithmetic, Comparison, and Logical Operators
Operators in Notion formulas follow standard mathematical precedence: exponentiation first, then multiplication/division, then addition/subtraction. Use parentheses to override the order. The table below lists every operator and its behavior.
| Category | Operator | Example | Result |
|---|---|---|---|
| Arithmetic | + | prop(“Price”) + prop(“Tax”) | Sum of two numbers |
| Arithmetic | – | prop(“Total”) – prop(“Discount”) | Difference |
| Arithmetic | prop(“Quantity”) prop(“Unit Price”) | Product | |
| Arithmetic | / | prop(“Revenue”) / prop(“Count”) | Quotient |
| Arithmetic | % | prop(“Score”) % 10 | Remainder after division |
| Arithmetic | ^ | prop(“Length”) ^ 2 | Exponentiation |
| Comparison | == | prop(“Status”) == “Done” | true if equal |
| Comparison | != | prop(“Status”) != “Done” | true if not equal |
| Comparison | > | prop(“Age”) > 18 | true if greater |
| Comparison | < | prop(“Age”) < 18 | true if less |
| Comparison | >= | prop(“Score”) >= 90 | true if greater or equal |
| Comparison | <= | prop(“Score”) <= 50 | true if less or equal |
| Logical | and | prop(“Age”) > 18 and prop(“Status”) == “Active” | true only if both true |
| Logical | or | prop(“Priority”) == “High” or prop(“Priority”) == “Urgent” | true if at least one true |
| Logical | not | not prop(“IsComplete”) | inverts true/false |
Comparison operators work on numbers and strings. String comparison is alphabetical and case-sensitive. Logical operators only work with boolean values. Use if() to convert other types to boolean when needed.
String Functions: Manipulating Text in Formulas
Notion includes nine string functions. They accept strings from properties or literal text in double quotes. The index for slice() and replace() starts at 1, not 0.
- concat(string1, string2, …)
Joins multiple strings into one. Example:concat(prop("First"), " ", prop("Last"))returns “John Doe”. - slice(string, start, end)
Extracts a substring from start index to end index (exclusive). Example:slice("Notion", 1, 4)returns “Not”. - length(string)
Returns the number of characters. Example:length(prop("Title"))returns 6 for “Notion”. - replace(string, old, new)
Replaces the first occurrence of old with new. Example:replace("abc-123", "-", "")returns “abc123”. - contains(string, substring)
Returns true if substring is found. Example:contains(prop("Email"), "@")returns true. - test(regex, string)
Returns true if the string matches the regular expression. Example:test("^[0-9]+$", prop("ID"))checks if ID contains only digits. - replaceAll(string, regex, new)
Replaces all matches of a regex pattern. Example:replaceAll("a1b2c3", "[0-9]", "")returns “abc”. - lower(string)
Converts to lowercase. Example:lower(prop("Name"))returns “alice”. - upper(string)
Converts to uppercase. Example:upper(prop("Name"))returns “ALICE”.
Date Functions: Working with Time and Deadlines
Notion treats dates as a distinct data type. You cannot add a number directly to a date. Instead, use dateAdd() and dateSubtract(). The now() function returns the current date and time in the workspace time zone.
- now()
Returns the current date-time. Use it to calculate days remaining:dateBetween(prop("Due"), now(), "days"). - dateAdd(date, number, unit)
Adds a time interval. Unit can be “years”, “months”, “days”, “hours”, “minutes”, “seconds”. Example:dateAdd(prop("Start"), 7, "days")adds one week. - dateSubtract(date, number, unit)
Subtracts a time interval. Example:dateSubtract(prop("Due"), 1, "months")subtracts one month. - dateBetween(date1, date2, unit)
Returns the difference between two dates in the specified unit. The result can be negative if date1 is earlier. Example:dateBetween(prop("End"), prop("Start"), "days"). - formatDate(date, format)
Converts a date to a string using a format pattern. Patterns use moment.js tokens. Example:formatDate(prop("Created"), "MMM D, YYYY")returns “Apr 5, 2025”. - fromTimestamp(timestamp)
Converts a Unix timestamp in milliseconds to a date. Example:fromTimestamp(prop("Epoch") 1000). - timestamp(date)
Converts a date to a Unix timestamp in milliseconds. Example:timestamp(now()). - minute(date), hour(date), day(date), month(date), year(date)
Extract individual components from a date. Example:year(prop("Start"))returns 2025.
Conditional and Utility Functions
The if() function is the primary way to create conditional logic. Its syntax is if(condition, value_if_true, value_if_false). Both result values must be the same data type. Nest if() statements for multiple conditions.
Utility functions include empty (the constant for null or missing values), max() and min() for comparing two or more numbers, and add() which sums a list of numbers. The map() and filter() functions work with rollup properties to process arrays.
Common Formula Mistakes and How to Avoid Them
Type Mismatch Error in Arithmetic
If a formula uses prop("Quantity") prop("Price") and one property is a text field, Notion shows a type error. Check that both properties are set to Number or Currency type in the database schema. Use toNumber(prop("Field")) if the source is text.
Incorrect Date Unit Names
The unit parameter in date functions must be exactly one of these: “years”, “months”, “days”, “hours”, “minutes”, “seconds”. Using “week” or “year” without “s” causes a syntax error. Always use the plural form.
String Comparison with == is Case-Sensitive
Comparing prop("Status") == "done" against a property value “Done” returns false. Use lower(prop("Status")) == "done" to make the comparison case-insensitive.
Notion Formula Functions: Quick Comparison Table
| Category | Function | Returns | Common Use Case |
|---|---|---|---|
| String | concat() | string | Combine first and last name |
| String | contains() | boolean | Check if email has @ symbol |
| String | replace() | string | Remove dashes from phone numbers |
| Date | dateBetween() | number | Days until deadline |
| Date | formatDate() | string | Display date as “Jan 5, 2025” |
| Conversion | format() | string | Convert number to text for display |
| Conversion | toNumber() | number | Parse text that contains digits |
| Math | round() | number | Round currency to whole dollars |
| Math | abs() | number | Absolute difference between two values |
| Conditional | if() | any | Show “Overdue” when past deadline |
Notion formulas give you precise control over database calculations and text transformations. Start by testing each function in a separate formula property to see its output. Use the empty constant to handle missing values gracefully. For complex logic, break the formula into multiple formula properties and reference them as intermediate steps. This approach makes debugging faster and keeps each formula readable.