In this Salesforce tutorial, we will learn about the SQRT() function in Salesforce. We will also study the syntax for this function and numerous Salesforce examples from real-world organizations.
I recently worked in a multinational company that manages their Customer Relationship Management and sales data, using Salesforce. One day I got the task of calculating the lead age square to calculate the lead’s experience level.
As a solution, I discovered that this Salesforce tool provides us with the function named “SQRT” which helps calculate any given number’s positive square root.
So, If you want to understand how to use the SQRT() function in Salesforce Lightning and Salesforce Classic, let’s explore further.
SQRT() Function in Salesforce
The SQRT() function in Salesforce is the mathematical function available in Salesforce that is used to carry out mathematical calculations. In basic terms, the SQRT() function is used when we need to find out the positive square root of a given number.
In addition, the SQRT() function only supports numerical data types like Integers, Decimals, and Currency. However, an error will result if you attempt to use a text, date, or other non-numeric data type.
The syntax of the SQRT() function is as follows:
SQRT(number/field/formula)
The value for which we try to obtain a positive square value is represented by the parameter number/field/formula. The parameter value may take the form of a field, a fixed value, or an advanced formula.
For a better understanding of how the SQRT function works, let’s look at an example.
As I mentioned above, I need to find the lead age square to calculate the lead’s experience level. Therefore, I will utilize Salesforce SQRT() function for this. The formula is as given below:
SQRT(Age__c)
With this, we learned the syntax of the SQRT() function as well as an example. We’ll now look at how to use the SQRT() function in Salesforce Lightning.
Read TRUNC() Function in Salesforce
How to use SQRT Function in Salesforce Lightning
The following are the steps to use the SQRT() function in Salesforce Lightning:
Step 1: Open Salesforce in Lightning mode and click the “Gear Icon” in the top right corner of the screen. Click “Setup” in the dropdown menu to continue.

Step 2: 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.

Step 3: 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 SQRT() function to, search in the search field. In this case, I search for the “Product” object because I need to calculate the square of a product’s weight to get the estimated shipping price.
Step 4: To open the Product object page, select the “Product” item.

Step 5: Under this product object page in the details section on the left side of the page you can see the Field & Relationship option. Select “Field & Relationship” from the menu.
Step 6: After selecting the field and relationship option, the field and relationship page opens. Go to the top menu of the field and relationship page and click the “New” button.

Step 7: Click the new button to bring up the data type page. On this page, there are numerous different forms of data fields. In this instance, I select the “Formula” data type field because the advanced formula will make use of the SQRT function.
Step 8: To go to the next step, click the “Next” button.

Step 9: After clicking the next button, the screen for choosing the output type displays. 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 “Shipping Price” into the field label.
Step 10: Choose the “Output Data Type” for the field that is going to store the outcome. In this case, I set the “Decimal Place” to 1 and check the radio button next to the “Currency” data type to convert the formula return type into a currency.
Step 11: Move to the next, click on the “Next” button.

Step 12: Enter the SQRT() function formula in the advanced formula editor. In this case, I want to estimate the shipping price based on the product weight. The formula is as follows:
SQRT(Weight__c)
Here, we pass the weight field of the product “Weight__c” to the SQRT function to get the estimated shipping price according to the weight.
Step 13: Select “Check Syntax” to validate the formula and ensure there are no errors.
Step 14: Enter the “Description” and “Help text” as well as “Handle the empty field” which is optional information.
Step 15: Click the “Next” button to move to the formula field’s security step.

Step 16: In this step, establish “Field-Level Security”. 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.

Step 17: Add the custom field to the “Page Layout” after configuring the field-level security. Select the page layout that includes this field. The field would not show up on any pages if we do not choose a page layout.
Step 18: 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 “Product” Tab and create a new product with the field “Weight”.
- The “Shipping Price” field, which displays the SQRT() function output, then appears when you click on the Details Section.

As a result, we now understand how to use the SQRT() Function in Salesforce Lightning. Now, we’ll look at how to use the SQRT() Function in Salesforce Classic.
How to use SQRT Function in Salesforce Classic
The following are the steps to use the SQRT() function in Salesforce Classic:
Step 1: Log in to your Salesforce account first; after you are logged in, the Salesforce Lightning Edition should already be open. Click “Profile Picture” once you are in Salesforce Lightning. The drop-down menu for the profile photo is available. There is a “Switch To Salesforce Classic” option below this selection of profile pictures. Click on it.

Step 2: Next, select “Setup” from the menu.

Step 3: The setup screen is displayed after choosing the setup option. Now navigate to the “Build” section. Next, click “Customize” and choose the object for whose field we want to use the SQRT() function. Since I need to know the team’s performance by response time, I opt for the “Cases” object in this case.
Step 4: From the drop-down menu, choose “Cases”. There is a field option available and a drop-down list is visible. Click “Fields” from the drop-down menu.

Step 5: The order custom field page is displayed after choosing the fields option. At the bottom of the page is a section labeled “Case custom field and relationship”. Click “New” to create a new field.

Step 6: Clicking the new button opens the data type page. There are various types of data type fields on the page. I am selecting the “Formula” data type field in this instance.
Step 7: Click the “Next” button to move on to the following step.

Step 8: The “Choose Output Type” window opens after choosing the next button. To input the information, complete the “Field Label” and “Field Name” (which are pre-filled when you click on the field). I typed “Lead Performance” into the field label in this instance.
Step 9: Select the “Output Data Type” field where the outcome will be saved. In this instance, I set the “Decimal Place” to 0 and check the radio button next to the “Number” data type to get the formula return type as a number.
Step 10: Click the “Next” button to move on to another step.

Step 11: Fill out the advanced formula editor with the SQRT() function formula. In this instance, I want to use the SQRT function to determine the lead performance by response time. The formula for the equation is as follows:
SQRT(Response_Time__c)
Here, we pass the lead “Response_Time__c” response time to the SQRT function to get the estimated lead performance according to their response time.
Step 12: To verify the formula and make sure there are no mistakes, click “Check Syntax”.
Step 13: If you would like, define the “Description” and “Help text” as well as “Handle the empty field”.
Step 14: Click the “Next” button to go to the formula field’s security page.

Step 15: Make “Field-Level Security” available. Choose the profiles to whom you wish to provide permission for editing field-level security. The field will be hidden from all profiles if field-level security is not specified.
I have selected “Visible” because I want it to be visible to all profiles. To continue, click the “Next” button located at the top.

Step 16: Add the custom field to the “Page Layout” after configuring the field-level security. Choose the page layout that includes this field. The field would not appear on any pages if we choose not to select a layout.
Step 17: Click the “Save” button to save the formula field.

Once we have established the formula field, we may use it. Let’s examine an illustration:
- Create a new case with the “Response Time” field by opening the Cases Tab.
- Click on the Details section after that, and the “Lead Performance” field will display the SQRT() function output.

We now understand how to use the SQRT() Function in Salesforce Classic.
Conclusion
We have learned the Salesforce SQRT() function. Moreover, we have learned the SQRT() function in Salesforce syntax and several real-world business scenarios.
In addition, we also covered the steps for using the SQRT() Function in Salesforce Lightning and Salesforce Classic.
You may also like:
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.