Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MAS MAS is offline
external usenet poster
 
Posts: 18
Default Rounding up decimals

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Rounding up decimals

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





  #3   Report Post  
Posted to microsoft.public.excel.programming
MAS MAS is offline
external usenet poster
 
Posts: 18
Default Rounding up decimals

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







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default Rounding up decimals

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








  #5   Report Post  
Posted to microsoft.public.excel.programming
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










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default Rounding up decimals

Specifically, the VBA round function follows the rounding rules
specified by ASTM and many other standards bodies: by rounding to the
nearest rounded number, with ties (exactly 5) rounding up or down as
necessary to leave the last rounded digit even. The worksheet round
function uses the simplified rule that many people are more familiar
with: where ties always round up.

Jerry

Myrna Larson wrote:

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








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 up decimals Darren Excel Worksheet Functions 2 May 25th 09 01:39 AM
Rounding decimals up or down Friedbrain Excel Discussion (Misc queries) 3 August 11th 08 02:19 PM
Rounding Up Decimals Lilbit Excel Worksheet Functions 8 January 4th 06 08:42 PM
Rounding Decimals Jim May Excel Discussion (Misc queries) 8 November 7th 05 06:02 PM
Rounding Decimals Sho Excel Worksheet Functions 6 November 16th 04 02:29 PM


All times are GMT +1. The time now is 04:08 PM.

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"