1

Am trying to do a simple ampscript sum where I can show a user how far they are from reaching the next level in spending status. Currently I am using this which outputs a successful sum:

%%[VAR @bought
SET @bought = AttributeValue("Total_Value_Bought__c")
VAR @gold
SET @gold = '2000000'
]%%

%%=Subtract(@gold,@bought)=%% from GOLD STATUS

I would like the sum to display as a currency though in the format of $X,000,000. Is this possible?

1 Answer 1

2

Use FormatCurrency()

%%[VAR @bought
SET @bought = AttributeValue("Total_Value_Bought__c")
VAR @gold
SET @gold = '2000000'
SET @result = Subtract(@gold,@bought)
SET @formattedResult = FormatCurrency(@result, "en-US") /* Formats the number to USA's curreny unit - dollar. */
]%%

%%=v(@formattedResult)=%% from GOLD STATUS

Check this out for further information: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/FormatCurrency.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .