Roll-up summaries versus formula fields
Key Takeaway
A formula field can reach up to related records, but it can't aggregate detail records. To aggregate them, use a roll-up summary field, which needs a master-detail relationship.
Formula fields and roll-up summary fields both calculate a field's value for you, but they work at different scales. A formula field derives its value from other fields, expressions, or values. A roll-up summary field shows a value on a master record, calculated from its related detail records, such as the count or total of the records in a related list.
What each field calculates from
A formula field calculates its value using fields within a single record, but a cross-object formula can also reach up to related records.
A formula field can't aggregate detail records (also called child records), though. For example, you can't directly reference aggregate fields on parent objects, such as GrandTotal on the Quote object.
To aggregate values from detail records, use a roll-up summary field. A roll-up summary field calculates its value from a set of related records, such as those in a related list.
For example, imagine a custom Account field called Total Invoice Amount. As a roll-up summary field, it can show the sum of all related invoice records in the account's Invoices related list.