Calculate average in Excel 2010 per month of the year

We are trying to calculate the average of each months of the years using the formula "=AVERAGE".  Unfortunately, it's not working.  We tried also "=SUMPRODUCT" but can't seem to get it accomplish.

In the included excel, notice that the formula displays and next to it what we calculate manually (see pic):

results
Please advice on the formula to use.

Thank you in advance.
SumBasedCondition.xlsx
rayluvsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun KlineLead Software EngineerCommented:
Try this array formula for Jan 2015 TOP:
=AVERAGE(IF(MONTH($B$7:$B$161) = MONTH($B$3), IF(C7:C161<>"", C7:C161)))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Saqib Husain, SyedEngineerCommented:
=AVERAGE(IF((MONTH(B7:B161)=MONTH(B3))*(C7:C161<>""),C7:C161))
0
rayluvsAuthor Commented:
Yes Thanx !!!
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

rayluvsAuthor Commented:
Hi,

We know we closed the question, but when transferring the formula to our real-working excel, it doesn't calculate correctly.  The reason is that the sample excel we provided only had data of 2015 and the real-life excel has data since 2007.   So the formula takes in account the month of all year; hence, wrong value.

How can we fix it to only read months of year 2015.

Notice below when entering data of 2009, the results are wrong for January 2015:

s2SumBasedCondition.xlsx
0
Shaun KlineLead Software EngineerCommented:
Using my answer:
=AVERAGE(IF(MONTH($B$7:$B$161) = MONTH($B$3), IF(YEAR($B$7:$B$161) = YEAR($B$3), IF(C7:C161<>"", C7:C161))))

Using Syed's answer:
=AVERAGE(IF((MONTH(B7:B161)=MONTH(B3))*(C7:C161<>"")*((YEAR(B7:B161)=YEAR(B3)),C7:C161))
0
rayluvsAuthor Commented:
Thanx Worked!!!
0
Rob HensonFinance AnalystCommented:
You could have also used a Pivot Table with Values calculated as Average.
SumBasedCondition-1.xlsx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.