Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


RoundUp in Access VBA

Posted on 2013-12-19
Medium Priority
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 1000 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.
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

721 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