1

I need help with developing some AMPscript to deliver dynamic math calculations in an automated email. The email will show the saving amount (compared with a bank) on an international money transfer.

The data points I have in my source DE are SellAmount, BuyAmount, BankRate. The calculation to determine saving is [SellAmount - (BuyAmount x BankRate) = Saving.

For example: 3,869 - (5,000 x 0.7435) = $151.50

Can someone help with the AMPscripting? Thanks!

1

There's a whole section in the official AMPScript documentation for Math functions.

For your example, it'd be something like this:

%%[

var @sellAmount, @buyAmount, @bankRate, @saving

set @sellAmount = 3869
set @buyAmount = 5000
set @bankRate = 0.7435

set @saving = subtract(@sellAmount,multiply(@buyAmount,@bankRate))

]%%

Output

sellAmount: 3869 
buyAmount: 5000 
bankRate: 0.7435 
saving: 151.5   
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.