Salesforce offers a vast variety of tools designed to help businesses manage data more efficiently, and getting the right data in the right place at the right time is key. Two out-of-the-box features – cross-object formulas and roll-up summary fields – give you the capability to pull in data from related records.
But despite this similarity, they each play a unique role. So whether you’re summarizing child records or referencing data from across your org, understanding when to use each can make a big difference in your workflow.
What Are Cross-Object Formulas?
The cross-object is a formula field type that allows you to reference fields on related records directly. They enable admins to pull data from a related record without having to write complex queries, making them useful for displaying data from parent objects.
This capability is typically used with lookup or master-detail relationships and lets you create dynamic formulas based on the relationships between records.
Key Features of Cross-Object Formulas
- Flexible referencing: Pulls data from multiple related records via Lookup and Master-Detail relationships.
- Real-time calculation: The value is calculated and displayed instantly based on the formula, ensuring up-to-date information.
- Widely applicable: Use cases range from displaying account-related information in a custom object record to complex calculations involving related objects.
Creating a Cross-Object Formula Field
When creating a formula field on an object, it initially asks you what type you’d like to make. You won’t exactly see “cross-object” as one of the options. To give you a better idea of what they do and how to set them up, here’s a sample use case and steps.
Object: Opportunity
Use Case: Calculate the total commission on an Opportunity based on its amount and a commission rate stored in a custom field on the Account related to it.
- Go to Setup → Object Manager → Opportunity → Fields & Relationships → New.
- Select Formula and click Next.
- Give it a label. I named mine “Commission” and selected Currency as the return type. Keep it to 2 decimal places.

- On the formula editor, click Insert Field. Notice how with “Opportunity >” selected, you also have the “Account >” option, which displays the parent Account fields. In this case, we’ll pick the custom “Commission Rate” field and click Insert.

- The commission rate is in percentage form, so all we need to do to find the commission on an Opportunity is to multiply the opportunity Amount by said rate. Since we already have the Commission Rate on the formula editor (denoted as
Account.Commission_Rate__c
), type an asterisk (*) to denote multiplication, and click the insert field again. - Select “Opportunity >” and then Amount and Insert. No need to go into the Account fields again.
- Here’s how the formula should look like:
Account.Commission_Rate__c * Amount
. - Optionally, you could click Check Syntax. I know the formula in this example is pretty straightforward, but it’s a habit I’ve developed for every formula I create. With more complicated formulas I almost always forget a random parentheses or quotation mark. You can’t click that Next button without going through a syntax check first!

- Give it a description and click Next.
- Adjust field-level security and record pages/page layouts to add according to your preferences and hit Save.
Testing out this new formula, I have an existing Account in my org with a Commission Rate of 10%.

I created a new Opportunity with said Account and set USD 10,000 as the Opportunity Amount. Upon saving, here’s the value that appeared for Commission, which is 10% of the Amount.
The formula is working as expected, and the user did not have to physically check the parent Account just to get a computation on the Opportunity’s commission.

What Are Roll-Up Summary Fields?
Unlike cross-object formulas, roll-up summary fields cannot be used for Lookups as they are specific to master-detail relationships. The main purpose of a roll-up summary field is to aggregate data from related child records into the parent record.
Basically, if for example, you wanted a sum of all the values on a specific field on an object’s child records, a roll-up summary can do that for you without you having to check the related records one by one and add the field’s values manually.
A roll-up summary is not limited to just the sum though; you can also use it to get the count or min/max value.
Key Features of Roll-Up Summary Fields:
- Aggregation: Allows admins to summarize child records, whether it’s a sum, average, min, max, or count.
- Simple setup: As long as you’re sure the objects involved are linked with a Master-Detail relationship, setting up the roll-up summary on the parent object is straightforward.
- Ideal for specific use cases: Great for keeping aggregated data visible on the parent record automatically.
Creating a Roll-up Summary Field
Let’s keep this one super simple:
Object: Account
Use Case: Calculate the total amount won on the Opportunities for each Account.
Wait – didn’t we establish that roll-up summaries would only work on master-detail relationships? Accounts and Opportunities are not linked with a master-detail, so why are we setting this up involving these objects?
There are exceptions to this rule, and Accounts/Opportunities are one of them. Roll-up summaries work with Opportunities/Opportunity Products and Campaign/Campaign Member objects too. It would be great if roll-up summaries worked on other lookup relationships too, especially with custom objects – but it cannot be done out-of-the-box for now.
- Go to Setup → Object Manager → Account → Fields & Relationships → New.
- Select Roll-Up Summary as the data type.
- Give it a label and description then hit Next.

- Select “Opportunities” as the summarized object and sum as the roll-up type. The Field to Aggregate will be the Amount field.
- Under filter criteria, you have the option to include all Opportunity records or only those that meet certain criteria. In this example, we’re only looking at closed Opportunities, so select “Only records meeting certain criteria should be included in the calculation” and Closed = True + Stage = Closed Won.

- Hit Next and adjust field-level security and record pages/page layouts to add according to your preferences.
- Click Save.
Below you can see a sample Account with two closed won Opportunities each amounting to USD 50,000 and USD 10,000 respectively. Our roll-up summary field displays the total amounting to USD 60,000.

Key Differences Between Cross-Object Formulas and Roll-Up Summary Fields
Relationship Type
Cross-object formulas can work with both Lookup and master-detail relationships, so you can say they’re more versatile across different objects.
Roll-up summary fields, however, are limited to master-detail relationships (with the exceptions mentioned above), where data aggregation can occur between parent and child.
Data Processing
Cross-object formulas pull live, real-time data but do not aggregate it. Instead, they display field values as they are, or can be used in minor calculations within the formula like we did in the example above.
Roll-up summary fields are limited to performing calculations like sum, count, or min and max, providing pre-calculated data that automatically updates when a child record is created, edited, or removed.
When Should We Use Each?
It depends on your use case! Cross-object formulas are perfect when you need to reference single field values from related objects without any need for calculating their sum, total, or count.
Think of pulling an opportunity’s stage or an account’s phone number into another object and displaying it or referencing it within the formula itself. While they allow for more flexible and detailed calculations, their setup can be a bit more complex in certain scenarios.
Roll-up summary fields are ideal when you need summarized data like totals, counts, or averages to be easily available without manual intervention. Both tools are powerful and easy to use, but the choice depends on the data model and your needs.
As roll-up summaries automatically update whenever child records change, they can be resource-intensive for large datasets.
Final Thoughts
Understanding the differences between cross-object formulas and roll-up summary fields can significantly enhance your ability to work with data in Salesforce.
While both features are similar in the way that they allow you to reference field values from related records, their unique strengths – dynamic calculations for formulas and automated aggregation for summaries – make them invaluable for distinct scenarios.
Choosing the right one depends on whether you need live data reference or pre-aggregated insights. But with both these features in your arsenal and your understanding of what they’re for, you can build smarter solutions that align with your business goals.
Which of the two have you used more in your org? Let us know in the comments below!