Monday, May 16, 2005

Rounding to nearest 5 cents part two

Well after posting my really complicated solution to the question about rounding to the nearest 5 cents I got given a whole bunch of alternative solutions. (Mark I'm disappointed you didn't have a better one for me!)

Try these:
=ROUND(price*(1+markup)/0.05,0)*0.05
=ROUNDUP(price*20*(1+markup),0)/20

Both of these mathematically do essentially the same thing, though the different functions give different results with ROUNDUP always rounding up where as ROUND is a 2/3 rounder.

=CEILING(price*(1+markup),0.05)
This will always round up to the nearest 5 cents.
=FLOOR(price*(1+markup),0.05)
This will always round down to the nearest 5 cents.