Formula Field Limits and Restrictions | Salesforce
Formula Field Limits and Restrictions
Before you create formula fields, be aware of their limits and limitations.
Available in: both Salesforce Classic and Lightning Experience
Available in: All Editions
Formula fields have these limits.
Character limit—Formula fields can contain up to 3,900 characters, including spaces, return characters, and comments. If your formula needs more characters, create separate formula fields and reference them in another formula field.
The maximum number of displayed characters after an evaluation of a formula expression is 1,300.
Save size limit—Formula fields can’t exceed 4,000 bytes when saved. The save size is different from the number of characters if you use multi-byte characters in your formula.
Compile size limit—Formula fields can’t exceed 5,000 bytes when compiled. The compile size is the size of the formula (in bytes) including all of the fields, values, and formulas it references. There is no direct correlation between the compile size and the character limit. Some functions, such as TEXT, DATEVALUE, DATETIMEVALUE, and DATE significantly increase the compile size.
Default value formulas for a record type can only reference fields for that record type. However, formula fields and formulas for approvals or rules for a record type can reference fields for that record type as well as any records that are related through a lookup or master-detail relationship. For example, a formula for a validation rule on opportunities can reference merge fields for accounts and campaigns as well as opportunities, and a formula field on accounts can reference fields for cases.
You can’t use long text area, encrypted, or Description fields in formulas.
The value of a field can’t depend on another formula that references it.
You can’t delete fields referenced in formulas. Remove the field from the formula before deleting it.
Campaign statistic fields can’t be referenced in formulas for field updates, approval processes, workflow rules, or validation rules, but can be referenced in custom formula fields.