Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding down if last decimal place is 5

Status
Not open for further replies.

helenv

Programmer
Dec 10, 2004
20
GB
I want to round a number field to 2 decimal places, but instead of rounding up if the last digit is a 5 i'd like to round down.

SO, 123.766 would be 123.77
and 12.521 would be 12.52
but 65.325 would be 65.32

any ideas? I was thinking maybe some kind of formula that looks at the last digit? The number is a database field which always has 3 decimal places (I think)...

Thanks
 
Ah, I have tried:

if remainder({report.basic_item_price},0.005) = 0 then Truncate ({report.basic_item_price},2)
else ({report.basic_item_price})

and this seems to work. Does that look right?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top