Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the calculation:
C.Offset(0, 3).Value = qty * rate how may I ensure that calculated value is to 2 decimal places? That is to say, if the computed value was 10.494 then it would Round to 10.49, but if it were 10.495, then it would Round to 10.50. Regards. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 20/02/2004 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Stuart
try C.Offset(0, 3).Value = Round(qty * rate,2) -- Regards Frank Kabel Frankfurt, Germany Stuart wrote: In the calculation: C.Offset(0, 3).Value = qty * rate how may I ensure that calculated value is to 2 decimal places? That is to say, if the computed value was 10.494 then it would Round to 10.49, but if it were 10.495, then it would Round to 10.50. Regards. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 20/02/2004 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just fine!
Many thanks and Regards. "Frank Kabel" wrote in message ... Hi Stuart try C.Offset(0, 3).Value = Round(qty * rate,2) -- Regards Frank Kabel Frankfurt, Germany Stuart wrote: In the calculation: C.Offset(0, 3).Value = qty * rate how may I ensure that calculated value is to 2 decimal places? That is to say, if the computed value was 10.494 then it would Round to 10.49, but if it were 10.495, then it would Round to 10.50. Regards. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 20/02/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 20/02/2004 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just a caveat: Round() is a VBA6 introduction, so won't work with XL97
or MacXL. Also, remember that VBA's Round uses what MS calls "Banker's Rounding" in which numbers ending with the digit 5 are rounded to the nearest *even* number. This is different than XL's Symmetric Arithmetic ROUND which always rounds away from zero: Bankers: Round(4.495, 2) == 4.50 Round(4.485, 2) == 4.48 XL's: ROUND(4.495, 2) == 4.50 ROUND(4.485, 2) == 4.49 There are dozens of ways to round numbers. See http://support.microsoft.com/default...b;en-us;196652 for a fair discussion with VBA algorithms... In article , "Frank Kabel" wrote: Hi Stuart try C.Offset(0, 3).Value = Round(qty * rate,2) |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks.
This could be a problem? I have '97 and '2000 Excel users working with an addin developed under Excel2000, and we need a solution which will always give XL's Symmetric Arithmetic ROUND. Can I achieve this, please? Background: Prior to this, the users' data has almost always had qty as an Integer and always rate as a value with 2 decimal places. This seems to be changing, such that qty is increasingly becoming a non-Integer value, and since the results of each individual calculation are Summed............... The requirement is that each calculation is 'Rounded' at source, rather than 'Round' the summed value, if that makes sense. Regards and thanks. "JE McGimpsey" wrote in message ... Just a caveat: Round() is a VBA6 introduction, so won't work with XL97 or MacXL. Also, remember that VBA's Round uses what MS calls "Banker's Rounding" in which numbers ending with the digit 5 are rounded to the nearest *even* number. This is different than XL's Symmetric Arithmetic ROUND which always rounds away from zero: Bankers: Round(4.495, 2) == 4.50 Round(4.485, 2) == 4.48 XL's: ROUND(4.495, 2) == 4.50 ROUND(4.485, 2) == 4.49 There are dozens of ways to round numbers. See http://support.microsoft.com/default...b;en-us;196652 for a fair discussion with VBA algorithms... In article , "Frank Kabel" wrote: Hi Stuart try C.Offset(0, 3).Value = Round(qty * rate,2) --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 20/02/2004 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Take a look at the MSKB article I cited - there's a VBA5 routine for
Symmetric Arithmetic Rounding there - put that in your code and call it instead of VBA's round. In article , "Stuart" wrote: Many thanks. This could be a problem? I have '97 and '2000 Excel users working with an addin developed under Excel2000, and we need a solution which will always give XL's Symmetric Arithmetic ROUND. Can I achieve this, please? |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks and Regards...again.
"JE McGimpsey" wrote in message ... Take a look at the MSKB article I cited - there's a VBA5 routine for Symmetric Arithmetic Rounding there - put that in your code and call it instead of VBA's round. In article , "Stuart" wrote: Many thanks. This could be a problem? I have '97 and '2000 Excel users working with an addin developed under Excel2000, and we need a solution which will always give XL's Symmetric Arithmetic ROUND. Can I achieve this, please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 20/02/2004 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formatting 'X' Axis -- 2 fundamental differences | Charts and Charting in Excel | |||
Fundamental problem with IF statement | Excel Worksheet Functions | |||
Fundamental problem with IF statement-None worked | Excel Worksheet Functions | |||
Fundamental problem with IF statement | Excel Worksheet Functions | |||
How do I ROUND() round off decimals of a column dataset? | Excel Worksheet Functions |