Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Fundamental use of Round

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Fundamental use of Round

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Fundamental use of Round

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Fundamental use of Round

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Fundamental use of Round

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Fundamental use of Round

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Fundamental use of Round

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
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
Formatting 'X' Axis -- 2 fundamental differences F. Lawrence Kulchar Charts and Charting in Excel 8 October 13th 10 10:55 AM
Fundamental problem with IF statement David F Excel Worksheet Functions 3 May 17th 05 03:42 PM
Fundamental problem with IF statement-None worked David F Excel Worksheet Functions 3 May 13th 05 12:37 AM
Fundamental problem with IF statement David F Excel Worksheet Functions 4 May 12th 05 09:34 PM
How do I ROUND() round off decimals of a column dataset? Højrup Excel Worksheet Functions 2 January 12th 05 10:50 AM


All times are GMT +1. The time now is 02:18 AM.

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"