Formula field to add commas to Numbers #inSalesforce

Formula field to add commas to Numbers #inSalesforce


Create a formula field with return type as text  

IF(theField__c< 1000,TEXT(theField__c),IF(theField__c< 1000000,TEXT(FLOOR(theField__c/1000))  & ','  & RIGHT(TEXT(theField__c), LEN(TEXT(theField__c)) - LEN(TEXT(FLOOR(theField__c/1000)))),IF(theField__c< 1000000000,TEXT(FLOOR(theField__c/1000000))  & ',' & MID(TEXT(theField__c), 1 + LEN(TEXT(1 + FLOOR(theField__c/1000000))),3)  & ','  & RIGHT(TEXT(theField__c), LEN(TEXT(theField__c)) - LEN(TEXT(FLOOR(theField__c/1000)))), IF(theField__c>= 1000000000,"TooHigh!", NULL))))


Comments