How do I format numbers in SSRS?
Hi, I would like to format 1234567 as 12,34,567. How do I do? I have given ##,##,### in the format column of the textbox, but I am getting result like 1,234,567. Please let me know how to do this? Thanks & Regards, Naveen J V
June 10th, 2008 9:44am

You need either to change the currency settings of your machine.. OR the best ways is to use this code in the REPORT --> REPORT PROPERTIES --> CODE WINDOW.. ADD THIS CODE THERE =================== Public Function FormatIndian(ByVal Amount As decimal) As String Dim strAmount As StringDim strGrpsArr() As StringDim lngPos As LongDim lngIndex As Long strAmount = Format$(Amount, "#") 'note: rounding occurs If Len(strAmount) < 4 Then FormatIndian = strAmount Else lngIndex = (Len(strAmount) - 2) \ 2 ReDim strGrpsArr(lngIndex) strGrpsArr(lngIndex) = Mid$(strAmount, Len(strAmount) - 2) 'least significant trio lngPos = Len(strAmount) - 4: lngIndex = lngIndex - 1 'init position variables Do strGrpsArr(lngIndex) = Mid$(strAmount, lngPos, 2) lngPos = lngPos - 2: lngIndex = lngIndex - 1 'update variables If lngPos = 0 Then strGrpsArr(0) = Left$(strAmount, 1) 'leading non-pair group Loop Until lngPos <= 0 FormatIndian = Join(strGrpsArr, ",") Erase strGrpsArr End IfEnd Function =================== AND USE THIS IN THE EXPRESSION OF THE TEXT BOX =code.FormatIndian(Fields!AMOUNT.Value) === HOPE THIS HELPED//
Free Windows Admin Tool Kit Click here and download it now
June 10th, 2008 12:23pm

Thanks allan. It is working.
June 10th, 2008 12:54pm

hi..... allan... very late reply... the code which u've forwarded helped me a lot... but there's one problem in ur code... i'm not getting that.. when i enter the value 12345.56 it is displaying correct value by rounding up.. i.e 12346.. but when i enter the value 1234.56 the it is displaying the error.. (i.e four digit with two decimal value) it works fine for rest all.. but for four digit with two decimal will not work.. it will display "#error" please help me... its very important for me....
Free Windows Admin Tool Kit Click here and download it now
November 9th, 2010 2:57am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics