Average of selected field

G

Guest

I'm trying to take an average of a set of numbers (C12:E21) that correspond
to a set of qualifiers. For example, there are values corresponding to
Corporal, General, Private, and Sargeant. I am trying to tell excel to take
an average in C12:E21 for ONLY the lines corresponding to Corporal. The
equation i'm using now is as follows:
=IF($B28=0,0,SUM(SUMIF($B$11:$B$21,$A28,C$11:C$21),SUMIF($B$11:$B$21,$A28,D$11:D$21),SUMIF($B$11:$B$21,$A28,E$11:E$21))/((COUNTIF($B$11:$B$21,!$A28))*3))
where A28 is the name "corporal" and B28 is the number of corporals in the
set. the *3 is because there are three columns of numbers. Is there a
better,more leveragable way to do this?
 
D

Domenic

Try the following...

=IF($B28=0,0,AVERAGE(IF($B$11:$B$21=$A28,$C$11:$E$21)))

To exclude empty cells or zero values...

=IF($B28=0,0,AVERAGE(IF(($B$11:$B$21=$A28)*($C$11:$E$21>0),$C$11:$E$21)))

Both these formulas need to be confirmed with CONTROL+SHIFT+ENTER.

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

Similar Threads

nested function 4
comparing times in excel 1
Request for formula 10
Help with If Sum statement - i think.... 4
move data from columns to rows 3
help! 1
Formula help please!! IF(OR 2
Multiple levels of sumif? 3

Top