Hi All
Have a problem with rounding up to two decimal places
Text23.Text = Str$(Val(Text1.Text)) - (Val(Text1.Text)) / (100 +
Val(Text12.Text)) * 100
Text1 = 100
Text12 = 5
Text23 = 4.76 (should look like this) But...
Curently Text23 shows 4.76190476190476
Please help
Many thanks
PS: Tried Format(Math.Round text23.text),2 - no luck - I know there is a
way involving ####.## but dont know how.
Rogue Rabbit - 27 Oct 2004 21:03 GMT
format(4.76190476190476,"#.00") will give you "4.76"
so
Text23.Text = format((Val(Text1.Text)) - (Val(Text1.Text)) / (100 +
Val(Text12.Text)) * 100, "#.00)
should do it for you
rr
> Hi All
>
[quoted text clipped - 16 lines]
> PS: Tried Format(Math.Round text23.text),2 - no luck - I know there is a
> way involving ####.## but dont know how.
Rogue Rabbit - 27 Oct 2004 21:09 GMT
oops missed a bit
Text23.Text = format((Val(Text1.Text)) - (Val(Text1.Text)) / (100 +
Val(Text12.Text)) * 100, "#.00")
that's better
rr
> format(4.76190476190476,"#.00") will give you "4.76"
>
[quoted text clipped - 26 lines]
>> PS: Tried Format(Math.Round text23.text),2 - no luck - I know there
>> is a way involving ####.## but dont know how.
Randy Birch - 28 Oct 2004 04:44 GMT
http://vbnet.mvps.org/code/helpers/numfuncs.htm

Signature
Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
: Hi All
:
[quoted text clipped - 16 lines]
: PS: Tried Format(Math.Round text23.text),2 - no luck - I know there is a
: way involving ####.## but dont know how.
mickey - 30 Oct 2004 21:01 GMT
>Hi All
>
[quoted text clipped - 16 lines]
>PS: Tried Format(Math.Round text23.text),2 - no luck - I know there is a
>way involving ####.## but dont know how.
Lookup the 'round' function
Groetjenz,
Mickey

Signature
#### gewoan skrieve su ast ut seist ####
Rick Rothstein - 30 Oct 2004 22:25 GMT
> >Have a problem with rounding up to two decimal places
> >
[quoted text clipped - 16 lines]
> >
> Lookup the 'round' function
Providing you want the Banker's Rounding that it uses for its rounding
operation.
Rick - MVP