0

how to separate currency values through commas in salesforce formula field. My code :

TEXT(ttt__c) & " to " & TEXT(sss__c) & " xxx in "& city__c & if(State__c="",""," "& State__c )& 
if(Zip__c="",""," "& Zip__c )& "  with amount $"& TEXT(amount_Min__c)& " to $"& TEXT(amount_Max__c)& 
" created on "& Text(DATEVALUE(CreatedDate))

my out put is :

2 to 3 jjjs in london with amount $1000 to $2000 created on 2016-10-21

but my requirement is : 2 to 3 jjjs in london with amount $1,000 to $2,000 created on 2016-10-21

1 Answer 1

3

You need to format this to get expected value. And its not easy to maintain.

IF( 
  someCurrencyField__c >= 1000000, 
  TEXT(FLOOR(someCurrencyField__c / 1000000)) & ",", 
  "") & 
IF( 
  someCurrencyField__c >= 1000, 
  RIGHT(TEXT(FLOOR(someCurrencyField__c / 1000)), 3) & ",", 
  "") & 
RIGHT(TEXT(FLOOR(someCurrencyField__c)), 3) & "." & 
IF( 
  MOD(someCurrencyField__c , 1) * 100 < 10, 
  "0" & TEXT(ROUND(MOD(someCurrencyField__c , 1), 2) * 100), 
  TEXT(MIN(ROUND(MOD(someCurrencyField__c , 1), 2) * 100, 99)) 
)

//here someCurrencyField__c  is the currency field which you want to display in the format.
0

You must log in to answer this question.

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