Solved

Cannot get the percentages to equal 100

Posted on 2011-03-22
5
368 Views
Last Modified: 2012-05-11
Hello - I've worked on this for a rediculous number of hours....I have a report that calculates the monthly percentages of incidents by incident type.  I calculate the percent and store it in a field that has a Number data type, field size of 'Double', a format of 'General Number' and a Decimal places = 2.   I do round the percent calculation and it looks like this:
Round(([rstTotalInc].Fields(2) * 100) / varTotalIncYear1, 3)
On the report, the percentage fields Format is set to Auto for Decimals.

The problem is that when I total the percentages, I cannot get them to equal 100 unless I allow the field on the report to go to 3 decimals.  Even then sometimes it sums to 99.999.  I've tried rounding, not rouding, changing the data type, etc.  I would like the percentages for each incident type to be percentages with no numbers to the right of the decimal and to have the same format for the total percentage and I would like it to equal 100.  Any help would be most appreciated.  Thank you.
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35192758
yes, that is a problem.

say you have 3 rows with the values 1 , 1 and 1. total is 3. perc for all 3 rows is 33.33333333333 % ..
no matter how many digits you put, you won't be able to sum up to 100%.

this must be known to all those checking percentages, that the percentages are NOT to be summed, unless (at least 1) of the resulting percentages is "recalculated" to be the 100% - sum( of all the other percentages displayed ), however, then, that percentage value does not 100% match the actual calc, aka 33.34 vs 33.33 for example.

you CANNOT solve that issue.
0
 

Author Comment

by:DataTransformationServices
ID: 35193273
Thank you for your response.  I somewhat had a feeling that would be the case but it is being done in Excel.   In the Excel spreadsheet, the numbers are rounding and the total is 100 by summing the individual percents.  Any idea why it works there?
0
 
LVL 10

Expert Comment

by:Luke Chung
ID: 35193303
Don't use the Round function in the expression.

Use the format property of the text box to control how it's displayed. Round will change the value.

That way the control keeps the full "real" value and when you sum it up, you'll get the 100%.

Hope this helps.
0
 

Author Comment

by:DataTransformationServices
ID: 35201262
Thanks so much, I did remove the rounding and use the Format command and it still comes out to 99.99999.  I guess I will have to give the user the ability to edit these values to equal 100.  Thanks again.
0
 
LVL 10

Accepted Solution

by:
Luke Chung earned 125 total points
ID: 35203781
You shouldn't have to edit anything.  If your report has a format setting to a fixed number of decimals, that'll appear as 100.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question