I created input text field (money__c)value is 55995999. Where in this value, how to add commas using text formula field value like 5,59,95,999
Can anyone please guide?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityUse the following formula. It handles numbers up to 999,999,999.99 and rounding to 2 decimals, adjustable.
/* uncomment and adjust currency sign */
/* "$ " & */
/* uncomment next and last lines to denote negatives using the American
accounting style -1234 == (1,234.00),otherwise it's shown as -1,234.00 */
/* ! IF(Cash_L__c < 0, "(", "") & */
/* comment next line if uncommented line above */
IF(Cash_L__c < 0, "-", "") &
SUBSTITUTE(
/* multiplier and divider of 100 ('* 100' and '/ 100') indicate number of decimal
places (2), adjust all if you are going to round to a different decimals */
/* millions */
IF(ABS(ROUND(Cash_L__c,2)) >= 1000000,
TEXT(FLOOR(ROUND(Cash_L__c * 100, 0) / 1000000 / 100)) & ",", "") &
/* thousands */
IF(ABS(ROUND(Cash_L__c,2)) >= 1000,
RIGHT(TEXT(FLOOR(ROUND(Cash_L__c * 100, 0) / 1000 / 100)), 3) & ",", "") &
/* hundreds */
RIGHT(TEXT(FLOOR(ROUND(Cash_L__c * 100, 0) / 100)), 3) &
/* '*100' and ROUND parameter of 2 indicate number of decimal places (2)*/
"." & RIGHT(TEXT(ROUND(Cash_L__c * 100, 0)), 2)
,"-","")
/* ! & IF(Cash_L__c < 0, ")", "") */
Currency
data type provided by Salesforce. This will make your job easier. Otherwise you need to parse that text which is a tedious jobVALUE(money__c )
. This will convert text into number but make sure formula field is ofNumber
type