How do I obtain the Average Values between 2 dates?

G

gimiv

I have 2 worksheets. One named Daily, one named weekly. The A columns o
both sheets have dates. Daily has every business day (includin
holidays) and weekly has every Friday(including holidays). The
columns contain volume that coorelates with the dates. What I woul
like to do is take the Average values between 2 Fridays and put the
into the weekly worksheet. I had success with the first week because
was only searching on one criteria, but when I tried to search betwee
dates, no luck. This is the formula that worked for the first cell:
{=AVERAGE(IF(Daily!$A$4:$A$604<=Weekly!A4,Daily!$B$4:$B$604))}


Here is the formula I attempted the DID NOT work in calculating th
daily average of one weeks voume.
{=AVERAGE(IF(AND(Daily!$A$4:$A$604<=Weekly!A5,Daily!$A$4:$A$604>Weekly!A4),Daily!$B$4:$B$604))}

Any ideas? FYI, I want to skip the blank cells(holidays) in m
calculations.

Thanks,

Gim
 
D

Domenic

Try...

=AVERAGE(IF(Daily!$A$4:$A$604>Weekly!A4,IF(Daily!$A$4:$A$604
<=Weekly!A5,Daily!$B$4:$B$604)))

....confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 
G

gimiv

That worked, excellent. Thanks Domenic. One last thing, how do I get it
to ignore blank cells (holidays)
 
D

Domenic

Try...

=AVERAGE(IF(Daily!$A$4:$A$604>Weekly!A4,IF(Daily!$A$4:$A$604
<=Weekly!A5,IF(Daily!$B$4:$B$604<>"",Daily!$B$4:$B$604))))

....confirmed with CONTROL+SHIFT+ENTER.
 
G

gimiv

It worked. Thanks again. One more thing. Is there a way to set it s
that if there are noe values to calculate, you don't get the #DIV/0
error
 
D

Domenic

Sure, try the following...

Insert > Name > Define

Name: BigNum

Refers to: =9.99999999999999E+307

Click Ok

Then try...

=LOOKUP(BigNum,CHOOSE({1,2},0,AVERAGE(IF(Daily!$A$4:$A$604>Weekly!A4,IF(D
aily!$A$4:$A$604<=Weekly!A5,IF(Daily!$B$4:$B$604<>"",Daily!$B$4:$B$604)))
)))

....confirmed with CONTROL+SHIFT+ENTER. The formula will return 0
instead of #DIV/0!. If you'd like the cell to be blank, you can custom
format the cell...

Format > Cell > Number > Custom > Type: [=0]""

Hope this helps!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top