Wrox Programmer Forums round function help
 Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
 Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersâ€™ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
October 19th, 2004, 06:32 AM
 Authorized User Join Date: Dec 2003 Location: Vashi, Navi Mumbai, Maharashtra, India. Posts: 63 Thanks: 0 Thanked 0 Times in 0 Posts
round function help

How to round a number which has no decimal.I want to round the number to the nearest zero.
That is,if the last digit of the number is 0,then it should be as it is.If the last digit
is 1,2,3 or 4,then the number should be rounded of to the previous zero.(Eg. 704 to 700)
If the number ends in 5,6,7,8, or 9 then it should be rounded of to the next zero (Eg. 706 to 710)
In Excel, it is working like this.ROUND(Number,-1).In Access Help Function says the same logic.
But,when executing the same formula,it displays Error message.

Mohamed Mohiddin
Officer
__________________
Mohamed Mohiddin
Officer
October 19th, 2004, 06:47 AM
 Authorized User Join Date: Jul 2003 Location: Stockton on Tees, , United Kingdom. Posts: 73 Thanks: 0 Thanked 0 Times in 0 Posts

Divide by 10
Remove decimal part (use INT() )
Multiply by 10 again

Cheers Ray
October 21st, 2004, 07:14 AM
 Authorized User Join Date: Dec 2003 Location: Vashi, Navi Mumbai, Maharashtra, India. Posts: 63 Thanks: 0 Thanked 0 Times in 0 Posts

Dear Ray,
Thanks for the help with which we were able to sort out the problem.
But there was a small problem in your reply.Integer function removes the
decimals alltogether.In the process,it removes the digits after the
decimal point which are 5 or above (ie, 5to 9).Then,we cannot get the
higher zero (ie, 709 also becomes 700 and not 710). So we have used
the Round function to solve the problem after dividing the number by 10
(ie,round(number,0).Then we have multiplied by 10 to get our result
correctly.We are still searching for the answer to solve the problem
by applting the Round(number,-1) function since it solves the problem straightaway
and since it works without any problem in Excel.Thanks once again for your
help.It has helped us to think in another way which we have nit thought
so far.

Mohamed Mohiddin
Officer

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Round() kingroon Classic ASP Basics 1 September 15th, 2008 01:17 PM Round Function in Derived column transformation loveyaseen BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 0 October 31st, 2007 08:19 AM Problem with Round Function darrenb Access 3 May 22nd, 2007 05:45 PM Decimal place problem...ROUND function! kuku SQL Server 2000 9 July 9th, 2005 05:50 PM Is there a round vbscript function that works? lcsgeek ASP.NET 1.0 and 1.1 Basics 8 August 20th, 2003 11:23 AM

All times are GMT -4. The time now is 10:52 AM.