# Sum columns based on two values in Excel 2010

We are trying to SUM three (3) column and calculate its averaged but basing on the "Type" and "Year" that the line pertains to.

Included is an excel with what we are trying to do.

There are 3 columns with values (column Value1, Value2 and Value3).
We want to SUM and COUNT the columns "Value" based on the column "Type" and the column "Year".
Afterward get its average per value based on the year 2014.

In the excel we try to use SUMIF with COUNTA then tried to use SUMIFS, but can't seem to get the result we want.

The attached excel, in the columns N, O and P shows the value that the formula has to calculate (we placed it manually for comparison purposes).
###### Who is Participating?

x
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.

Author Commented:
forgot the file.

Commented:
I believe this is what you are looking for...

Alternatively you don't have to do with Sumifs/Countifs as in excel 2007 onwards you can apply averageifs formula directly which gives you the same result as shown in the workbook of yours in highlighted cells..

Saurabh...

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.

Author Commented:
Hey Thankx a lot! It worked!

We did find this function but tried to understand it and just couldn't get it running.  Can you give a brief explaination (using your exact line below):

=AVERAGEIFS(\$H\$14:\$H\$39,\$D\$14:\$D\$39,H\$2,\$E\$14:\$E\$39,\$G6)
Commented:
Can I chime in :)

Explanation -

Please calculate the average of the values in H14-39 (target rows), if the following criteria apply:
1. That for the range D14-39, the target rows have value = H2
AND
2. That for the range E14-39, the target rows have a value of G6.
Group Finance ManagerCommented:
Why not use a PivotTable?

I am having problems attaching files, but here's a download link for an example with two PivotTables

Average with PivotTables
Commented:
rayluvs,

Averagifs.. will work same as sumifs... The parameter for the same are first range is range of which you want to do average..in sumifs its the range you want to do sum of.. Then your other parameters come which your criteria range 1 and criteria 1 ..your crieria range 2 and criteria 2 and so on.. Basically it apply and function between criteria 1 and 2 and all those parameters which matches that condition..it will give an average of it and in case it will give sumif for it..

Hope this helps..

Saurabh...
Author Commented:
Thanx!
###### 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.