Solved

Cannot get the percentages to equal 100

Posted on 2011-03-22
5
357 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
  • 2
  • 2
5 Comments
 
LVL 142

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:LukeChung-FMS
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:
LukeChung-FMS 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
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.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now