473,473 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Rounding Issues - HELP!

Sorry in advance for the lack of formatting in this posting.

Data:

(column headers)
Net Sales | Royalty Rate | Total Royalty
(data)
4.31 | 50.00% | 2.15
19.35 | 50.00% | 9.68

What gives?

Here is the query that runs this calculation:

UPDATE
[WT_Royalties-detail]
SET
[WT_Royalties-detail].[Total Royalty] = Round([Net Sales]*[Royalty
Rate],2)
WHERE
((([WT_Royalties-detail].Ref)="LSI"));

So why is the first row rounding down while the second row is rounding
up?

Note: Before I added the Round() function, the rows returned 2.155 and
9.675 respectively, if that helps.

Thanks!

Oct 11 '06 #1
5 2731
"Cygnus" <sa*@firstbooks.com???????/???????? ? ???????? ?????????:
news:11*********************@h48g2000cwc.googlegro ups.com...
So why is the first row rounding down while the second row is rounding
up?
That must be the "banker's rounding" issue (not a crime).

You could use something like

Int([Net Sales]*[Royalty Rate]*100)/100

instead of Round(.., 2).
Oct 11 '06 #2

Eman wrote:
"Cygnus" <sa*@firstbooks.com???????/???????? ? ???????? ?????????:
news:11*********************@h48g2000cwc.googlegro ups.com...
So why is the first row rounding down while the second row is rounding
up?

That must be the "banker's rounding" issue (not a crime).

You could use something like

Int([Net Sales]*[Royalty Rate]*100)/100

instead of Round(.., 2).
Unfortunately, this will not work and should not be used by someone
looking to ROUND.

Here's why.

[Net Sales]*[Royalty Rate]*100 = 2155
Int([Net Sales]*[Royalty Rate]*100) = 215.
Int([Net Sales]*[Royalty Rate]*100)/100 = 2.15

2.155 needs to be rounded to 2.16, not 2.15. All this line of code does
is truncate and that is not what we need to do. We need to round.

Thanks, though.

Oct 12 '06 #3
"Cygnus" <sa*@firstbooks.comwrote in
news:11**********************@c28g2000cwb.googlegr oups.com:
>
Eman wrote:
>"Cygnus" <sa*@firstbooks.com???????/???????? ? ???????? ?????????:
news:11*********************@h48g2000cwc.googlegr oups.com...
So why is the first row rounding down while the second row is
rounding up?

That must be the "banker's rounding" issue (not a crime).

You could use something like

Int([Net Sales]*[Royalty Rate]*100)/100

instead of Round(.., 2).

Unfortunately, this will not work and should not be used by someone
looking to ROUND.

Here's why.

[Net Sales]*[Royalty Rate]*100 = 2155
Int([Net Sales]*[Royalty Rate]*100) = 215.
Int([Net Sales]*[Royalty Rate]*100)/100 = 2.15

2.155 needs to be rounded to 2.16, not 2.15. All this line of code
does is truncate and that is not what we need to do. We need to round.

Thanks, though.
There are many VB rounding functions to be found at
http://www.xbeat.net/vbspeed/c_Round.htm
I think all of them will work in VBA.
Perhaps, you can find one that will fit your needs exactly there.

--
Lyle Fairfield
Oct 12 '06 #4
"Cygnus" <sa*@firstbooks.com???????/???????? ? ???????? ?????????:
news:11**********************@c28g2000cwb.googlegr oups.com...
>
Eman wrote:
>"Cygnus" <sa*@firstbooks.com???????/???????? ? ???????? ?????????:
news:11*********************@h48g2000cwc.googlegr oups.com...
So why is the first row rounding down while the second row is rounding
up?

That must be the "banker's rounding" issue (not a crime).

You could use something like

Int([Net Sales]*[Royalty Rate]*100)/100

instead of Round(.., 2).

Unfortunately, this will not work and should not be used by someone
looking to ROUND.

Here's why.

[Net Sales]*[Royalty Rate]*100 = 2155
Int([Net Sales]*[Royalty Rate]*100) = 215.
Int([Net Sales]*[Royalty Rate]*100)/100 = 2.15

2.155 needs to be rounded to 2.16, not 2.15. All this line of code does
is truncate and that is not what we need to do. We need to round.
Yeah, i've wrote "something like" ;)
Int(x + 0.5) will provide habitual "arithmetical" rounding.

Oct 12 '06 #5
I believe the Access (VBA) Round() function rounds every other value ending
in 5 up, then down, up, then down. It seeks to correct the long term
predudice of always rounding the five up.
"Cygnus" <sa*@firstbooks.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...
Sorry in advance for the lack of formatting in this posting.

Data:

(column headers)
Net Sales | Royalty Rate | Total Royalty
(data)
4.31 | 50.00% | 2.15
19.35 | 50.00% | 9.68

What gives?

Here is the query that runs this calculation:

UPDATE
[WT_Royalties-detail]
SET
[WT_Royalties-detail].[Total Royalty] = Round([Net Sales]*[Royalty
Rate],2)
WHERE
((([WT_Royalties-detail].Ref)="LSI"));

So why is the first row rounding down while the second row is rounding
up?

Note: Before I added the Round() function, the rows returned 2.155 and
9.675 respectively, if that helps.

Thanks!

Oct 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Raoul Watson | last post by:
By any chance, anyone got a rounding routine that does a work around the VB "round" bug? I still find it amazing that a company as large as Microsoft would put out a math package that is so...
7
by: Steven T. Hatton | last post by:
I'm surprised I haven't hit this situation till now, but I don't believe I've had to deal with it before. I have a function that sets the components of a point class (QPoint from Qt). It takes...
2
by: Lynn N. | last post by:
I have a report showing Rate, Hours and Total Pay (which is Rate*Hours) for several workers. I want to sum the Total Pay and get a CORRECT figure. This seems like it should be such a simple task....
5
by: astro | last post by:
I have a report/invoice that lists volume, price per unit, and extended price. My problem is being able to get the extended price by multiplying the x . With just 2 decimal places on both...
6
by: shaqattack1992-newsgroups | last post by:
Hello Everyone, I'm using the following on a form in my database: =(-Int(-Sum((IIf(=Yes,((*)+()), (((*)+)*1.06))*100))))/100 In this case, I want to calculate a total for an order. If...
2
by: apartain | last post by:
In the detail of my report I am extracting a sum from a hidden subform via the following: =IIf(.Report.HasData=True,.Report!Text19,0) Where Text19 is the sum of the items in the subform. I...
3
by: mickeybaez | last post by:
Need Help! I am new to asp.net and I am having problems inserting proper data into SQL Server 2000. I have a field named salary with the datatype of decimal. When I insert a value into the...
206
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
4
by: portsamerica | last post by:
I am new with access database and our database having rounding issues can any one help me here is the Query. Private Sub ComputeInvoice(ciArg As String) If IsNull(Me.) Then MsgBox...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.