Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: rounding Post Reply Post New Topic
Author Message
taniarto
Groupie
Groupie
Avatar

Joined: 15 Oct 2010
Online Status: Offline
Posts: 52
Quote taniarto Replybullet Topic: rounding
     Posted: 15 Oct 2010 at 9:53pm
Dear all,
Please tell me how to make a rounding of a number. I have result of a calculationĀ  the result is 4.230 but I want to round it and make it 4.300 I try by the format number properties but doesn't work. Could anyone tell me how?

thanks,



Taniarto
IP IP Logged
rvink
Groupie
Groupie
Avatar

Joined: 04 Feb 2008
Location: New Zealand
Online Status: Offline
Posts: 55
Quote rvink Replybullet Posted: 17 Oct 2010 at 2:57pm
The format number property only affects the display of numbers, not their actual value. In a formula use the Round(number, decimal) function.

eg Round(4.234, 1) = 4.3

If the value to the right of the decimal point is .5 or above, it rounds to the next highest number.

IP IP Logged
taniarto
Groupie
Groupie
Avatar

Joined: 15 Oct 2010
Online Status: Offline
Posts: 52
Quote taniarto Replybullet Posted: 17 Oct 2010 at 6:21pm
It's still doesn't work the result is still the sameĀ  Ouch
IP IP Logged
Senthil Raj
Newbie
Newbie
Avatar

Joined: 02 Aug 2010
Location: India
Online Status: Offline
Posts: 27
Quote Senthil Raj Replybullet Posted: 17 Oct 2010 at 9:43pm
if i understood correct i think
if you got any number in the 2nd decimal place it should be rounded

ie. 4.21 to 4.29 it should be 4.30

if so try this code :(formula field) consider x as the number (4.234)

if Round(X,2)-Round(X, 1)>=0.01 then
truncate(X
,1)+0.1
else
X





Edited by Senthil Raj - 17 Oct 2010 at 11:50pm
Live And Let Live...
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum