- Calculate days until renewal from a date field
- Sum ARR across all related opportunities
- Pull the account owner’s email from a related entity
- Compute a weighted health score from multiple factors
- Derive a contract value from unit price and quantity
Creating a Formula Field
You need admin access to create formula fields. The Object Manager is only available to users with the admin role.- Navigate to Admin > Settings > Object Manager
- Select the entity tab (Accounts, People, Opportunities, etc.)
- Click + Create Field
- Enter a field name and select a field type that supports formulas (Text, Number, Date, Boolean, Currency, etc.)
- Check This is a formula field
- Click Save — the formula editor opens automatically
Formula Types
The formula editor supports four formula types. Select the one that fits your use case.Equation
Write a custom expression combining fields, functions, and operators. This is the most flexible formula type.When to use
When to use
Use Equation when you need custom logic — conditional calculations, arithmetic across fields, or text formatting. Examples: weighted scores, tier classifications, concatenated labels.
- Select Equation as the formula type
- Write your expression in the formula editor (see Using the Formula Editor below)
- Choose a null handling option
- Validate and preview your formula
- Click Save
Rollup
Aggregate values from related entities. Rollups traverse a relationship and apply an aggregation function to a field on the related records.When to use
When to use
Use Rollup to summarize data across related records — total revenue from opportunities, count of open tickets, average deal size, etc.
- Select Rollup as the formula type
- Choose an aggregation type:
| Aggregation | Description |
|---|---|
| SUM | Total of all values |
| COUNT | Number of records |
| MIN | Smallest value |
| MAX | Largest value |
| AVG | Average of all values |
| COLLECT_UNIQUE | List of unique values |
- Select the related entity and the relationship to follow
- Select the field to aggregate from the related entity
- Optionally add filter conditions to narrow which related records are included
equals, not equals, contains, greater than, and less than. Multiple filters are combined with AND logic.
Cross-Object
Reference a field value from a related entity. Cross-object formulas follow a relationship and pull a single field value.When to use
When to use
Use Cross-Object to surface a value from a related record without duplicating data — for example, displaying the account owner’s email on a contact record.
- Select Cross-Object as the formula type
- Select the source entity and the relationship to follow
- Select the source field to reference
- Optionally apply a transform:
| Transform | Description |
|---|---|
| None | No transformation |
| UPPER | Convert to uppercase |
| LOWER | Convert to lowercase |
| TRIM | Remove leading/trailing whitespace |
| SPLIT_FIRST | Extract the first part (before delimiter) |
Time Calculation
Calculate time differences between dates. Time calculations work with date fields and return a numeric value in your chosen unit.When to use
When to use
Use Time Calculation for date-based metrics — days until renewal, time since last activity, duration between two milestones, etc.
- Select Time Calculation as the formula type
- Choose a calculation type:
| Calculation Type | Description | Fields Required |
|---|---|---|
| Time Between | Duration between two date fields | Start date + End date |
| Time Since | Time elapsed from a past date to today | Date field |
| Time Until | Time remaining from today to a future date | Date field |
- Select the required date field(s)
- Choose the time unit: Days, Hours, Minutes, Months, or Years
Using the Formula Editor
The formula editor is available when creating Equation-type formulas. It provides a rich editing experience with autocomplete, syntax highlighting, and validation.Inserting Fields
There are two ways to insert a field reference into your formula:- Type
@in the editor to open the autocomplete dropdown. Start typing to filter by field name. Use arrow keys to navigate and press Enter or Tab to insert. - Click the Field button in the toolbar to open the field picker drawer. Browse or search for fields, including related fields from other entities.
{field_name}.
Related fields follow the format {relationship_name}.{field_name} and appear in a separate section in the field picker.
Inserting Functions
Functions are also available through two methods:- Type
@and start typing a function name. Functions appear alongside fields in the autocomplete dropdown. - Click the Function button in the toolbar to open the function picker drawer. Browse by category, view syntax and examples, and click to insert.
Toolbar
The toolbar provides quick-insert buttons for common elements:- Field and Function buttons open their respective picker drawers
- Parentheses
()for grouping expressions - Arithmetic operators
+-*/ - Comparison operators
=!=><>=<=
Operators
Arithmetic:| Operator | Description |
|---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
| Operator | Description |
|---|---|
= | Equal to |
!= | Not equal to |
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
Parsed Preview
As you type, a real-time parsed preview appears below the editor. It shows your formula with color-coded syntax highlighting:- Fields — highlighted as primary-colored pills
- Functions — highlighted as accent-colored pills
- Operators — displayed in muted text
- Values (strings and numbers) — displayed in green
- Parentheses — displayed in amber
Null Handling
For Equation formulas, you can choose how the formula handles null (empty) field values:| Option | Behavior |
|---|---|
| Return Null | If any referenced field is null, the formula returns null |
| Treat as Zero | Null numeric values are treated as 0; null text values are treated as empty strings |
| Skip | Records with null values in referenced fields are skipped |
Validation
Click the Validate button to check your formula before saving. Validation checks for:- Syntax errors — Malformed expressions, unmatched parentheses, invalid function usage
- Referenced fields — Lists all fields your formula depends on
- Complexity score — Rates your formula’s complexity (Low, Medium, or High)
- Empty circle — Not yet validated
- Spinner — Validation in progress
- Green checkmark — Validation passed
- Red alert — Validation errors found
- Orange alert — Validation warnings
Preview
After writing your formula, use the Preview section to test it against real records.- Expand the Preview section at the bottom of the editor
- Select which entities to test against
- View the results table showing each entity name and its computed value
null for empty results, or an error message if the formula fails for a specific record.
Managing Formula Fields
To edit a formula field:- Navigate to Admin > Settings > Object Manager
- Find the formula field in the field list
- Click to edit and modify the formula configuration
- Validate, preview, and save
Formula fields are read-only — their values are computed automatically and cannot be manually edited. If you need to override a calculated value, create a separate custom field instead.