COUNTIF function in Excel  

The COUNTIF function in Excel counts the number of cells within a range that meet a given criteria


COUNTIF(range,criteria)  Range is the range of cells from which you want to count cells.  Criteria is the criteria or condition in the form of a number, expression, cell reference, or text that defines which cells will be counted. For example, criteria can be expressed as 200, “200”, “>9000”, “yes”, or a4 in Excel.


You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character. Microsoft Excel provides additional functions that can be used to analyze your data based on a condition.  To calculate a sum based on a string of text or a number within a range, use the SUMIF worksheet function.  To have a formula return one of two values based on a condition, such as a sales bonus based on a specified sales amount, use the IF worksheet function.  To count cells that are empty or not empty, use the COUNTA and COUNTBLANK functions.

Further reading
MS Excel: COUNTIF Function (WS)