Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rounding Error


Excel has a rounding error. When rounding 2.5 it returns 3. However, the basic rules of rounding states that when the digit following the number to be rounded is 5 you always round to an even number. In other Microsoft Tools this does not occur. For example, if you perform the following two computations in excel and Visual Basic, Visual Basic will give you the correct answer. Is there another function that can be used to resolve this problem

The correct answer
4=Round(2+.5, 0) * 2

The incorrect answer
6=Round(2+.5, 0) * 2
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Rounding Error

PRB: Round Function different in VBA 6 and Excel Spreadsheet
http://support.microsoft.com/default...83&Product=xlw


Sub Demo()
Debug.Print Round(2.5, 0)
Debug.Print WorksheetFunction.Round(2.5, 0)

'Banker Rounding Also
Debug.Print CLng(2.5)
Debug.Print CLng(3.5)
End Sub


--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Matthew W" wrote in message
...

Excel has a rounding error. When rounding 2.5 it returns 3. However, the

basic rules of rounding states that when the digit following the number to
be rounded is 5 you always round to an even number. In other Microsoft Tools
this does not occur. For example, if you perform the following two
computations in excel and Visual Basic, Visual Basic will give you the
correct answer. Is there another function that can be used to resolve this
problem?

The correct answer:
4=Round(2+.5, 0) * 2

The incorrect answer:
6=Round(2+.5, 0) * 2



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rounding Error

Thank you very much, I will use vba for rounding.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Rounding Error

A google search:

Your search - "basic rules of rounding" - did not match any documents.

--
Regards,
Tom Ogilvy

"Matthew W" wrote in message
...
Thank you very much, I will use vba for rounding.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default Rounding Error

As noted under your re-post to
microsoft.public.excel.worksheet.functions, you can write a UDF to
access the VBA round from the worksheet

http://groups.google.com/groups?selm...0no_e-mail.com

has relevant suggestions.

It is generally sufficient to post a question in only one excel group,
since most of us frequent all of the groups. If a post is really
relevant for multiple groups, please address only one query to all the
relevant groups, to avoid our duplicating each others efforts.

Jerry

Matthew W wrote:

Thank you very much, I will use vba for rounding.




  #6   Report Post  
Posted to microsoft.public.excel.programming
y y is offline
external usenet poster
 
Posts: 60
Default Rounding Error

Jerry W. Lewis wrote:
It is generally sufficient to post a question in only one excel group,
since most of us frequent all of the groups. If a post is really
relevant for multiple groups, please address only one query to all the
relevant groups, to avoid our duplicating each others efforts.


Or putting an [X-post] or [Cross-post] in the subject.
Not all the people follow all the groups.
Alex.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
rounding error pkeegs Excel Discussion (Misc queries) 2 January 13th 10 07:53 AM
My rounding error in a simple IF garron Excel Worksheet Functions 2 August 6th 08 04:11 AM
rounding error? Steve Excel Discussion (Misc queries) 5 June 1st 08 02:58 PM
Rounding error is conditional on brackets JasonG Excel Discussion (Misc queries) 2 February 4th 08 05:31 PM
Percentage rounding error in charts Tracey Excel Discussion (Misc queries) 4 May 14th 05 04:01 AM


All times are GMT +1. The time now is 03:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"