PC Review


Reply
Thread Tools Rate Thread

{=AVERAGE(AND(B6:B15>=B3,B6:B15<B4),C6:C15)}

 
 
deano
Guest
Posts: n/a
 
      6th Dec 2006

11/01/06 10.0
11/02/06 10.0
11/03/06 10.0
11/04/06 10.0
11/05/06 10.0
11/06/06 10.0
11/07/06 10.0
11/08/06 10.0
11/09/06 10.0
11/10/06 10.0

the above range is placed in B6:B15

cell B3 contains 11/01/06
cell B4 contains 11/05/06

doing a simple average(C6:C9) produces 10
placing a conditional average if cells B6:B15 are between 11/01/06 and
11/05/06 , average corresponding cells in C6:C15 as in expression

{=AVERAGE(AND(B6:B15>=B3,B6:B15<B4),C6:C15)} produces an incorrect
result = 9.09

why is that ?

cheers,
deano

 
Reply With Quote
 
 
 
 
Niek Otten
Guest
Posts: n/a
 
      6th Dec 2006
Hi Deano,

Your formula averages 0 and c6:c9 correctly.
Easiest is to use one extra column:

=IF(AND(B6>=$B$3,B6<$B$4),C6,"")

and average that column

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"deano" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
|
| 11/01/06 10.0
| 11/02/06 10.0
| 11/03/06 10.0
| 11/04/06 10.0
| 11/05/06 10.0
| 11/06/06 10.0
| 11/07/06 10.0
| 11/08/06 10.0
| 11/09/06 10.0
| 11/10/06 10.0
|
| the above range is placed in B6:B15
|
| cell B3 contains 11/01/06
| cell B4 contains 11/05/06
|
| doing a simple average(C6:C9) produces 10
| placing a conditional average if cells B6:B15 are between 11/01/06 and
| 11/05/06 , average corresponding cells in C6:C15 as in expression
|
| {=AVERAGE(AND(B6:B15>=B3,B6:B15<B4),C6:C15)} produces an incorrect
| result = 9.09
|
| why is that ?
|
| cheers,
| deano
|


 
Reply With Quote
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      6th Dec 2006
Hi
AND(B6:B15>=B3,B6:B15<B4) can evaluate to 1 or 0.
AND(B6:B15>=B3,B6:B15<B4),C6:C15 is now 11 numbers (a 1 or 0 and 10
10's)
Your array formula, I think, will return the AND condition on the last
row (which is 0) averaged with the ten numbers. This average is 100/11
= 9.09090909...

Try
{=SUM(IF(B6:B15<B4,1,0)*IF(B6:B15>=B3,1,0)*C6:C15)/SUM(IF(B6:B15<B4,1,0)*IF(B6:B15>=B3,1,0))}

The top sum adds the tens meeting both criteria, which is 30. The
bottom sum counts the number of entries meeting the criteria, which is
3. So the average is 10.
Note that
{=AVERAGE(IF(B6:B15<B4,1,0)*IF(B6:B15>=B3,1,0)*C6:C15)}

will give 3, as the sum part will be 30, but you will have 10 numbers
in the range.

regards
Paul

deano wrote:

> 11/01/06 10.0
> 11/02/06 10.0
> 11/03/06 10.0
> 11/04/06 10.0
> 11/05/06 10.0
> 11/06/06 10.0
> 11/07/06 10.0
> 11/08/06 10.0
> 11/09/06 10.0
> 11/10/06 10.0
>
> the above range is placed in B6:B15
>
> cell B3 contains 11/01/06
> cell B4 contains 11/05/06
>
> doing a simple average(C6:C9) produces 10
> placing a conditional average if cells B6:B15 are between 11/01/06 and
> 11/05/06 , average corresponding cells in C6:C15 as in expression
>
> {=AVERAGE(AND(B6:B15>=B3,B6:B15<B4),C6:C15)} produces an incorrect
> result = 9.09
>
> why is that ?
>
> cheers,
> deano


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      6th Dec 2006
Your formula is not evaluating the B6:B15 range as you think and returning
matches in C6:C15, but rather is averaging C6:C15, and the result of the AND
test (which returns FALSE), so it is averaging
(0,10,10,10,10,10,10,10,10,10,10), which is 100 divided by 11, QED.

The AND does not return an array of results, so you need something that does

AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4),C6:C15))

as an array formula.




