COUNTIF() family of functions is amongst the most frequency used family of functions in Excel. Amongst them, the ones most commonly referred are COUNTIF() and COUNTIFS() formulas.
The difference between these two functions is simple: the first one is use to count against single criteria, where the later can count based on multiple criteria.
Let’s begin with the syntax and we will see with example how it works:
This function takes two arguments, first refer to the range where we want to validate a criteria and the second one is criteria itself.
It should be noted that this function works only in columns.
This function can take up to 127 range and criteria and has the following syntax:
Simple counting with COUNTIF()
Referring to the example sheet, you may want to count the number of students in Class I the formula would be:
Similarly the number of students with absences 4 would be:
Example of COUNTIFS()
We can add little complexity in the examples now. What if we want to calculate the number of students in class I with 4 absences? The following formula will do the task:
Answer: 01 – there is only 01 student in class I with 04 absences.
Another example could be to count No. of students in class I and II and from year 2003. The formula would be:
Answer: 02 – only two students meet this requirement.
Note the difference in construction of this formula. In COUNTIF formulas, we cannot execute the logical operator AND in array mode, so we have to add such criteria’s individually.
Example of using logical operators in COUNTIF formula:
There is no difference in the notation used for logical operators in both COUNTIF() and COUNTIFS(). The following examples demonstrate how to use them for both:
Counting Number of students with more then three absences: we will use the logical operator “>” for this requirement. Had we been interested in counting greater then or equal to, we would have used “>=” sign. For now it is:
In the same way, counting number of students with marks in the bracket 50-60, would use:
And lastly, to count number of students that belong to year other then year 2002, will require use of following construction:
Thus with simple formula, we are able to perform a sought of exploratory data analysis to find the features of data.