?
Solved

Access Rounding Up to Nearest $5

Posted on 2013-06-11
4
Medium Priority
?
880 Views
Last Modified: 2013-06-11
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
Comment
Question by:rfmassa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 18

Expert Comment

by:Jerry Miller
ID: 39239426
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
 

Author Comment

by:rfmassa
ID: 39239488
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
 
LVL 29

Accepted Solution

by:
IrogSinta earned 2000 total points
ID: 39239820
Try this:
Round(([Amount]+2.5)/5)*5
round up
0
 

Author Closing Comment

by:rfmassa
ID: 39240028
Genius. Perfect Solution. Thank you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question