You are currently viewing Formula Field & Validation Rule in Salesforce

Formula Field & Validation Rule in Salesforce

Sharing is caring!

Salesforce is basically a Cloud Computing CRM (Customer Relationship Management) tool where customer database is maintained in a proper format.

Many of you might have come across the terms – Formula field and Validation Rule.  In this blog, we are going to cover these 2 very useful aspects of Salesforce – Formula field & Validation Rule.

Perhaps the very first and basic question that arises here is, ‘What is a Formula?’

What is a Formula?

Formula, simply is a field type. It can be completely independent or it might take reference from some field. For example, if one is selling Cricket bats and he/she wants to associate a Service Tax of 15% with it. Now, we all know that Tax needs to be calculated on the Actual Price, here in this case, let’s say that has been entered in a Field called Amount. Once a formula for the same is written, values would be calculated and updated automatically by Salesforce.

Formula field

Formula field is a read only field, whose value is evaluated from the formula or expression defined by user. As far as its application is concerned, Formula field can be defined on both – Standard & Custom Objects. Formula field has values which change or get updated, as soon as there is any change in the expression or formula. Thus, users through application of few conditions and calculations can manipulate the values stored in Formula field as per their need.


Working with Formulas, user might come across Syntax errors at times. To debug the formulas, a very important tool is the Check Syntax button that tells you about the error and its location.

Importance of Formula field

Customer centricity, in terms of ease of understanding and accessibility, lies at the core of the concept of Salesforce. With the same spirit, let us try to understand the use of Formula in Salesforce. Let us take the following example for a better understanding.

Mr. A is a client to a firm, XYZ working in Salesforce landscape.  Now, XYZ has a huge bunch of data with it, which is related to Mr. A’s business. Mr. A wants to understand some of the data trends and get an insight into the current situation of business. However, Mr. A wants to avoid the complex calculations ought to be done to reach out to a conclusion or get desired results. This is where Formula field eases out the process and put things in perspective.

Basically, Formula fields are tools through which one can ensure the ease of understanding for the clients by controlling the way in which the data is being displayed.

Let us learn about the Steps to create Formula field.

What are the Steps to Create a Formula Field?

  • Go to Setup Menu
  • Click on Accounts
  • Click on Fields
  • Click on Customize
  • Select  New from Account Custom Fields and Relationship section
  • Select Formula (Field Data type)
  • Click on Next
  • Assign Field Label for Formula
  • Select Return Type (Numbers, Currency et cetera)
  • Create Formula by Selecting Field from Field Selector or typing in, if we know actual Field Name and using required Operators from Insert Operator
  • Click on Check Syntax to Validate
  • Click on Next
  • Establish Field Level Security. Click on Next
  • Add to Page Layouts
  • Click on Save

Moving on to another very important aspect of Salesforce, we would try to get a deep insight into Validation Rule.

Validation Rule

Validation Rule as the name suggests, validates or verifies whether the data entered by user in records,  meet the specified standards before the user saves it. Technically, Validation rule in Salesforce contains a formula or expression that evaluates the data in one or more fields in a record to meet the standards and return a value “True” or “False”.

Moreover, Validation rule displays error message to the user when the condition is “True”. This means no record would be saved when the specified criteria is not met, and the user attempts to save the record. The error message can also be defined by the user. In broader terms,

Furthermore, Validation rule helps to avoid storing of unnecessary data.For any Salesforce landscape business, Data is something that is very powerful and is quintessentially uncompromisable on quality, both for the user and the firm. Validation rule is an important aspect of Salesforce that ensures the ‘Data quality’.

Lastly, we are going to learn the Steps to create Validation rule

  1. From Setup, open the Object Manager and click Account object.Object can vary as per the user requirement.
  2. In the left sidebar, click Validation Rules.
  3. Click New.
  4. Enter the required properties for your validation rule.
  5. Provide Error message to be displayed.
  6. Click Check Syntax to check the formula used
  7. Click Save to finish

Examples of a Validation Rule

Let us look at few examples of Validation Rule:

  1. Description: For Validating the Account Number being numeric if not blank.
  2. Description: For Validating the Account Number being exactly seven digits if not blank
Salesforce™ Formulas Validation

3.Description: For Validating the account Annual Revenue neither being negative nor exceeding $100 billion.


In a nutshell, Formula Field is basically a read only field. Value of Formula Field is evaluated from the user-defined formula or expression on both standard and custom objects. Any change in the formula is automatically reflected in the value of formula field.

On the other hand, Validation rule verifies that the user entered data meets the specified standards in a record before the record can be saved by the user. Noticeably a validation rule can contain a formula or expression, which evaluates the data in single or multiple fields and returns a value of “True” or “False”. In case of an invalid value, Validation rules include an error message to display to the user.


Nitish Bharadwaj

Salesforce Principal Consultant | Chief Information Officer
An experienced professional with 5+ years of experience in consulting on and delivering Salesforce projects for mid size, large and very large customers.

Hire the best Salesforce Implementation Partner. Choose certified Salesforce Implementation Experts from Cloud Analogy now.

This Post Has 10 Comments

  1. Gabrielle

    Love the insights in this post. Cannot wait to put them to good use.

    1. Cloudanalogycrm

      Hey Gabrielle, Thanks for your kind words. We’re glad you found our content informative and helpful, and we look forward to sharing more with you.
      Keep reading 🙂

    1. Cloudanalogycrm

      Hey Kellen, Thanks for your kind words. We’re glad you found our content informative and helpful, and we look forward to sharing more with you.
      Keep reading 🙂

  2. Spencer

    Thank you so much for the important information you provide.

    1. Cloudanalogycrm

      Hey Spencer, Thanks for your kind words. We’re glad you found our content informative and helpful, and we look forward to sharing more with you.
      Keep reading 🙂

  3. Donald

    Keep carrying on and keep posting more.

    1. Cloudanalogycrm

      Hey Donald, Thanks for your kind words. We’re glad you found our content informative and helpful, and we look forward to sharing more with you.
      Keep reading 🙂

  4. Magnus

    Thanks, I enjoyed reading this article.

    1. Cloudanalogycrm

      Hey Magnus, Thanks for your kind words. We’re glad you found our content informative and helpful, and we look forward to sharing more with you.
      Keep reading 🙂

Leave a Reply

× How can I help you?