Sorry for the late reply, I lost the broadband connection. on 12/6
12:38 AM, I asked,
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(D6
15=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(D6
15=D30,1,0)*C6:C15)/SUM(IF(B6:B15>=B3,1,0)*IF(B6:B15<B4,1,0)*IF(D6
15=D30,1,0))
}
hope that all makes sense. Looking forward to your replies.
Cheers,
deano