|
-
Nov 23rd, 2008, 08:06 AM
#1
Thread Starter
New Member
Grouping digits of a number in Indian currency format
In visual basic (not in .Net) how can I represent numbers in Indian currency format.
For e.g., 12,34,56,789.00 inspite of 123,456,789.00
-
Nov 23rd, 2008, 02:09 PM
#2
Re: Grouping digits of a number in Indian currency format
Thread moved from the FAQ forum, which is not the place to post your questions.
-
Nov 23rd, 2008, 05:30 PM
#3
Re: Grouping digits of a number in Indian currency format

MyFormattedValue = Format$(MyOldValue, "0.00")
-
Nov 24th, 2008, 02:27 AM
#4
Re: Grouping digits of a number in Indian currency format
-
Nov 24th, 2008, 06:45 PM
#5
Re: Grouping digits of a number in Indian currency format
Below is my single-line function. It works on any number in Currency range with or without fraction, negative or positive.
Code:
Function FormatINR(ByVal Amount As Currency, _
Optional ByVal DigitsAfterDot As Byte = 2) As String
'-- Convert Amount to Indian Currency format: ##,##,##,##,##,##,##0.00
FormatINR = Format(Amount, Replace(Space((Len(Str(Fix(Amount))) - 3) \ 2), " ", "##\,") _
& "##0" & String(-(DigitsAfterDot > 0), ".") & String(DigitsAfterDot, "0"))
End Function
Code:
Sub Test()
Debug.Print FormatINR(123456789012345.67@)
Debug.Print FormatINR(123456.78@, 0)
Debug.Print FormatINR(-123456.78@)
End Sub
12,34,56,78,90,12,345.67
1,23,457
-1,23,456.78
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|