What is a Formula Field?
A formula field is a computed column that calculates its value based on other fields in the same record. Formulas can:- Perform mathematical calculations
- Concatenate and manipulate text
- Work with dates and times
- Apply conditional logic
- Reference other fields in the same table
100+ Functions
Math, text, date, logical, and more
Auto-Calculate
Updates automatically when dependencies change
No Code Required
Use familiar spreadsheet-like syntax
Type Safe
Returns specific data types (number, text, boolean, date)
Formula Syntax
Formulas use a spreadsheet-like syntax with curly braces for field references:Referencing Fields
Wrap field names in curly braces:{Price}- References the Price field{First Name}- Spaces are allowed{Total Amount}- Any field title works
Operators
| Operator | Description | Example |
|---|---|---|
+ | Addition | {Price} + {Tax} |
- | Subtraction | {Budget} - {Spent} |
* | Multiplication | {Quantity} * {UnitPrice} |
/ | Division | {Total} / {Count} |
& | Concatenation | {FirstName} & " " & {LastName} |
= | Equals | {Status} = "Complete" |
!= | Not equals | {Priority} != "Low" |
> | Greater than | {Score} > 80 |
< | Less than | {Stock} < 10 |
>= | Greater or equal | {Age} >= 18 |
<= | Less or equal | {Discount} <= 50 |
Formula Functions
Mathematical Functions
Basic Math
Aggregate Functions
Text Functions
Date & Time Functions
Logical Functions
Conditional Functions
Formula Data Types
Formulas return one of four data types:Numeric Formulas
Return numbers:- Number
- Currency
- Percent
- Decimal
- Rating
- Duration
String Formulas
Return text:- Single Line Text
- URL
- Phone Number
Boolean Formulas
Return true/false:- Checkbox
Date Formulas
Return dates:- Date
- DateTime
- Time
UITypes.ts:640-662
Creating a Formula Field
Enter your formula
Type your formula in the editor:
- Use curly braces
{}for field names - Use functions with parentheses
- Combine with operators
Formula Examples
Calculate Total Price
Full Name
Discount Price
Days Until Due
Age from Birthdate
Overdue Status
Email from Name
Grade from Score
Nested IF Alternative (using IFS)
Priority Label
Tax Calculation
Commission
Business Days Between Dates
Formula Field Properties
Formula fields store additional metadata:| Property | Description |
|---|---|
formula | The compiled formula expression |
formula_raw | The original user-entered formula |
parsed_tree | Abstract syntax tree for execution |
error | Validation errors (if any) |
Column.ts:440-452
Managing Formula Fields
Creating a Formula
Updating a Formula
Getting Formula Details
Formula Errors
When a formula has errors, theerror property contains details:
Common Errors
- Missing Field: Referenced field doesn’t exist
- Syntax Error: Invalid formula syntax
- Type Mismatch: Incompatible data types
- Circular Reference: Formula references itself
- Invalid Function: Unknown function name
Error Handling
Formulas with errors:- Show error in field settings
- Display error message in cells
- Prevent saving until fixed
addFormulaErrorIfMissingColumn helper function
Advanced Formula Techniques
Nested Functions
Combine multiple functions:Multiple Conditions
Complex logic with AND/OR:Conditional Aggregation
Date Range Checks
Performance Considerations
Formulas recalculate on dependencies
Formulas recalculate on dependencies
When a field used in a formula changes, the formula recalculates. Minimize dependencies for better performance.
Complex formulas may slow queries
Complex formulas may slow queries
Very complex formulas with many nested functions can impact query performance. Simplify where possible.
Formulas are computed on read
Formulas are computed on read
Values are calculated when records are retrieved, not stored. For very large datasets, consider using views with filters.
Best Practices
Use descriptive field names
Use descriptive field names
Clear field names make formulas easier to read:
{TotalAmount} vs {field_123}Break complex formulas into steps
Break complex formulas into steps
Create intermediate formula fields for complex calculations instead of one massive formula.
Test with edge cases
Test with edge cases
Test formulas with:
- Empty/null values
- Zero values
- Negative numbers
- Extreme dates
Document your formulas
Document your formulas
Add field descriptions explaining what the formula calculates and why.
Use ROUND for currency
Use ROUND for currency
Always round currency calculations to 2 decimals:
ROUND({Price}, 2)Handle division by zero
Handle division by zero
Use IF to check for zero:
IF({Divisor} = 0, 0, {Dividend} / {Divisor})Formulas vs. Rollups
| Feature | Formula | Rollup |
|---|---|---|
| Scope | Same record only | Across linked records |
| Fields | Any field in table | Needs link field |
| Functions | 100+ functions | Aggregate only (SUM, AVG, etc.) |
| Use Case | Calculate within record | Summarize related records |
| Example | {Qty} * {Price} | Sum of all order amounts |
Related Resources
Fields
Learn about all field types including formulas
Rollups
Aggregate data from linked records
Lookups
Display values from linked records
Functions Reference
Complete list of formula functions