--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
"deano" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 11/01/06 10.0
> 11/02/06 10.0
> 11/03/06 10.0
> 11/04/06 10.0
> 11/05/06 10.0
> 11/06/06 10.0
> 11/07/06 10.0
> 11/08/06 10.0
> 11/09/06 10.0
> 11/10/06 10.0
>
> the above range is placed in B6:B15
>
> cell B3 contains 11/01/06
> cell B4 contains 11/05/06
>
> doing a simple average(C6:C9) produces 10
> placing a conditional average if cells B6:B15 are between 11/01/06 and
> 11/05/06 , average corresponding cells in C6:C15 as in expression
>
> {=AVERAGE(AND(B6:B15>=B3,B6:B15<B4),C6:C15)} produces an incorrect
> result = 9.09
>
> why is that ?
>
> cheers,
> deano
>



 
Reply With Quote
 
deano
Guest
Posts: n/a
 
      15th Dec 2006
Sorry for the late reply, I lost the broadband connection. on 12/6
12:38 AM, I asked,
> >
> > 11/01/06 10.0
> > 11/02/06 10.0
> > 11/03/06 10.0
> > 11/04/06 10.0
> > 11/05/06 10.0
> > 11/06/06 10.0
> > 11/07/06 10.0
> > 11/08/06 10.0
> > 11/09/06 10.0
> > 11/10/06 10.0
> >
> > the above range is placed in B6:B15
> >
> > cell B3 contains 11/01/06
> > cell B4 contains 11/05/06
> >
> > doing a simple average(C6:C9) produces 10
> > placing a conditional average if cells B6:B15 are between 11/01/06 and
> > 11/05/06 , average corresponding cells in C6:C15 as in expression
> >
> > {=AVERAGE(AND(B6:B15>=B3,B6:B15<B4),C6:C15)} produces an incorrect
> > result = 9.09
> >
> > why is that ?
> >
> > cheers,
> > deano
> >


12/6 3:50 AM , Niek Otten suggested to use one extra column and
average that column.
=IF(AND(B6>=$B$3,B6<$B$4),C6,"")

12/6 4:24 AM , Paul Robin suggested to
{=SUM(IF(B6:B15<B4,1,0)*IF(B6:B15>=B3,1,0)*C6:C15)/SUM(IF(B6:B15<B4,1,0)*IF(B6:B15>=B3,1,0))}

12/6 4:50 AM, Bob Phillips suggested to
{=AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4),C6:C15))}

Thank you all for you prompt feedback, My broadband connection dropped
out otherwise I would have answered sooner. Any way

Niek, I would but I can not add a column.
Paul, yes that works.
Bob, for some reason, that still does not work.

I altered the data to make it more readily obvious. Data in C6:C15

B column C col D column
------------- ------- --------
11/01/06 Start day in B3
11/05/06 End day in B4

11/01/06 10.0 cats
11/02/06 5.0 dogs
11/03/06 3.0 cats
11/04/06 7.0 rats
11/05/06 10.0 dogs
11/06/06 5.0 cats
11/07/06 10.0 dogs
11/08/06 10.0 rats
11/09/06 7.0 cats
11/10/06 3.0 dogs


6.25 =AVERAGE(C6:C9)

0.00 {=AVERAGE(IF(AND(B6:B15>=B3,B6:B15<B4),C6:C15,))}

2.50 {=AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4),C6:C15,))}

2.50 {=AVERAGE(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*C6:C15)}

6.25
{=SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*C6:C15)/SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0))}


As you can see, Paul's suggestion works.

Part A:
Yet I still ask, How can an Average(IF( construct be made to work. The
reason I ask is that I have gotten to work before, just can not place
it in my sheets.

Part B:

suppose we add one additional compound criteria as column D has to be
cats to the date range criteria, the Sum IF construct works to sum and
to average, but again how could an Average( IF ( construct work with
compund criteria ?

Sum cats 13.0 =SUM(C6,C8)
SumIFcats 13.0 cats
{=SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D615=B34,1,0)*C6:C15)}

Here is the average
6.5
{=SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D615=D30,1,0)*C6:C15)/SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D615=D30,1,0))
}

hope that all makes sense. Looking forward to your replies.
Cheers,
deano

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      15th Dec 2006

