?
Solved

Cannot get the percentages to equal 100

Posted on 2011-03-22
5
Medium Priority
?
370 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 500 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

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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