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
Salesforce OEM AppExchange
Salesforce OEM AppExchange

Expanding its reach beyond CRM, Salesforce.com has launched a new service called AppExchange OEM Edition, aimed at non-CRM service providers. Read more

Salesforce Jigsaw
Salesforce Jigsaw

Salesforce.com, a prominent figure in cloud computing, has finalized a deal to acquire Jigsaw, a wiki-style business contact database, for Read more

Health Cloud Brings Healthcare Transformation
Health Cloud Brings Healthcare Transformation

Following swiftly after last week's successful launch of Financial Services Cloud, Salesforce has announced the second installment in its series Read more

Alphabet Soup of Cloud Terminology
abc

As with any technology, the cloud brings its own alphabet soup of terms. This insight will hopefully help you navigate Read more

author avatar
get-admin