Loading
The online Trailblazer Community becomes read-only Oct 30, 2026Read More
Important Advisory: iOS Update Impacting CG Mobile ApplicationRead More
Extend Salesforce with Clicks, Not Code
Calculate Field Values with Formulas

Calculate Field Values with Formulas

A formula is an algorithm that derives its value from other fields, expressions, or values. Formulas can help you automatically calculate the value of a field based on other fields.

Required Editions

Available in: both Salesforce Classic and Lightning Experience

Available in: All Editions

Reports and Approvals aren’t available in Database.com

Tip
Tip Setup with Agentforce can help you work with formulas more efficiently. For more information, see Setup with Agentforce and Formulas in Setup with Agentforce.

Watch a Demo: Watch Video Demo Getting Started With Formulas (Salesforce Classic)

This video gives a brief introduction to Salesforce formulas, accessing the formulas editor in the app, and how to use the editor tools to create formulas.

  • Where are Formulas Used in Salesforce?
    Many areas in Salesforce use formulas. Before you begin using formulas, review the differences in their uses.
  • Formula Data Types
    The data type of a formula determines the type of data you expect returned from your formula.
  • Elements of a Formula
    Learn the elements you can combine to build a formula: literal values, field references, functions, operators, and comments. Understand what each element does and see an example of how to enter it.
  • Formula Operators and Functions by Context
    Use these operators and functions when building formulas. All functions are available everywhere that you can include a formula, such as formula fields, validation rules, approval processes, and workflow rules, unless otherwise specified.
  • Using Date, Date/Time, and Time Values in Formulas
    Use Date, Date/Time, and Time values in formulas to manage payment deadlines, calculate contract ages, and support other time-dependent business needs. Learn how to create and compare these values, convert between data types and text, and account for time zones.
  • Build a Formula Field
    Your custom formula fields require special attributes.
  • Formula Field Limits and Restrictions
    Before you create formula fields, be aware of their limits and limitations.
  • Formula Best Practices
    You can use the Formula Editor in Salesforce to construct a simple formula with a few clicks. But what if you want to build something more complex? Use these tips to help you map out formula logic and make it easier to troubleshoot errors.
  • Find Examples of Advanced Formulas
    Review sample formulas for sales, service, financial, employee-services, and integration scenarios. Examples cover commissions and discounts, cross-object references, date and time calculations, image links, data completeness, and more. Adapt the formulas to your fields and business requirements.
  • Formulas: How Do I ... ?
    A collection of topics around formulas, including common math calculation, text functions, and more.
  • Common Formula Errors
    Review common errors that can occur with formulas and how to fix them.
  • Get an Explanation for a Formula and Fix Errors with Einstein for Formulas
    Use Einstein for Formulas to get an explanation for a formula and fix syntax errors in a formula used in Formula fields, default field values, and record validation rules. As an admin, you can use Einstein’s assistance for existing formulas or for the new ones that you create.
 
Loading
Salesforce Help | Article