Home All Groups Group Topic Archive Search About
Author
31 May 2009 11:58 AM
Mojo
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

Author
31 May 2009 12:23 PM
Larry Serflaten
> I really want to make this work, but it seems fraught with issues!!
>
> Any ideas?

You can't avoid rounding errors.  One method might be to pick the
highest single value (11 in your case) and give it the percentage you
need to reach 100%.  In other words, total up all the other percentages
and give the remainder (from 100%) to that one group.

LFS
Author
31 May 2009 1:07 PM
Jim Mack
Mojo wrote:

     ....
Show quoteHide quote
>
> 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?


This is why there's always fine print saying "Values may not total to
exactly 100% due to rounding"

--
        Jim
Author
31 May 2009 1:25 PM
Greg Maxey
Shouldn't the total always be 100%.  If so, then stop adding it up and
simply use a fixed value of 100%

Mojo wrote:
Show quoteHide quote
> 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

--
Greg Maxey -  Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
Author
31 May 2009 1:29 PM
Mojo
Sorry Greg don't know what you mean.


"Greg Maxey" <gmaxey@mIKEvICTORpAPAsIERRA.oSCARrOMEOgOLF> wrote in message
news:%239KK6Mf4JHA.5728@TK2MSFTNGP03.phx.gbl...
Shouldn't the total always be 100%.  If so, then stop adding it up and
simply use a fixed value of 100%

Mojo wrote:
Show quoteHide quote
> 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

--
Greg Maxey -  Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
Author
31 May 2009 2:29 PM
Greg Maxey
Show quote Hide quote
On May 31, 9:29 am, "Mojo" <ple...@dont.spam.com> wrote:
> Sorry Greg don't know what you mean.
>
> "Greg Maxey" <gma...@mIKEvICTORpAPAsIERRA.oSCARrOMEOgOLF> wrote in message
>
> news:%239KK6Mf4JHA.5728@TK2MSFTNGP03.phx.gbl...
> Shouldn't the total always be 100%.  If so, then stop adding it up and
> simply use a fixed value of 100%
>
>
>
>
>
> Mojo wrote:
> > 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
>
> --
> Greg Maxey -  Word MVP
>
> My web sitehttp://gregmaxey.mvps.org
> Word MVP web sitehttp://word.mvps.org- Hide quoted text -
>
> - Show quoted text -

I mean if the sum of the value is always supposed to be 100% (rather
to some figure close to 100% that your equation produces) then stop
using the equation and just type in 100% in the place of the equation.
Author
31 May 2009 5:22 PM
Jean-Guy Marcil
Greg Maxey was telling us:
Greg Maxey nous racontait que :

Show quoteHide quote
> On May 31, 9:29 am, "Mojo" <ple...@dont.spam.com> wrote:
>> Sorry Greg don't know what you mean.
>>
>> "Greg Maxey" <gma...@mIKEvICTORpAPAsIERRA.oSCARrOMEOgOLF> wrote in
>> message
>>
>> news:%239KK6Mf4JHA.5728@TK2MSFTNGP03.phx.gbl...
>> Shouldn't the total always be 100%. If so, then stop adding it up and
>> simply use a fixed value of 100%
>>
>>
>>
>>
>>
>> Mojo wrote:
>>> 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
>>
>> --
>> Greg Maxey - Word MVP
>>
>> My web sitehttp://gregmaxey.mvps.org
>> Word MVP web sitehttp://word.mvps.org- Hide quoted text -
>>
>> - Show quoted text -
>
> I mean if the sum of the value is always supposed to be 100% (rather
> to some figure close to 100% that your equation produces) then stop
> using the equation and just type in 100% in the place of the equation.

Except that anal people like me will mentally ad up the numbers and notice
that the advertised 100% is wrong...

I believe Larry has a workable solution...

--
______________________________
Jean-Guy Marcil
Montreal, Canada
Author
31 May 2009 5:38 PM
Peter Jamieson
Another possibility is not to display any total for the percentages -
let the other figures stand up for themselves.

Peter Jamieson

http://tips.pjmsn.me.uk

Jean-Guy Marcil wrote:
Show quoteHide quote
> Greg Maxey was telling us:
> Greg Maxey nous racontait que :
>
>> On May 31, 9:29 am, "Mojo" <ple...@dont.spam.com> wrote:
>>> Sorry Greg don't know what you mean.
>>>
>>> "Greg Maxey" <gma...@mIKEvICTORpAPAsIERRA.oSCARrOMEOgOLF> wrote in
>>> message
>>>
>>> news:%239KK6Mf4JHA.5728@TK2MSFTNGP03.phx.gbl...
>>> Shouldn't the total always be 100%. If so, then stop adding it up and
>>> simply use a fixed value of 100%
>>>
>>>
>>>
>>>
>>>
>>> Mojo wrote:
>>>> 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
>>> --
>>> Greg Maxey - Word MVP
>>>
>>> My web sitehttp://gregmaxey.mvps.org
>>> Word MVP web sitehttp://word.mvps.org- Hide quoted text -
>>>
>>> - Show quoted text -
>> I mean if the sum of the value is always supposed to be 100% (rather
>> to some figure close to 100% that your equation produces) then stop
>> using the equation and just type in 100% in the place of the equation.
>
> Except that anal people like me will mentally ad up the numbers and notice
> that the advertised 100% is wrong...
>
> I believe Larry has a workable solution...
>
Author
1 Jun 2009 12:55 AM
macropod
Answered in microsoft.public.excel.misc

Please don't post the same question in multiple forums without linking all of them. Your post in microsoft.public.excel.misc shows
that you know how to do this.

Plus, if your query is specific to one application, it's best limiting the post to a forum dealing with that application - the range
of newsgroups you've posted to suggest you haven't given much though to this.

--
Cheers
macropod
[Microsoft MVP - Word]


Show quoteHide quote
"Mojo" <please@dont.spam.com> wrote in message news:Ou9RYce4JHA.4632@TK2MSFTNGP02.phx.gbl...
> 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
>
>