Hello, do you want to know about “**How to Create a Formula Field in Salesforce**?”. In this post we will discuss about formula field in salesforce, What is a Formula Field in Salesforce, How to create a formula field in salesforce classic.

## What is a Formula Field in Salesforce?

A formula field is a system-generated custom field of the Formula data type. This is a read-only field, which means we cannot edit the Formula field.

- A formula field in a read-only field. The Formula field retrieves a value from a Formula expression.
- When the source field changes automatically, the Formula field changes (updates).
- A Salesforce formula is used to calculate custom fields, validation rules, flow logic, and more.
- We use the Formula Editor to create a formula in Salesforce.

### Formula Editor and it’s Features

In the Salesforce Editor, we use different elements when creating different fields in a Salesforce formula. As shown in the image above, we notice several elements. They are

**Text area:-**This is the space where we enter the formula.**Insert Fields:**Allows the user to select the fields that will be used in our formula.- In
**sert Operator:-**Insert Operator will list all math and logical operators available in salesforce. **Function menu:-**Using menu function we enter formula functions like AND, ISNUMBER, CASE, NOT etc.**Syntax Check:-**To check whether the formula syntax is valid or not.

## How to create a formula field in salesforce?

In this Salesforce tutorial, we’ll create a formula field for an invoice object. Here we will create a formula for the discount amount. Where the discount should be applied to all purchases over $500.

Syntax :If Invoice Amount > 500, final Amount = Invoice Amount – (20/100*Amount__c), Amount__c).

As stated above, the discount will only be applied to purchases over $500, otherwise the final amount will be the invoiced amount. Let’s create a formula field in salesforce.

## How to create a formula field in salesforce?

Go to the Setup | Build | Create | Object | Invoice | Create a new file.

Here, select the visit object from which you want to create a formula field and click New Custom Field.

**Step 1:- select the “field type” as formula and click Next.**

Now select Currency, Field Label Field Name and click next button and enter the formula field as shown above in the formula editor as shown above. Finally, save all the settings as mentioned in our previous instructions for salesforce.

### Let’s check the working of Formula Field

Now go to Invoice Object and create a new invoice record.

As mentioned above, we give a value of $1500.

After adding the formula field, we get the final amount of $1200.

## Conclusion

Here we clearly understood the **how to create a formula field **and about formula editor in salesforce. In our upcoming Salesforce tutorials, we’ll learn cross Object Formulas.