Thread: 100% quandry
View Single Post
  #4   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc
Arvin Meyer MVP Arvin Meyer MVP is offline
external usenet poster
 
Posts: 1
Default 100% quandry

You either must show more decimal places or accept the fact that whole
numbers contain portions of others. FWIW, since the computer really doesn't
do decimals (it does binary math) you may still experience some rounding
issues which increase or decrease the percentages. You can make it more
accurate by using the currency datatype which locks the decimals at 4
places. You do not have to format currency data as money, you can format it
any way you wish and use 0 to 4 decimal places.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Mojo" wrote in message
...
Hi All

This might be an age old problem, but I just wanted to see if I wasn't
missing something obvious in my code.

Basically I have say 31 people (this figure can range from 10 to 100) who
are put into 8 categories. Once they have been categorised I simply need
to
show how many are in each category as a number and as a percentage. Now
the
number aspect of display is easy, but I'm coming unstuck with the
percetange
aspect.

In essence as I do my % calc for each category sometimes certain values
are
1% less or more than they should be and as you add up the displayed
figures
the total might come out at 99% or 101%, which looks daft.

An example of a display problem is as follows

1 0 2 9 11 5 0 2 = 30
people
3% 0% 7% 30% 37% 17% 0% 7% = 101% !!!!

My code for each percentage value is simply:

Round((intPeopleCount / intTotalPeopleCount) * 100, 0) & "%"

I really want to make this work, but it seems fraught with issues!!

Any ideas?

Thanks