Recently, I was working in the finance department of a multinational company that sells electronic gadgets.
To manage their sales data, they use Salesforce. One day, I was tasked with calculating the total revenue for each sales transaction and rounding it to the nearest whole amount.
As a solution, I discovered that this Salesforce tool provides us with the function named “ROUND”, which helps in rounding the nearest number to a number that we specify.
In this tutorial, we will learn about the Round() function in Salesforce. We will also study the syntax for this function, as well as numerous Salesforce examples from real-world organisations.
ROUND() Function in Salesforce
The ROUND() function in Salesforce is a built-in mathematical function used to perform calculations. In basic terms, the ROUND() function rounds a number to a specified number of digits.
In addition, the ROUND() function only supports numeric data types, such as Integers, Decimals, and Currency. However, if you attempt to use a text, date, or other non-numeric data type, an error will result.
The syntax of the ROUND() function is as follows:
ROUND(number,num_digits)Here, the number is the value whose rounded value we want to find, and num_digits is the number of digits to which the number is rounded. The value of the parameter number can be a field, a constant number, or a complex formula.
For a better understanding of how the ROUND function works, let’s look at an example.
As I mentioned above, I need to figure out the total revenue for each sales transaction and round it to the nearest whole amount. I will therefore utilise Salesforce’s ROUND() method for this. The formula is as follows:
ROUND(Total_Revenue__c, 0)With this, we learned the syntax of the ROUND() function and an example. We’ll now look at how to use the ROUND() function in Salesforce.
Use the ROUND() Function in Salesforce
The following are the steps to use the ROUND() function in Salesforce:
- Click the “Gear Icon” in the top right corner of the screen. Click “Setup“ in the dropdown menu to continue.

- After choosing the Setup option, the setup screen is displayed. The “Object Manager” is found in the Navigation Bar next to the Home tab. Click on it.

- After clicking it, the object manager page is displayed. We can see a lot of the objects here. To find the object we wish to apply the ROUND() function to, enter a search term in the search field.
- In this case, I search for the “Price Book” object because I need to round the price to the nearest value.
- To access the “Price Book” object page, click the Price Book item.

- The “Field & Relationship“ option is located under this price book object page in the details area on the left side of the page. From the menu, choose “Field & Relationship”.
- After choosing the field and relationship option, the field and relationship page is displayed. On the field and relationship page, click the “New” button at the top.

- Click the new button to open the data type page. There are many field types on this page. In this instance, I select the “Formula“ data type field because the advanced formula will make use of the ROUND function.
- To go to the next step, click the “Next” button.

- After clicking the next button, the screen to choose the output type appears. Enter the information now by filling out the “Field Label” and the “Field Name”, which is automatically filled in when you put the cursor on the field. In this instance, I typed “Rounded Price” into the field label.
- Select the “Output Data Type“ for the field where the outcome will be saved. In this instance, I check the radio button next to the “Currency” data type to set the formula return type to currency, and set the “Decimal Place” to 1.
- Move to the next step by clicking the “Next” button.

- Enter the ROUND() function formula in the advanced formula editor. In this case, I want to round the book’s price using the ROUND function. The formula reads as follows:
ROUND(Price__c * 20, 0) / 20- In this formula, the price field is multiplied by 20.
- The result is then rounded to the next whole number using the ROUND function.
- After that, the price is then rounded to the nearest value by dividing the rounded amount by 20.
- Select “Check Syntax” to validate the formula and ensure there are no errors.
- Enter the “Description” and “Help text” as well as “Handle the empty field”, which is optional information.
- Click the “Next” button to proceed to the security stage for the formula field.

- In this step, establish “Field-Level Security“. Now choose the profiles to which we wish to grant field-level security edit access to this field. If field-level security is not added, the field will be hidden from all profiles.
- Because I want it to be visible to all profiles, I have chosen “Visible” in this instance. After that, click the “Next” button located at the top.

- After configuring the field-level security, add the custom field to the “Page Layout“. Select the page layout that includes this field. The field won’t appear on any pages unless we choose a page layout.
- Click the “Save” button to save the formula field.

We can use the formula field once we have created it. Let’s look at an example:
- Open the “Price Book” Tab and create a new book price in the “Price” field.
- The “Rounded Price” field, which displays the output of the ROUND() function, appears when you click on the Details Section.

As a result, we now understand how to use the ROUND() Function in Salesforce.
Conclusion
In conclusion, we have learned that the Salesforce ROUND() function is an effective way to obtain the number nearest to the one we specify, limiting the result to the specified number of digits. Moreover, we have learned the ROUND() function syntax and a number of real-world business scenarios.
You may like to read:
- PI() Function in Salesforce
- MOD() Function in Salesforce | Calculate remainder in Salesforce
- TAN() Function in Salesforce
- ATAN() Function in Salesforce
- Salesforce DAY Function
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.