In this Salesforce tutorial, we will learn the ATAN() function and how we can use it for calculating the arc tangent value of numerical data. Moreover, we will focus on the syntax of the ATAN() function and some practical examples for implementation.
Recently I worked for a company that utilizes Salesforce as a CRM tool. While working here, I was given the responsibility to determine employee productivity so that the company could decide the hike for their employees.
I discovered an ATAN() function as a solution for this, which enabled me to determine employee productivity. Let’s now go into more detail about how to use Salesforce Lightning and Salesforce Classic components for using ATAN() function to determine the inverse tangent value.
What is ATAN() function in Salesforce
The ATAN() function is one of the many mathematical functions available in Salesforce that may be used to carry out trigonometry mathematical calculations. The ATAN() function is short for “arc tangent” in Salesforce.
In addition, we use the ATAN() function to find out the inverse tangent of an angle or value. It is mostly used in Salesforce when we need to find the radian value range between -PI/2 to PI/2.
Furthermore, the ATAN() function only supports numeric data types like Decimals and Integers. And if we try to use text, dates, or other non-numeric data types, it will produce an error.
Syntax and Usage of Salesforce ATAN() function
Below is the syntax for the ATAN() function in Salesforce:
The value of the number/field/formula parameter is the value for which we are trying to determine the inverse tangent. The value of the parameter can be a field, a constant number, or a complex formula.
Let’s look at an example to better understand the ATAN() function concept and syntax.
As I have discussed above that I got a task to find the “Productivity of the Employee” and for this, I will use the ATAN() function of Salesforce. Let’s see its formula:
Employee Productivity = ATAN((Actual - Target)/Target)
Here, we first subtract the Target Value from the Actual Value and divide the result obtained by the Target Value. Then to find out the productivity, I used the ATAN() function with the resultant value.
With this, we have learned ATAN() function syntax, logic, and demonstration. Now, let’s move ahead and learn to determine the inverse of tangent value using the Salesforce Lightning Component.
Calculate the inverse tangent value in Salesforce Lightning
The steps to determine the inverse tangent value in Salesforce Lightning are as follows:
Step 1: Log in to Salesforce Lightning mode, then click on the “Gear Icon” located in the top right corner of the page. To proceed, select “Setup” from the dropdown menu.
Step 2: From the menu’s left side, click on “Object Manager”.
Step 3: Now, search for the object for which you want to use the ATAN() function in the search bar. As I want to track the customer satisfaction of the leads, in this example, I look up the “Lead” object.
Step 4: Click on the “Lead” object, and it will redirect to the lead page.
Step 5: From the menu on the left-hand side of the page, click on “Field and Relationship”.
Step 6: To create a formula field where we will use the ATAN() function, click on the “New” button.
Step 7: Now, it redirects to the “Choose the field type” page. Here, select the “Formula” as the data type by checking the radio button next to it.
Step 8: To proceed, click on the “Next” button.
Step 9: After entering the “Field Label” for the formula, the “Field Name” will be filled in automatically. In this instance, I entered “Customer Satisfaction” as the field label.
Step 10: Select the “Data Type” for the field on which we want to apply the ATAN() function. As we know ATAN() function only accepts the numeric data type select any one of them “Number” or “Currency” as per requirement.
In this case, I choose the “Number” as the formula return type and also set its “Decimal Value” to 2 as I only want it to return the result with 2 decimal positions.
Step 11: Click on the “Next” button to proceed to the next step.
Step 12: To compute Customer Satisfaction by using the ATAN() formula, enter the formula in the advanced formula editor. The formula is as follows:
- Here, “Customer Satisfaction” is determined by the formula using the “Positive Reviews” and “Negative Reviews”.
- Firstly, we divide the “Positive_Reviews__c” field value with the Negative_Reviews__c field value.
- Then, we use the ATAN() function with the above-calculated result.
Step 13: To make sure that there is no mistake in the formula, click on the “Check Syntax” button.
Step 14: Optionally, we may define the “Description”, “Help Yext”, and as well as “Handle the empty field” if you like.
Step 15: To continue, click on the “Next” button.
Step 16: Select the appropriate “Level Security” option. In this case, I have selected the “Visible” checkbox as I want it to be visible to everyone. Then, click on the “Next” button from the menu.
Step 17: Now, choose the “Page Layout” that will display your content.
Step 18: To save the advanced formula field, click on the “Save” button.
Once we have set up the formula field, we may use it. Let’s examine an illustration.
- Create a new lead with the “Positive Review” and “Negative Review” by opening the “Leads” Tab.
- After that, click on the “Details” section, and here we will see the “Customer Satisfaction” field the resultant output obtained by using the ATAN() function.
As a result, we now know how to calculate the inverse of tangent value in Salesforce Lightning. Now, we will look at how to calculate the inverse tangent value in Salesforce Classic.
Check out, CEILING() Function in Salesforce
Calculate the inverse tangent value in Salesforce Classic
The steps to determine the inverse tangent value in Salesforce Classic are as follows:
Step 1: Open your Salesforce Classic edition from the Salesforce Lightning. Click on “Avtar” and then click on “Switch to Salesforce Classic”.
Step 2: Next, select “Setup” from the menu.
Step 3: Scroll down and move to the “Build” section and select “Customize” and search for the object on which field you want to use the ATAN() function.
Here, I choose the “Orders” object as I want to find out the delivery estimation accuracy.
Step 4: To get the option for creating a new formula field, click on the dropdown adjacent to the “Orders” and choose the “Fields” option.
Step 5: Now scroll down and move to the “Order Custom Fields & Relationship” section and click on the “New” button to create a formula field.
Step 6: It moves to the “Choose the field type” page, select the “Formula” as the data type by checking up the radio button adjacent to it.
Step 7: Click on the “Next” button to move to the next proceeding step.
Step 8: Enter the “Field Label” for the formula and the unique “Field Name” will be filled out automatically. In this example, I specify the “Delivery Accuracy” as the field label.
Step 9: Next, choose the “Data Type” for the field where we are going to calculate the delivery estimation using the inverse tangent function. Make sure that you only choose the numeric data types such as “Number” and “Currency” otherwise it will give an error.
In this case, I select the “Number” as the formula return data type by clicking on the radio button in front of it. Moreover, I adjusted the “Decimal Place” to 1.
Step 10: Now, click on the “Next” button to proceed to the step enter formula.
Step 11: Go to the advanced formula editor and type the formula to compute the inverse tangent value using the ATAN() function.
In this instance, I want to use the ATAN() function to determine the inverse tangent value of the delivery day’s accuracy estimation based on customer input. The formula is as follows:
ATAN((Actual_Delivery_Days__c - Predicted_Delivery_Days__c) / Predicted_Delivery_Days__c)
- The Delivery Accuracy is determined by a formula based on Actual Delivery Days and Predicted Delivery Days.
- Next, we subtract the Predicted Delivery Days from the Actual Delivery Days field.
- After that, we divide the resultant value by the Predicted Delivery Days.
- Finally, we put the resultant value to the ATAN function of Salesforce.
Step 12: Select “Check Syntax” to review the formula and ensure there are no errors.
Step 13: If we’d like, we may specify the “Description” and “Help text” as well as “Handle the empty field”.
Step 14: To proceed, use the “Next” button.
Step 15: Choose the appropriate “Level Security” field. Because I want it to be visible to everyone, I have chosen “Visible” in this instance. Select “Next” to continue after that.
Step 16: Next, choose the suitable “Page Layout” for the area where we wish to display this field.
Step 17: In order to save the formula field, click the “Save” button.
Once we’ve established the formula field, we may use it. Let’s examine an illustration:
- Create a new order with the fields Actual Delivery Days and Predicted Delivery Days by opening the Order tab.
- When we click Save, we are taken to the Detail page, where the Delivery Accuracy field displays the ATAN() function output.
As a result, we now know how to calculate the inverse tangent value in Salesforce Classic.
With this, we have concluded that the Salesforce function ATAN is a great tool for working with numerical data. In addition, we have learned practical examples such as calculating Customer Satisfaction, Productivity of Employees, Delivery Accuracy, etc.
Moreover, we have also understood the concept of the ATAN() function with its syntax and procedure of calculating the inverse tangent value in Salesforce Lightning and Salesforce Classic.
You may also like to read:
- ASIN() Function in Salesforce | Calculate inverse sine value in Salesforce
- ACOS() Function in Salesforce | Calculate inverse cosine value in Salesforce
- ABS() Function in Salesforce | Calculate absolute value in Salesforce
- ATAN2() Function in Salesforce
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.