Has anyone managed in Crystal to round to significant figures. (Not decimal places)
I've tried replicating the old excel trick, from
which gives
=ROUND(value,2-(1+INT(LOG10(ABS(value)))))
In excel plugging in the value of 1.44 leads to (displays as) 1.4 which seems correct. However multiplying this by 1000, then leads to 1440, which shows that this formula doesn't really work perfectly.
Translating this into Crystal, with additional problems, (I start with a text field, and Crystal doesn't have LOG10)
IF left({@Results-Paper},1) = "<" Then
(
"<" & round(tonumber(mid({@Results-Paper},2)),2-(1+INT(LOG(ABS(tonumber(mid({@Results-Paper},2)))/LOG(10)))))
)
ELSE totext(round(tonumber(mid({@Results-Paper},1)),2-(1+INT(LOG(ABS(tonumber(mid({@Results-Paper},1)))/LOG(10))))))
In Crystal, plugging in the 1.44, results in 1.4400 (1.4000 would be suitable)
In file/options I have set the Numeric field to 4 decimal places, because I have to display other numeric texts to this precision.
Anyone have any ideas to simply, round a number to 2 significant figures?
Cheers, Kai
I've tried replicating the old excel trick, from
which gives
=ROUND(value,2-(1+INT(LOG10(ABS(value)))))
In excel plugging in the value of 1.44 leads to (displays as) 1.4 which seems correct. However multiplying this by 1000, then leads to 1440, which shows that this formula doesn't really work perfectly.
Translating this into Crystal, with additional problems, (I start with a text field, and Crystal doesn't have LOG10)
IF left({@Results-Paper},1) = "<" Then
(
"<" & round(tonumber(mid({@Results-Paper},2)),2-(1+INT(LOG(ABS(tonumber(mid({@Results-Paper},2)))/LOG(10)))))
)
ELSE totext(round(tonumber(mid({@Results-Paper},1)),2-(1+INT(LOG(ABS(tonumber(mid({@Results-Paper},1)))/LOG(10))))))
In Crystal, plugging in the 1.44, results in 1.4400 (1.4000 would be suitable)
In file/options I have set the Numeric field to 4 decimal places, because I have to display other numeric texts to this precision.
Anyone have any ideas to simply, round a number to 2 significant figures?
Cheers, Kai