Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding whole numbers to multiples of 5

Status
Not open for further replies.

clackl

Technical User
Joined
Nov 6, 2002
Messages
14
Location
GB
I have created a query with calculated fields that I have set to only display whole numbers. Is there a way of also asking the calculation to round the result to multiples of 5?

 
This should do it:

IIf(([num] Mod 5)>=3,[num]+(5-([num] Mod 5)),[num]-([num] Mod 5))

Where [num] is the field with the whole numbers. Hope that helps.

Kevin
 
Thanks for this. I will be working on the project again tomorrow and I'll try this out.
 
I am sorry I forgot to check with you GoDawgs where you would enter this piece of code? I am afraid I am still finding my way around Access and realise this may be a stupid question, but I appreciate your help with this.
 
You can make it another field in your query. Just paste that directly in to a blank column in the query and then run the query and that column should have everything rounded to the nearest 5.
 
It works perfectly. Thank you so much for your help with this.

Lynn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top