Solved

Rounding up in Access query

Posted on 2011-03-11
278 Views
Hello,

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.

Thanks
0
Question by:Petermcg001
[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
• 2

LVL 6

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
0

LVL 30

Expert Comment

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
0

LVL 6

Accepted Solution

zane_o earned 500 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
0

LVL 1

Author Comment

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

Featured Post

Question has a verified solution.

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

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses
Course of the Month7 days, 3 hours left to enroll