Why is Access rounding up?

Nothnless

Board Regular
Joined
Apr 28, 2016
Messages
142
Hi,

For some reason this is rounding up to 40.

SumOfSum Of Gross Amount
SumOfSumProduct
Weighted Average
12,492,289,384.91
46,675,715,013.42
40.00

<tbody>
</tbody>


It should just equal 3.736

I can figure out why. All the properties are sent to standard with 2 decimal places.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
What did you choose for the "Field Size" property?
If you chose something that does NOT allow decimals, like Integer or Long Integer, that will trump what you enter in for decimal places (since Integers do not have decimals).
 
Upvote 0
Is that calculation done in a Query?
If so, please post the SQL code of that query.
Or, post the calculation, wherever it is.
 
Upvote 0
Is that calculation done in a Query?
If so, please post the SQL code of that query.
Or, post the calculation, wherever it is.


Yes, here is the SQL:

Code:
SELECT DISTINCTROW Sum([Billing Schedule SubTotal Query].[Sum Of Gross Amount]) AS [Sum Of Sum Of Gross Amount], Sum([Billing Schedule SubTotal Query].[SumProduct]) AS [Sum Of SumProduct], Sum(([SumProduct])/([Sum Of Gross Amount])) AS [Weighted Average]
FROM [Billing Schedule SubTotal Query];

Essentially I'm doing a weighted average calculation which works however it should equal 3.736
 
Upvote 0
I did one query, where I just got the SUM of each field, then another where I just divided the SUMs, and it seemed to work out for me, i.e.
SumOfGross AmountSumOfProductave
12492289384.9146675715013.423.73636197299445

<caption> Query4 </caption><thead>
</thead><tbody>
</tbody><tfoot></tfoot>

Note: If you click on that Weighed Average field in the Query Builder, and right-click and select Properties, what does it show for Format and Decimal Places?
 
Upvote 0
I did one query, where I just got the SUM of each field, then another where I just divided the SUMs, and it seemed to work out for me, i.e.
SumOfGross Amount
SumOfProduct
ave
12492289384.9146675715013.423.73636197299445

<tbody>
</tbody>

Note: If you click on that Weighed Average field in the Query Builder, and right-click and select Properties, what does it show for Format and Decimal Places?

I made sure I chaged all the fields to standard 2 decimal places.

Yeah I basically did the same thing here but its spitting out 40:

Sum Of Sum Of Gross Amount: Sum([Billing Schedule SubTotal Query].[Sum Of Gross Amount]) Sum Of SumProduct: Sum([Billing Schedule SubTotal Query].[SumProduct]) Weighted Average: Sum(([SumProduct])/([Sum Of Gross Amount]))
 
Upvote 0
Trying splitting it up into two queries, like I did.
Sometimes, when you try to do too much in one single query in Access, it doesn't work as expected.
 
Upvote 0
BTW, the sum of the dividends is not necessarily the same as the average of the sums (assuming you have two columns of data you are querying, and not just two scalar values).
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,710
Messages
6,161,445
Members
451,706
Latest member
SMB1982

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top