View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
external usenet poster
 
Posts: 863
Default Rounding up decimals

Just a caveat: the two functions (as I'm sure Jerry knows) give different
results when the digit to be rounded equals 5. Here's an example:

? round(2.5,0), application.round(2.5,0)

The above prints 2 and 3 as the results.


On Fri, 16 Jul 2004 02:33:51 GMT, "Jerry W. Lewis"
wrote:

You can also call the worksheet round function as in
Application.Round(num, 2)
or if you have Excel 2000 or later, VBA has its own Round function.

Jerry

MAS wrote:

Thanks Mike

Had been scratching my head on that one..

MAS

"Michael Malinsky" wrote in message
...

Assuming your value is stored in variable num:

Format(num, "#,##0.00")

Will put it in comma format.

HTH
Mike
--
Michael J. Malinsky
Pittsburgh, PA

"I am a bear of very little brain, and long
words bother me." -- AA Milne, Winnie the Pooh

"MAS" wrote in message
...

Hi,

I have a msgbox that displays the result of some work , for example as
28.58333

How do i get the result to display just 2 decimal places, ie 28.58

M