How to Use COUNTIF Function in Google Sheets
In this article, you will learn how to count the number of cells with the COUNTIF function. This formula is beneficial when you want to count the number of cells that meet a specific condition (e.g., specific name, figure, and date).
How to use the COUNTIF formula in Googles Sheets
- Type “=COUNTIF(” or go to “Insert” in the menu bar ➝ “Function” ➝ ”Math” ➝ ”COUNTIF”.
- Select a set of data in which you want to find the number of cells that match a particular condition.
- After adding a comma, you need to choose a cell containing the specific standard or input the criterion directly.
- Press the “Enter” key.
The generic formula is as follows.
Range: This is the field in which the formula looks for items that match the criterion.
Criterion: This is the standard you apply.
See some examples below. Assume you are a finance manager trying to analyze sales records shown in the picture below. You want to know the number of deals by Sales Person, Lot Size, and Record Date.
(i) The number of deals by Sales Person
The first thing you need to do is to identify all items in a list without any duplications or lacks. Make sure you list all names in the original data in your summary table. The range of the formula is C4:C13.
As stated above, the criterion, whatever it is, can be input by cell reference or manual input. We are showing examples of manual input in the first two formulas, ones for Anna and Bryan, and cell reference in the third and fourth formulas, ones for Charlie and David. In cases of cell references, the referred cells are next to the cells that contain the COUNTIF formulas.
We do the same for the other two examples (ii) and (iii). However, note that we highly recommend you use cell references as much as possible and you make the format of formulas (e.g., manual input or cell reference for a criterion) consistent.
Another important thing you should bear in mind is you calculate the total figure of computed values and make sure it matches the number of items in the original data. In this example, the total figure should be 10 as the original data table contains ten deals.
(ii) The number of deals by Lot Size
This example shows how to incorporate a number as a criterion in the COUNTIF formula.
(iii) The number of deals by Record Date
In the third example, you can see how to include a date as a criterion in the formula.
If you want to learn how to manually input text, number, and date in a formula, as a range or a criterion, check this article.
How do I use COUNTIF in multiple Google Sheets?
You can contain a set of data on a different worksheet in the COUNTIF formula. However, we recommend you gather the necessary information on a sheet by using the cell reference or copy&paste function so that you can avoid incorrect references and little visibility of data resources.
If you still need to know how to refer to a series of data in a different sheet in a formula, check this article: How to Reference Another Sheet in Google Sheets
Can you do the COUNTIF with multiple criteria Google Sheets?
Yes, you can. For instance, if you want to count the number of cells which meet criterion A or criterion B in a set of data (range C), you can find the answer by adding up the results from two separate COUNTIF formulas like “=COUNTIF(range C, criterion A)+COUNTIF(range C, criterion B)”.
However, if you would like to seek the number of cells that meet both criteria A and B, you should use the COUNTIFS function instead of the COUNTIF formula.
How do I use the COUNTIFS in Google Sheets?
Check this article to learn how to utilize the COUNTIFS function in Google Sheets.