Rounding up in Access query

Posted on 2011-03-11
Medium Priority
Last Modified: 2012-05-11

I need a query that takes a price and rounds UP to the next 5p, i.e £2.36 should go to £2.40 and £5.12 should go to £5.15 etc.

Question by:Petermcg001
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

Expert Comment

ID: 35109202
Rounding to 5p is done by multiplying the number by 20, rounding it, and dividing by 20 to get to the proper value.
    Round(20 * [Amount], 0) / 20
LVL 30

Expert Comment

by:Randy Downs
ID: 35109211
Try this - http://allenbrowne.com/round.html

Rounding up
To round upwards towards the next highest number, take advantage of the way Int() rounds negative numbers downwards, like this:
    - Int( - [MyField])

As shown above, Int(-2.1) rounds down to -3. Therefore this expression rounds 2.1 up to 3.

To round up to the higher cent, multiply by -100, round, and divide by -100:
    Int(-100 * [MyField]) / -100

Accepted Solution

zane_o earned 2000 total points
ID: 35109286
Missed the always round up part. If you combine the two responses here, you get something like:
 Int(-20 * [Amount]) / -20

Author Comment

ID: 35109524
Thanks for looking at this.  zane o's solution works perfectly.

Featured Post

Independent Software Vendors: 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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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 …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

777 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