#1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Rounding Question

Does anyone know if the format function ("Format/Number with x number of
decimal places) happens to conform with ASTM E29 for the last right-hand
digit...???


Thanks

Paul


  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld
 
Posts: n/a
Default Rounding Question

On Thu, 2 Feb 2006 06:56:55 -0800, wrote:

Does anyone know if the format function ("Format/Number with x number of
decimal places) happens to conform with ASTM E29 for the last right-hand
digit...???


Thanks

Paul


Format function? Are you talking about the VBA Format function?

If so, it does not, as I understand you. The Format function returns a string
of digits rounded according to the format expression. The rounding is done in
the same method as the Format Cells dialog in Excel.

Of course, the Format function actually changes the value. Whereas the Format
Cells dialog only changes how the value is displayed.

The VBA Round Function in VBA6+ does conform to the standard, as far as I know.
It rounds the midway numbers to the nearest even number.


--ron
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme
 
Posts: n/a
Default Rounding Question

Hi Paul,
A simple experiment will show you that 1.575 rounds to 1.58 while 1.585
round to 1.59 with formatting and with the ROUND function. Clearly Excel
does not use the ASTM E29 protocol (aka Banker's Rounding)

However, VBA does follow ASTM E29
(see http://support.microsoft.com/default...;EN-GB;q194983 and
http://support.microsoft.com/default...b;EN-US;196652)
So the user-defined function below will round both 1.575 and 1.585 to 1.58
Function myround(rng, fig) myround = Round(rng, fig)End Functionbest wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

wrote in message
...
Does anyone know if the format function ("Format/Number with x number of
decimal places) happens to conform with ASTM E29 for the last right-hand
digit...???


Thanks

Paul



  #4   Report Post  
Posted to microsoft.public.excel.misc
Jerry W. Lewis
 
Posts: n/a
Default Rounding Question

VBA's Round function does not handle the vaguaries of binary approximations
very well, for instance myround(1110*0.0865,2) will round down instead of up.
Your code will often produce more satisfactory results if you use
Round(CDbl(CStr(rng)), fig)

Also, VBA's Round function does not support negative arguments in the way
that the worksheet function does. The code I posted at
http://groups.google.com/group/micro...7fce6145b70d69
deals with this shortcoming.

Does anyone know of any instances where bankers have EVER rounded in this
way? Barring that, does anyone know how this came to be called "Banker's
Rounding"?

Jerry

"Bernard Liengme" wrote:

Hi Paul,
A simple experiment will show you that 1.575 rounds to 1.58 while 1.585
round to 1.59 with formatting and with the ROUND function. Clearly Excel
does not use the ASTM E29 protocol (aka Banker's Rounding)

However, VBA does follow ASTM E29
(see http://support.microsoft.com/default...;EN-GB;q194983 and
http://support.microsoft.com/default...b;EN-US;196652)
So the user-defined function below will round both 1.575 and 1.585 to 1.58
Function myround(rng, fig) myround = Round(rng, fig)End Functionbest wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

wrote in message
...
Does anyone know if the format function ("Format/Number with x number of
decimal places) happens to conform with ASTM E29 for the last right-hand
digit...???


Thanks

Paul




  #5   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme
 
Posts: n/a
Default Rounding Question

Many thanks, Jerry
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Jerry W. Lewis" wrote in message
...
VBA's Round function does not handle the vaguaries of binary
approximations
very well, for instance myround(1110*0.0865,2) will round down instead of
up.
Your code will often produce more satisfactory results if you use
Round(CDbl(CStr(rng)), fig)

Also, VBA's Round function does not support negative arguments in the way
that the worksheet function does. The code I posted at
http://groups.google.com/group/micro...7fce6145b70d69
deals with this shortcoming.

Does anyone know of any instances where bankers have EVER rounded in this
way? Barring that, does anyone know how this came to be called "Banker's
Rounding"?

Jerry

"Bernard Liengme" wrote:

Hi Paul,
A simple experiment will show you that 1.575 rounds to 1.58 while 1.585
round to 1.59 with formatting and with the ROUND function. Clearly Excel
does not use the ASTM E29 protocol (aka Banker's Rounding)

However, VBA does follow ASTM E29
(see http://support.microsoft.com/default...;EN-GB;q194983 and
http://support.microsoft.com/default...b;EN-US;196652)
So the user-defined function below will round both 1.575 and 1.585 to
1.58
Function myround(rng, fig) myround = Round(rng, fig)End Functionbest
wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

wrote in message
...
Does anyone know if the format function ("Format/Number with x number
of
decimal places) happens to conform with ASTM E29 for the last
right-hand
digit...???


Thanks

Paul






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 Data Question sheabones Excel Worksheet Functions 1 September 29th 05 08:20 PM
Excel rounding question Mac Excel Discussion (Misc queries) 2 July 21st 05 09:15 PM
Rounding Question Rweasel6 Excel Worksheet Functions 2 June 14th 05 10:51 PM
Rounding Question PastorHankWi Excel Worksheet Functions 3 March 31st 05 01:09 AM
rounding question Amie Excel Discussion (Misc queries) 2 January 21st 05 04:44 PM


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

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

About Us

"It's about Microsoft Excel"