Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
Vishal Gupta 111

How to format number in Indian Number System?

I'm trying show currency in indian format. In Apex controller I'm using

new String[]{'0','number','##,##,##0.00'}

But it always shows numbers as :
Example - Unformatted Amount 1124389.56
Formatted Amount 1,124,389.56

What I need is the number in this format 11,24,389.56

Is there any way to format the number as per this requirement?

Vishal Gupta 111
I wasn't able to find the solution using the String Format {'0','number','##,##,##0.00'}, which, I thought could've helped in converting currency dynamically.

But with some trial and hit methods, I got result using formula to convert number into INR format. I hope it'll help someone.

IF( Amount__c  < 0, "(", "") & "INR " &
IF(ABS(Amount__c) >= 1000000000, RIGHT(TEXT(FLOOR(ABS(Amount__c) / 1000000000)),2) & ",", "") &
IF(ABS(Amount__c) >= 10000000, RIGHT(TEXT(FLOOR(ABS(Amount__c) / 10000000)),2) & ",", "") &
IF(ABS(Amount__c) >= 100000, RIGHT(TEXT(FLOOR(ABS(Amount__c) / 100000)),2) & ",", "") &
IF(ABS(Amount__c) >= 1000, RIGHT(TEXT(FLOOR(ABS(Amount__c) / 1000)), 2) & ",", "") &
RIGHT(TEXT(FLOOR(ABS(Amount__c))), 3) & "." &
IF(MOD(ABS(Amount__c) , 1) * 100 < 10, "0" & TEXT(ROUND(MOD(ABS(Amount__c) , 1), 3) * 100), TEXT(MIN(ROUND(MOD(ABS(Amount__c) , 1), 3) * 100, 99))) &
IF(Amount__c < 0, ")", "")

*Note - Amount__c is my custom field of type number.  And the result will be a String.
Example : 235646
Result : INR 2,35,646.00