I am trying to round a number for example 21.4 to the nearest multiple of 5 - i.e. 20 or 25 and can not seem to get any of the roundup or rounddown or ceiling functions to work - always error with function not availble?? Help.
Just browsing forums and wanted to give quick feedback. Dunno for sure if this'll work in access, but vbs does.
This'll round up only for now. Can work in more math to get it to go up or down. -Andrew
VBS
dim x
dim answer
x = 20
if (x mod 5) > 0 then
answer = ((x \ 5) * 5) +5
Else
answer = (x \ 5) * 5
End If
Try this for Access
IIF((x mod 5) > 0,((x \ 5) * 5) +5,(x \ 5) * 5)
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.