COUNTIF Question

J

JCarlos

Hi, I searched for my question in these forums, but no one answered it
throughly.

I work for a high school and I have an excel file with grade data for each
student. I want to find out what is the average grade for the male population
and the average grade for the female population for each subject.

1A B C D E
2Jones M 75 86 78
3James M 88 90 67
4Jared F 77 80 85
5John F 65 55 60

B=gender; C=English Grade; D=Math Grade; E=Science Grade

I want average of the Males and then i want to compare that to the averages
of Females. I tried several variations of the countif and daverage formulas,
but i get the #value! result.

End result would be to see in one cell how many males passed each course and
another cell to show their average. and then below that see how many females
passed the same courses.

Thanks in advance for everyone's help.

JCARLOS
 
T

T. Valko

Try this:

A7 = Averages
B7 = M
B8 = F

Enter this formula in C7:

=SUMIF($B$2:$B$5,$B7,C$2:C$5)/COUNTIF($B$2:$B$5,$B7)

Copy across to E7 then down to C8:E8
 
J

JCarlos

Thanks for the quick response. I tried the formula in the file but i get
#div/0 error. What can i try next?

JCarlos
 
D

Dave Peterson

=if(countif($b$2:$b$5,$b7)=0,"No entries",
SUMIF($B$2:$B$5,$B7,C$2:C$5)/COUNTIF($B$2:$B$5,$B7))
 
T

T. Valko

i get #div/0 error

That's a "divide by 0" error. That would mean this part of the formula is
evaluating to 0:

COUNTIF($B$2:$B$5,$B7)

If that evaluates to 0 it means it's not counting any Ms or Fs.

Make sure the formula is referencing the correct range. Make sure the
entries are in fact M and F. Make sure there are no unseen characters in the
referenced range. Like this:

<space>M
M<space>
<space>F<space>
 
J

JCarlos

WOW. it is amazing what one small detail can affect a whole shut. my data
cell had extra spacing. And the numbers were being listed as text. Thanks so
much for your help!

JCarlos
 

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

Top