RoundUp in Access VBA

Posted on 2013-12-19
Last Modified: 2013-12-19
I am trying to round a number (double) up to the next integer.  Here is a sample of the results I am looking for:

 1.25 rounds to 2
 .333 rounds to 1
 1.8 rounds to 2
1.111 rounds to 2

and so forth.  Anyone have a function to do this?
Question by:marku24
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
  • 3
  • 3
  • 2
  • +1
LVL 21

Accepted Solution

Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 250 total points
ID: 39730549

Int([Your Number]+0.99999)

Open in new window


Author Closing Comment

ID: 39730567
that is just ridiculously simple, but it does work.

LVL 75
ID: 39730605
Of course, this fails:

int(1.000001 +.999999)
 = 1
as well as other cases.

This never fails:


= 2

Thanks for Gustav (cactus_data) for this trick.
Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part

LVL 21
ID: 39730648
Great trick to round down a negative.

This also works. You must force the data type for teh math.

? int(CDbl(1.000001 +.999999))

Author Comment

ID: 39730661
thank you very much.
LVL 75
ID: 39730702
int(CDbl(1.0000000001 +.999999))

if you want accuracy, use this to Round up:

Round down:


LVL 21
ID: 39730776
I agree that -Int(-[YourNumber]) eliminates the chances for errors in accuracy. It should be the preferred method.

And it works for negative numbers!
? -int(-(-1.1))

Open in new window


Author Comment

ID: 39730782
will do.  I am looking for rounding up only and will adjust accordingly.
LVL 51

Expert Comment

by:Gustav Brock
ID: 39731160
Thanks Joe!

I should add that I can't take the credit, I'm rather the messenger. The method is as old as BASIC itself.


Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

626 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