Re-read Bob's post
--
Don Guillett
SalesAid Software
(E-Mail Removed)
"deano" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Sorry for the late reply, I lost the broadband connection. on 12/6
> 12:38 AM, I asked,
>> >
>> > 11/01/06 10.0
>> > 11/02/06 10.0
>> > 11/03/06 10.0
>> > 11/04/06 10.0
>> > 11/05/06 10.0
>> > 11/06/06 10.0
>> > 11/07/06 10.0
>> > 11/08/06 10.0
>> > 11/09/06 10.0
>> > 11/10/06 10.0
>> >
>> > the above range is placed in B6:B15
>> >
>> > cell B3 contains 11/01/06
>> > cell B4 contains 11/05/06
>> >
>> > doing a simple average(C6:C9) produces 10
>> > placing a conditional average if cells B6:B15 are between 11/01/06 and
>> > 11/05/06 , average corresponding cells in C6:C15 as in expression
>> >
>> > {=AVERAGE(AND(B6:B15>=B3,B6:B15<B4),C6:C15)} produces an incorrect
>> > result = 9.09
>> >
>> > why is that ?
>> >
>> > cheers,
>> > deano
>> >

>
> 12/6 3:50 AM , Niek Otten suggested to use one extra column and
> average that column.
> =IF(AND(B6>=$B$3,B6<$B$4),C6,"")
>
> 12/6 4:24 AM , Paul Robin suggested to
> {=SUM(IF(B6:B15<B4,1,0)*IF(B6:B15>=B3,1,0)*C6:C15)/SUM(IF(B6:B15<B4,1,0)*IF(B6:B15>=B3,1,0))}
>
> 12/6 4:50 AM, Bob Phillips suggested to
> {=AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4),C6:C15))}
>
> Thank you all for you prompt feedback, My broadband connection dropped
> out otherwise I would have answered sooner. Any way
>
> Niek, I would but I can not add a column.
> Paul, yes that works.
> Bob, for some reason, that still does not work.
>
> I altered the data to make it more readily obvious. Data in C6:C15
>
> B column C col D column
> ------------- ------- --------
> 11/01/06 Start day in B3
> 11/05/06 End day in B4
>
> 11/01/06 10.0 cats
> 11/02/06 5.0 dogs
> 11/03/06 3.0 cats
> 11/04/06 7.0 rats
> 11/05/06 10.0 dogs
> 11/06/06 5.0 cats
> 11/07/06 10.0 dogs
> 11/08/06 10.0 rats
> 11/09/06 7.0 cats
> 11/10/06 3.0 dogs
>
>
> 6.25 =AVERAGE(C6:C9)
>
> 0.00 {=AVERAGE(IF(AND(B6:B15>=B3,B6:B15<B4),C6:C15,))}
>
> 2.50 {=AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4),C6:C15,))}
>
> 2.50 {=AVERAGE(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*C6:C15)}
>
> 6.25
> {=SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*C6:C15)/SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0))}
>
>
> As you can see, Paul's suggestion works.
>
> Part A:
> Yet I still ask, How can an Average(IF( construct be made to work. The
> reason I ask is that I have gotten to work before, just can not place
> it in my sheets.
>
> Part B:
>
> suppose we add one additional compound criteria as column D has to be
> cats to the date range criteria, the Sum IF construct works to sum and
> to average, but again how could an Average( IF ( construct work with
> compund criteria ?
>
> Sum cats 13.0 =SUM(C6,C8)
> SumIFcats 13.0 cats
> {=SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D615=B34,1,0)*C6:C15)}
>
> Here is the average
> 6.5
> {=SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D615=D30,1,0)*C6:C15)/SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D615=D30,1,0))
> }
>
> hope that all makes sense. Looking forward to your replies.
> Cheers,
> deano
>



 
Reply With Quote
 
deano
Guest
Posts: n/a
 
      15th Dec 2006
Don Guillett wrote:
> Re-read Bob's post
> --
> Don Guillett
> SalesAid Software
> (E-Mail Removed)
> "deano" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Sorry for the late reply, I lost the broadband connection. on 12/6
> > 12:38 AM, I asked,
> >> >
> >> > 11/01/06 10.0
> >> > 11/02/06 10.0
> >> > 11/03/06 10.0
> >> > 11/04/06 10.0
> >> > 11/05/06 10.0
> >> > 11/06/06 10.0
> >> > 11/07/06 10.0
> >> > 11/08/06 10.0
> >> > 11/09/06 10.0
> >> > 11/10/06 10.0
> >> >
> >> > the above range is placed in B6:B15
> >> >
> >> > cell B3 contains 11/01/06
> >> > cell B4 contains 11/05/06
> >> >
> >> > doing a simple average(C6:C9) produces 10
> >> > placing a conditional average if cells B6:B15 are between 11/01/06 and
> >> > 11/05/06 , average corresponding cells in C6:C15 as in expression
> >> >
> >> > {=AVERAGE(AND(B6:B15>=B3,B6:B15<B4),C6:C15)} produces an incorrect
> >> > result = 9.09
> >> >
> >> > why is that ?
> >> >
> >> > cheers,
> >> > deano
> >> >

> >
> > 12/6 3:50 AM , Niek Otten suggested to use one extra column and
> > average that column.
> > =IF(AND(B6>=$B$3,B6<$B$4),C6,"")
> >
> > 12/6 4:24 AM , Paul Robin suggested to
> > {=SUM(IF(B6:B15<B4,1,0)*IF(B6:B15>=B3,1,0)*C6:C15)/SUM(IF(B6:B15<B4,1,0)*IF(B6:B15>=B3,1,0))}
> >
> > 12/6 4:50 AM, Bob Phillips suggested to
> > {=AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4),C6:C15))}
> >
> > Thank you all for you prompt feedback, My broadband connection dropped
> > out otherwise I would have answered sooner. Any way
> >
> > Niek, I would but I can not add a column.
> > Paul, yes that works.
> > Bob, for some reason, that still does not work.
> >
> > I altered the data to make it more readily obvious. Data in C6:C15
> >
> > B column C col D column
> > ------------- ------- --------
> > 11/01/06 Start day in B3
> > 11/05/06 End day in B4
> >
> > 11/01/06 10.0 cats
> > 11/02/06 5.0 dogs
> > 11/03/06 3.0 cats
> > 11/04/06 7.0 rats
> > 11/05/06 10.0 dogs
> > 11/06/06 5.0 cats
> > 11/07/06 10.0 dogs
> > 11/08/06 10.0 rats
> > 11/09/06 7.0 cats
> > 11/10/06 3.0 dogs
> >
> >
> > 6.25 =AVERAGE(C6:C9)
> >
> > 0.00 {=AVERAGE(IF(AND(B6:B15>=B3,B6:B15<B4),C6:C15,))}
> >
> > 2.50 {=AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4),C6:C15,))}
> >
> > 2.50 {=AVERAGE(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*C6:C15)}
> >
> > 6.25
> > {=SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*C6:C15)/SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0))}
> >
> >
> > As you can see, Paul's suggestion works.
> >
> > Part A:
> > Yet I still ask, How can an Average(IF( construct be made to work. The
> > reason I ask is that I have gotten to work before, just can not place
> > it in my sheets.
> >
> > Part B:
> >
> > suppose we add one additional compound criteria as column D has to be
> > cats to the date range criteria, the Sum IF construct works to sum and
> > to average, but again how could an Average( IF ( construct work with
> > compund criteria ?
> >
> > Sum cats 13.0 =SUM(C6,C8)
> > SumIFcats 13.0 cats
> > {=SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D615=B34,1,0)*C6:C15)}
> >
> > Here is the average
> > 6.5
> > {=SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D615=D30,1,0)*C6:C15)/SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D615=D30,1,0))
> > }
> >
> > hope that all makes sense. Looking forward to your replies.
> > Cheers,
> > deano
> >


Terse....Don, but to the point. It was the extra comma at the end which
made it not work.

2.50 {=AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4),C6:C15,))}
6.25 {=AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4),C6:C15))}

it also works on compound criteria, beautiful......
6.5 {=AVERAGE(IF((B6:B15>=B3)*(B6:B15<B4)*(D615=D30),C6:C15))}

Thanks to you All.

cheers, deano

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: A useful AVERAGE calculation without using the built-in AVERAGE function קובי Microsoft Excel New Users 0 3rd Feb 2011 04:25 PM
Re: A useful AVERAGE calculation without using the built-in AVERAGE function Roger Govier Microsoft Excel New Users 0 16th Jan 2011 01:20 PM
A formula to AVERAGE IF but only average a set number of values DonFlak@gmail.com Microsoft Excel Worksheet Functions 2 31st Jan 2008 08:28 PM
Find monthly average but have average automatically configured =?Utf-8?B?a2ltYmFmcmVk?= Microsoft Excel Misc 2 8th Aug 2007 12:28 AM
Error Handling #N/A with AVERAGE Function - Average of values in Row Sam via OfficeKB.com Microsoft Excel Worksheet Functions 13 31st Jul 2005 03:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:19 AM.