Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  

News      User Comments     History     Notify Me

2/12/2009 6:32:06 PM
Access Tip: Rounding Numbers
By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on Google Plus Richard Rost on LinkedIn Email Richard Rost

Sorry for the lack of new material or even blog posts. I've been so busy recording new material.

I did have time today, however, to add a new Access Tip. I get asked ALL the time how to round numbers in different ways in Access. There are THREE functions you should be familiar with:

Round, Fix, and Int

Knowing how to use these three functions will give you all the tools you need to round off numbers ANY way you need to.

Here's the new tip: Rounding Numbers in Access


P.S. Stay tuned for more videos coming VERY soon.

Permanent Link
Course Link: Access Tip: Rounding Numbers
Keywords: access tips round int fix
Post Reply

Access Tip Rounding Numbers Comment from harvey Jones @ 7/17/2013
I have a simple query using a field that divides 21,886.66 by 12 the answer received is 1823.00 instead of 1823.88. The field is set to standard in the query.

Reply from Richard Rost:

What is your data type? If you're using INTEGER or LONG INT, that would explain it.
Show Just This Thread        Post Reply
Access Tip Rounding Numbers Comment from Satyaban Ukil @ 6/29/2013
I want to make a calculation which is field name = round([fieldname]* 50/100,0) but this results in fractions between 1 to 49 rounds down to the previous integer whereas decimals from 50 onwards to the next integer. So please tell me whether there is any simple in built function which can roundup at every stage ie. 10.01 to 11 or 10.50 to 11 but if the resultant figure is 10 then it should be 10. Thanks and regards

Reply from Richard Rost:

It's funny you mention this now because in the class I'm currently recording (Access Expert 8) I cover rounding in detail. If you want to round numbers DOWN to the next lowest integer just use the INT function instead of ROUND.


Show Just This Thread        Post Reply
New Access Tip Rounding Numbers Comment from Alex Hedley @ 7/23/2011
Hi Aaitaman,

Click on the textbox then open the Property Sheet.
Now on the Format tab make sure the Format is Percent and the Decimal Places is 0

Show Just This Thread        Post Reply
New Access Tip Rounding Numbers Comment from Aaitaman @ 7/23/2011
I have unbound textbox where i used =[Safe]/[Obser]to get total percent and i got the total percent but have two extra digits. i used this =Round ([Safe]/[Obser],0) as well to rid of those two extra digit but did not fix my problems
Example i am having this now 100.00%, i wan this way 100%
Any help?
Show Just This Thread        Post Reply
Rounding Allocation Percentages Comment from J @ 7/28/2010
I'm working on a building a export file of Portfolio Holdings that will be imported into a system that can only take whole integers.  

The access database I’m pulling from stores and calculated the individual holdings weighting based on home many securities are selected to be held.  

ex. 25% of the portfolio is allocated among 4 securities.  25/4 = 6.25 per security.  Or this could change to 25% allocated among 3 securities…25/3=8.33 (realistically N securities)
Problem arises when I round.  If all are rounded down,  8+8+8=24 not 25.  At the end of the day I need various groups of 25%(any size group, with any # of holdings within the group) to add up to 100%.

Any Ideas?

Reply from Richard Rost:

You would have to perform the math, rounding down. Then, when you're done, check the sum of the parts, and if they don't add up, add 1 to the first (or last) item in the group.
Show Just This Thread        Post Reply
Rounding up to the next integer. Comment from Richard Rost @ 3/23/2009
Greg, GOOD CATCH. I didn't think of that. You're right. INT(4)+1 will result in a 4 if the number is 4.0. So we're going to have to check and see if the number has any kind of a fractional component first. I'll add another field:

X: IIf(N<>I,I+1,N)

N is the original number
I is the INT(N)

Now, IF N is not I (in other words, N has a fractional component so it's different from I) then set X equal to I+1 (round it up) otherwise, it's just N (the original number).

Again, real good catch. I only tested my results with fractional numbers, not whole numbers.

Now about the problem you're having, you could just say:

B: N/50

This will yield 4.02 if N is 201, or 3.98 if N is 199. Now say:

Boxes: IIf(Int(B)=B,B,Int(B)+1)

Basically if the INT(B) is the same as N/50, then there is no fractional component (200, 150, etc.) so just use B. If there is a fraction, add 1 for one more box.

Same concept... and again, GREAT catch.
Show Just This Thread        Post Reply
Rounding up to the next integer. Comment from Greg Beben @ 3/23/2009
You say that, to round up to the next integer:  "I would use INT(x)+1. This will use the INT function to bring your value DOWN to the nearest integer. Then just add 1 to it."  The problem with this solution is that it rounds an integer up to the next integer also.  E.g. 4 becomes 5.  Not sure if the person meant this, but suppose you want to round anything up if it's MORE THAN the plain integer?  E.g. 4 stays 4, but 4.1 becomes 5.  For example, if there are 50 envelopes in a box and I need 200, then 4 boxes is right.  But if I need 210, then when I divide and get 4.2 boxes, I need to order 5.  Can we do this?
Show Just This Thread        Post Reply
Comment from sheraz @ 2/15/2009
Best site for new and Advance users
Show Just This Thread        Post Reply

Add Your Comments or Subscribe
If you just want to subscribe to get email updates when the News is updated, then enter your name and email address and check the Notify Me box below. If you would optionally like to add your comments below to be posted, they are welcome.
  Your Name:  Required
  Your Email:  NOT Public


Sorry about this step. It's just to keep the spam bots away:
  Verify: What is 8+4:
  Notify me when the News is updated.
  Remember Me for my next comments
Please do not use this form for Customer Service inquiries! If you have questions about your account, shipping info, courses you've ordered, need passwords, etc. please use the Customer Service Center instead.

I value your comments. They will be displayed on this page (above). Your name will be displayed, but your email address will not be.
As always, I promise to never give away your personal information to anyone else, ever.

NOTE: If you don't leave your name and email address, DON'T expect a reply. I can't promise a personal reply to everyone who posts here. I TRY my best, but I cannot guarantee it. If you don't leave your real name and email address, I won't even bother. I usually just hit DELETE. -Richard



You may want to read these articles from the 599CD News:

3/26/2020Sorted Combo Box Values
3/23/2020Browsing and Selecting Files
3/14/2020New Access Group
3/6/2020NEW Access 2019 for Beginners
8/15/2019Last Chance for Access CDs
8/1/2019Customer List Form Template
8/1/2019New Template Access Customer Database
7/30/2019Microsoft Access Developer 13
6/20/2019TIP: Validation Rules in Access
11/20/2018Microsoft Access Developer 12

Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP