If I had to do such a thing, I would divide by five, then round to the nearest whole number, and finally multiply by five again.
To do this in Crystal is trickier than in a language that lets you define your own data fields. I'd suppose that you'd need a chain of formula fields to manage it. But with a bit of trial and error it should be possible.
As to whether the other methods would work, I can't comment. Madawc Williams
East Anglia
Great Britain
In the example that Palmbak gave, he illustrated scenarios whereby the nearest five always resulted in rounding the original number UP.
If you understand "round a number to the nearest 5.00" (combined with him examples) to mean rounding UP, then use Ngolem's example.
Otherwise, if rounding to the nearest 5 means (as I suspect it might) rounding to the nearest number divisible by 5, regardless if the number may end up being rounded DOWN, then JoeCrystal's formula is sound.
In the example given...there was no discussion about rounding to the nearest "5" it was either to 120 or 130....not to 120 ,125 or 130 so JC's formula would not work.
I should have perhaps explained my reason better.
I think both of our methods fail with negative numbers though on a quick glance. Jim Broadbent
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.