Explanation of the COUNTIF function
The COUNTIF function is asking for 2 arguments as shown below:
Example data used to explain how the COUNTIF function works
- 3 different colors
- each color has 3 different sizes
- 2 locations (color coded to easily distinguish them apart)
- Quantity sold at each of the 2 locations
1. range (1st argument)
The COUNTIF function will use the range (or ‘criteria range’) that you provide to find a match against your criteria. The range that you provide can be either an entire column or a range.
2. criteria (2nd argument)
This is the criteria that you want to look for in the range (or criteria range) which will also be used to return the result.
- if any values in the range you provide do not match your criteria –> those values will be ignored by the COUNTIF function
- if the values in the range you provide match your criteria –> those values will get counted by the COUNTIF function
How does the COUNTIF function work?
You should use the COUNTIF function when you need the count of a set of values only for a certain criteria. The COUNTIF function will count the number of times your criteria is found within the range you provide.
The function starts with the 1st value in the range (or criteria range) and checks to see if it matches the criteria you provided.
- if yes, it includes the value into the final count
- if not, it ignores the value
It does this evaluation for every value within your range or (criteria range) and returns a count of how many times your criteria was found.
Keep in mind the COUNTIF function syntax when reading the Formulas shown below… =COUNTIF(range,criteria)
Go back to Excel Tutorials.