• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 935
  • Last Modified:

Access Rounding Up to Nearest $5

Hi.

I am trying to find a way to round up any given decimal or integer number to the nearest $5 or $0.
Example:  $178.92 rounds up to $180,   $199.01 rounds up to $200,  $231 rounds up $235.

I am using Access 2000 and am trying to do this within an Access update query if possible. The built in rounding function cannot handle this as it will round down as well as up, I beleive. I have tried using the Int() function and get close, but there is always an exception that seems to fail.

I don't mind if I have to write a function, but it seems it should not be that difficult.

Thanks.
0
rfmassa
Asked:
rfmassa
  • 2
1 Solution
 
Jerry MillerCommented:
Have you seen this StackOverflow article?

http://stackoverflow.com/questions/326476/how-to-round-a-number-in-vba-to-the-nearest-5-or-10-or-x

Seems to suit your needs.
0
 
rfmassaAuthor Commented:
The StackOverflow I had seen before posting this, but it does not seem to work, as it will round down as well which is not acceptable in this situation for me.
Thanks.
0
 
IrogSintaCommented:
Try this:
Round(([Amount]+2.5)/5)*5
round up
0
 
rfmassaAuthor Commented:
Genius. Perfect Solution. Thank you!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now