# 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):

SumBasedCondition.xlsx
###### 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.

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

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

EngineerCommented:
=AVERAGE(IF((MONTH(B7:B161)=MONTH(B3))*(C7:C161<>""),C7:C161))
0
Author Commented:
Yes Thanx !!!
0
Author 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:

SumBasedCondition.xlsx
0
=AVERAGE(IF(MONTH(\$B\$7:\$B\$161) = MONTH(\$B\$3), IF(YEAR(\$B\$7:\$B\$161) = YEAR(\$B\$3), IF(C7:C161<>"", C7:C161))))

=AVERAGE(IF((MONTH(B7:B161)=MONTH(B3))*(C7:C161<>"")*((YEAR(B7:B161)=YEAR(B3)),C7:C161))
0
Author Commented:
Thanx Worked!!!
0
Finance 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.