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).
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.
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.
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.
Check this article to learn how to utilize the COUNTIFS function in Google Sheets.
If you don’t get the solution you are looking for in this article, or you have further questions related to mathematics or statistics, you may find the answers in the following articles.
Go to the following articles to learn basic formulas in Google Sheets.
How to Do Math in Google Sheets for Beginners
ADD Function in Google Sheets: Explained
MINUS Function in Google Sheets: Explained
DIVIDE Function in Google Sheets: Explained
MULTIPLY Function in Google Sheets: Explained
PRODUCT Function in Google Sheets: Explained
How to Use SUM Function in Google Sheets
How to Use SUMPRODUCT Formula in Google Sheets
How to Use MAX Function in Google Sheets
How to Use MIN Function in Google Sheets
How to Use MEDIAN Function in Google Sheets
How to Use AVERAGE Formula in Google Sheets
How to Use MODE Function in Google Sheets
MOD Function in Google Sheets: Explained
Navigate to the pages below to learn how to sum, count, or average numbers with a condition or multiple conditions.
How to Use SUMIF Function in Google Sheets - sum up the numbers that meet a criterion
SUMIFS Function in Google Sheets: Explained - sum up the numbers that meet multiple criteria
How to Use COUNTIFS function in Google Sheets - count the number of cells that meet multiple requirements
AVERAGEIF Function in Google Sheets: Explained - average the figures that meet a standard
AVERAGEIFS Function in Google Sheets: Explained - average the figures that meet multiple standards
AVERAGE.WEIGHTED Function in Google Sheets: Explained - use this formula to calculate the weighted average
MAXIFS Function in Google Sheets: Explained - seek for the maximum value that meets specific criteria
MINIFS Function in Google Sheets: Explained - seek for the minimum value that meets specific criteria
Visit the following post if you are interested in learning how to count the number of specific cells.
COUNT Function in Google Sheets: Explained - count the number of cells containing numeric values (except for blank ones)
COUNTA Function in Google Sheets: Explained - count the number of cells incorporating all types of values containing text and date, except for blank ones
COUNTBLANK Function in Google Sheets: Explained - count the number of blank cells
COUNTUNIQUE Function in Google Sheets: Explained - count the number of unique cells
You can learn about other Google Sheets formulas and tips that are not mentioned here on this page: LiveFlow‘s How to Guides
Are you learning this formula to visualize financial data, build a financial model, or conduct financial analysis? In that case, LiveFlow may help you automate manual workflows and update numbers in real-time. You can access various financial templates on our website, from the simple Income Statement to Multi-Currency Consolidated Financial Statement. You can also customize these templates as you want without breaking the automated data inflow.
To learn more about LiveFlow, book a demo.
Learn how to do this step-by-step in the video below 👇