You should be able to solve this using the countifs function which is available in Versions 2007-2013. You don't indicate your Excel version.

Here is a link to syntax.

http://www.techonthenet.com/excel/formulas/countifs.php