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

Round number upwards to nearest 49 / 99. 1

Status
Not open for further replies.

Wullie

Programmer
Mar 17, 2001
3,674
GB
Hi all,

Does anyone know of a quick way to round a price upwards to the nearest 99 or 49?

For example:

12.23 would become 12.49
12.52 would become 12.99

Thanks in advance,

Wullie

Fresh Look - Quality Coldfusion Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Try this out:

0.50 * ceil((num + 0.01) / 0.50) - 0.01
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top