This function returns the sum of two numbers.

Arguments

Add(1,2)

OrdinalTypeRequiredDescription
1NumberTrueFirst value
2NumberTrueSecond value

Example 1

%%[

var @sum, @num1, @num2

set @num1 = 5

set @num2 = 42

set @sum  = Add(@num1, @num2)

]%%

%%=v(@num1)=%% + %%=v(@num2)=%% = %%=v(@sum)=%%

Copy

Output

5 + 42 = 47

The Add function can be used to return the sum of two numbers.

Use case: the Add function can be used for a quick way to get a sum of two numerical values. For example, if you add the sum of the last two purchases of a customer. Note that this function is limited to just two numbers in the equation but more numbers can be nested together by adding another Add function.

Syntax:

Copy Code

Add(1,2)

1 = Number of the first value in addition (number or decimal datatype)

2 = Number of the second value in addition equation (number or decimal datatype)

Example:

Copy Code

%%[

set @numbervar1 = ‘115.23’

set @numbervar2 = ‘305.46’

]%%

%%=Add(@numbervar1,@numbervar2)=%%

Output:

420.69

Explanation:

In the Add example above, the two variables are hardcoded with the numbers ‘115.23’ and ‘305.46.’ Adding both of those numbers together gets you the number of 420.69 (nice!)

The Add function can be used for whole numbers or decimals. The datatype for these values should be a number datatype or decimal or you can hardcode the numbers as it is shown in the example above.

Related functions are the Divide, Multiply, and Subtract functions.

Related Posts
Who is Salesforce?
Salesforce

Who is Salesforce? Here is their story in their own words. From our inception, we've proudly embraced the identity of Read more

Salesforce Unites Einstein Analytics with Financial CRM
Financial Services Sector

Salesforce has unveiled a comprehensive analytics solution tailored for wealth managers, home office professionals, and retail bankers, merging its Financial Read more

AI-Driven Propensity Scores
AI-driven propensity scores

AI plays a crucial role in propensity score estimation as it can discern underlying patterns between treatments and confounding variables Read more

Tectonic’s Successful Salesforce Track Record
Tectonic-Ensuring Salesforce Customer Satisfaction

Salesforce Technology Services Integrator - Tectonic has successfully delivered Salesforce in a variety of industries including Public Sector, Hospitality, Manufacturing, Read more