Re: array question
- From: JE McGimpsey <jemcgimpsey@xxxxxxxx>
- Date: Fri, 29 Jul 2005 00:38:59 -0600
In article <info-376006.10564128072005@xxxxxxxxxxxxxxxxxxxx>,
Harvey Waxman <info@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> {=AVERAGE(IF(($J$12:$J$10786>R1)*($J$12:$J$10786<=R2),$S$12:$S$10786))}
>
> In the above, column J is a column of values
> R1 - R5 is a list of values in numerical order 150, 300, 800, 5000 etc.
> Column S contains percentages
>
> The formula displays the average percentage of all values in column J that
> are
> greater than R1 AND less than or equal R2.
>
> Can someone explain why the formula works by multiplying the ranges?
Lets take just four values:
J R S
1 150
2 300
....
12 180 10%
13 425 20%
14 146 30%
15 294 40%
Then
($J$12:$J$15>R1) ==> {TRUE, TRUE, FALSE, TRUE}
($J$12:$J$15<R=R2) ==> {TRUE, FALSE, TRUE, TRUE}
In math operations, XL treats TRUE/FALSE as 1/0, respectively:
TRUE x TRUE ==> 1 x 1 ==> 1
TRUE x FALSE ==> 1 x 0 ==> 0
FALSE x TRUE ==> 0 x 1 ==> 0
TRUE x TRUE ==> 1 x 1 ==> 1
So the result of the multiplication is {1, 0, 0, 1}
THe IF() statement requires a boolean, so XL coerces 1/0 back to
TRUE/FALSE:
{1, 0, 0, 1} ===> {TRUE, FALSE, FALSE, TRUE}
and the array formula returns an array:
IF(TRUE, $S$12) ==> S12 ==> 10%
IF(FALSE, $S13) ==> FALSE ==> FALSE
IF(FALSE, $S$14) ==> FALSE ==> FALSE
IF(TRUE, $S$15) ==> S15 ==> 40%
and
=AVERAGE(10%, FALSE, FALSE, 40%) ==> 25%
.
- Follow-Ups:
- Re: array question
- From: Harvey Waxman
- Re: array question
- From: Paul Berkowitz
- Re: array question
- References:
- array question
- From: Harvey Waxman
- array question
- Prev by Date: Analysis toolpak add in
- Next by Date: Re: Analysis toolpak add in
- Previous by thread: array question
- Next by thread: Re: array question
- Index(es):
Relevant Pages
|
Loading