Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Rounding up decimals | Excel Worksheet Functions | |||
Rounding decimals up or down | Excel Discussion (Misc queries) | |||
Rounding Up Decimals | Excel Worksheet Functions | |||
Rounding Decimals | Excel Discussion (Misc queries) | |||
Rounding Decimals | Excel Worksheet Functions |