Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a variable X which is set as 'Money' in number tab and format is set as $#,##0.0# ;($#,##0.0#)
But,
for X=61.825, it shows as $61.82 instead of $61.83
here, it doesn't round up 2->3 where it should be.
for X=61.855, it shows as correct value i.e. $61.86
here, it rounds up correctly i.e. 5->6
Rounding has the problem for 0.825, 0.835, 0.845
works fine for .855
Is there any way to get the proper expected result?
a small correction, X is not a variable but it is an expression.
from reference manual here some rounding functions:
ceil(x [ , base [ , offset ]])
Rounding of x upwards to the nearest multiple of base with an offset of offset. The result is a number.
Examples:
ceil( 2.4 ) returns 3
ceil( 2.6 ) returns 3
ceil( 3.88 , 0.1 ) returns 3.9
ceil( 3.88 , 5 ) returns 5
ceil( 1.1 , 1 , 0.5 ) returns 1.5
floor(x [ , base [ , offset ]])
Rounding of x downwards to the nearest multiple of base with an offset of offset. The result is a number.
Examples:
floor( 2.4 ) returns 2
floor( 2.6 ) returns 2
floor( 3.88 , 0.1 ) returns 3.8
floor( 3.88 , 5 ) returns 0
round(x [ , step [ , offset ]])
Rounding of x upwards or downwards n number of steps with an offset of offset. The result is a number. If x
is exactly in the middle of an interval, it is rounded upwards. The function complies with the IEEE standard
64-bit floating point numbers.
Examples:
round( 2.4 ) returns 2
round( 2.6 ) returns 3
round( 2.5 ) returns 3
round( 3.88 , 0.1 ) returns 3.9
round( 3.88 , 5 ) returns 5
round( 1.1 , 1 , 0.5 ) returns 1.5
should solve your problem
I had tried all possible functions, but had no luck .
Focussing more,
if number in the second decimal digit is less than 5 and third decimal number is 5
i.e. 0.115 OR 0.125 OR 0.135 OR 0.145, round funct always remain as it is i.e. 0.11,0.12,0.13 OR 0.14.
but, for 0.155 it comes expected as 0.16
Round(10.235, 0.01) = 10.23
But my expectaion is 10.24
Hi,
Try this
$#,##0.00 ;($#,##0.00)
Regards,
Kaushik Solanki