# Adding 2nd criteria for AverageIf Excel Formula

Hello experts,

I'm using AVERAGEIF function to return the average of all the cells in a range that meet a given criteria.

I need to add a 2nd condition to the formula, but the problem is that the 2nd condition is not related to the first one, and hence it cannot be combined with it.

So, what I'm looking for is actually the following:

AverageIf (Condition 1 is met, Condition 2 is met, Average_Range*)

* Average_range is the actual set of cells to average.

I'm attaching the worksheet that has the AVERAGEIF formula in the hope it will better explain what I'm trying to achieve.
AverageIf-Sample-Data.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.

Commented:
I think you just mean:

=AVERAGEIFS(INPUT!\$G\$2:\$G\$1670,INPUT!\$K\$2:\$K\$1670,\$E5,INPUT!\$I\$2:\$I\$1670,F\$2)

This will return errors if there are no matching data, so you may want to add an IFERROR to return either "" or 0:

=IFERROR(AVERAGEIFS(INPUT!\$G\$2:\$G\$1670,INPUT!\$K\$2:\$K\$1670,\$E5,INPUT!\$I\$2:\$I\$1670,F\$2),"")

Experts Exchange Solution brought to you by