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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding values to nearest 5 or 9 1

Status
Not open for further replies.

srf1975

MIS
Oct 17, 2002
1
GB
I have formula which calculates a price e.g. 14.97

How do I round up this price to 14.99 ??

If the decimal is 0, 5 or 9 I want it to remain so.

Therefore, decimal 1 - 4 will round up to 5.

Decimals, 6 - 8 will round up to 9.

I hope this makes sense.

Cheers

SrF
 
Try this:

Truncate({Field}*10)/10 +
If {field} - Truncate({field}*10)/10 = .01 then .04 else
If {field} - Truncate({field}*10)/10 in [.02,.06] then .03 else
If {field} - Truncate({field}*10)/10 in [.03,.07] then .02 else
If {field} - Truncate({field}*10)/10 in [.04,.08] then .01 else 0

Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top