# Count & Compare - help!

#### SEL

##### New Member
Hi, I need to count the number of male students and the number of female students who are predicted to get the same grade level.

Column A = Student name
Column B = Male or Female (M/F)
Column C = Predicted Grade (single number e.g 2)
Column D = Target Grade (single number e.g 3)

A1 = John
B1 = M
C1 = 2
D1 = 3

A2 = Mary
B2 = F
C2 = 2
D2 = 3

G1 = Female Predicted Grade 2
H1 = Male Predicted Grade 2
G2 = Female Predicted Grade 3
H2 = Male Predicted Grade 3

How do I tell Excel to compare two cells and if it meets a requirement to then count and then put in another cell?

E.g If B2 = F and C2 = 2 then count and put in G1 and then continue checking & comparing the rest of column B & C.

Can anyone help me?!?!
Thanks, Sandra

### Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

#### NBVC

##### Well-known Member
Something like this?
Book1
ABCDEFGH
2JohnM23Female20
3MaryF23Male10
4LizF23
Sheet1

G1 contains =SUMPRODUCT(--(\$B\$2:\$B\$101="F"),--(\$C\$2:\$C\$101=2))
G2 contains =SUMPRODUCT(--(\$B\$2:\$B\$101="M"),--(\$C\$2:\$C\$101=2))
H1 contains =SUMPRODUCT(--(\$B\$2:\$B\$101="F"),--(\$C\$2:\$C\$101=3))
H2 contains =SUMPRODUCT(--(\$B\$2:\$B\$101="M"),--(\$C\$2:\$C\$101=3))

#### SEL

##### New Member
Thank you Wow! Thanks you are a genius. I have put this in the spreadsheet and told the teacher, there is one happier teacher in the world so maybe her students will have an easy afternoon!

Replies
0
Views
92
Replies
10
Views
296
Replies
9
Views
223
Replies
9
Views
317
Replies
1
Views
66