round values to the next multiple of 5

Sudha

Registered User.
Local time
Today, 17:23
Joined
May 1, 2001
Messages
29
Hi,
How do I round values to the next multiple of 5, but if the value is a multiple of 5 then it should return the same value.
 
Hi,
How do I round values to the next multiple of 5, but if the value is a multiple of 5 then it should return the same value.

Using an IIf Statement can do this. Something like:
Code:
SELECT IIf ([value]/5=int([value]/5), [value], (int([value]/5)+1)*5)
from YourTable;
 
Another way would be a non-conditional expression, like the following:

SELECT Int( MyTable.MyValueField / -5 ) * -5
FROM MyTable;
 

Users who are viewing this thread

Back
Top Bottom