EXP() Function in Salesforce | Syntax, Examples, & Use Cases

While working at a company that uses Salesforce CRM, I got a task from the client to predict viral trends based on user engagement analysis.

As a solution, I discovered that the EXP() function determines viral trends based on user engagement analysis.

In this tutorial, we will learn the EXP() function in Salesforce and how to use it to calculate the exponential value of numerical data. Moreover, we will focus on the syntax of the EXP() function and some practical examples for implementation.

What is the EXP() Function in Salesforce?

Numerous mathematical functions are available in Salesforce for performing mathematical calculations, and the EXP() function is one of them. This EXP() function is used to calculate the exponential value.

In addition, this EXP() function only supports numeric data types, such as Decimals and Integers. And if we try to use text, dates, or other non-numeric data types, it will produce an error.

Moreover, it returns the value e raised to the power of the specified numerical parameter.

Syntax and Usage of the EXP() Function in Salesforce

Below is the syntax of the EXP() function in Salesforce:

EXP(number/field/formula)

The value we are attempting to find the exponential for is the value of the number, field, or formula parameter. The parameter’s value may be a field, a fixed numeric value, or an advanced formula.

Let’s look at an example to better understand the EXP() function’s concept and syntax.

As I mentioned above, I was given the assignment to determine the “Predicted Viral Trend” and I will do this by using the Salesforce EXP() function. For this, here is the complete formula we use in Salesforce.

Expected Viral Trend = Start_Trend__c * EXP(Growth_Rate__c * Time__c)

With this, we have learned the EXP() function syntax, logic, and demonstration. Now, let’s move ahead and learn to determine the exponential value using the Salesforce Lightning Component.

How to calculate the exponential value in Salesforce

Here are the steps to calculate the exponential value in Salesforce Lightning:

  1. First, log in to Salesforce mode and navigate to the right corner of the page, then click on the “Gear Icon”. Now, from the dropdown menu, click on Setup.
EXP Function in Salesforce
  1. From the left side of the menu, click on “Object Manager”.
EXP Function in Salesforce Example
  1. Search for the object in the search bar where we wish to utilise the EXP() function. In this case, I search for the “Campaign” object to track the reach of advertising campaigns.
    • Now, click the “Campaign” object; it will redirect us to the campaign page.
EXP Function in Salesforce Lightning
  1. From the left side of the page, click on the Field & Relationship option.
    • Click on the “New” button to create a new field where we can use the EXP() function.
EXP Function in Salesforce Lightning Example
  1. It will redirect to the “Choose the field type” page. Now, check the radio button in front of the “Formula” data type.
    • To proceed to the next step, click on the “Next” button.
Calculate exponential value in Salesforce
  1. Enter the “Field Label” for the formula, and the unique “Field Name” will be automatically populated. In this case, I entered the field label named “Advertisement Reach”.
    • Choose the “Data Type” for the field for which we want to calculate the exponential value.
    • Make sure the data type is numeric, such as Number. So, I check the “Number” radio button to set it as the formula’s return type, and I set the decimal places to 2.
    • Move to the next step by clicking on the “Next” button.
Calculate exponential value in Salesforce Lightning
  1. Move to the advanced formula editor, and enter the formula that uses the EXP() function.
    • In this case, I want to calculate the reach of advertising campaigns using the EXP() function. Here is the formula:
Audience__c * (1-EXP(Views__c))
  • Here, we use the “Audience__c” field, which specifies the audience size, and the “Views__c” field, which specifies the number of already recorded views.
  • First, we subtract the exponential value of the view from 1 using the EXP() function.
  • Next, we multiply the result by the audience size, and the final result shows the campaign advertisement’s reach.
  1. Click on the “Check Syntax” button to validate the formula and ensure that there are no errors.
    • Optionally, we can “Handle the empty field,” and we can also define the “Description” and “Help text” if we want.
    • Click on the “Next” button to move to the next step.
Calculate exponential value in Salesforce Example
  1. Select the relevant Field Level Security field. I have selected “Visible” because I want it to be visible to everyone. Then, click on the “Next” button.
    • Now, select the appropriate Page Layout where we want to be visible.
Calculate exponential value in Salesforce Lightning Example
  1. Click on the “Save” button to save the formula field.
How to Calculate exponential value in Salesforce
  1. We can use the formula field once it’s created. Let’s look at an example:
    • Open the Campaigns Tab and create a new campaign with the fields “Audience” and “Views”.
    • After that, click on the Details section, and here the “Advertisement Reach” field appears, which shows you the result of the EXP() function.
How to Calculate exponential value in Salesforce Lightning

As a result, we now know how to calculate the exponential value in Salesforce.

Conclusion

With this, we have concluded that the Salesforce function EXP() is an excellent tool for handling numerical data. Additionally, we have learned how to calculate “Sales Forecasting”, “Product Growth”, “Social Media Engagement”, etc.

Furthermore, we have also understood the concept of the EXP() function, its syntax, and the procedure for calculating the exponential value in Salesforce.

You may also like to read the following articles:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.