Back to product guides

Google Sheets Formulas

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).

- 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.

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.

Are you learning this formula to process financial data, build a financial model, or conduct financial analysis? If so, LiveFlow may help you to automate manual workflows and keep numbers updated in real time. For instance, you can easily compare your Budget versus Actual without any manual work. Furthermore, you can access more than fifty templates here, from the simple Income Statement and Operational KPI templates to Multi-Currency Consolidated Income Statement, Balance Sheet, and Cash Flow templates. 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 👇

Our team of real people are here to help you any time between 9am and 10pm GMT.

Email us at: founders@liveflow.io

Call us at +1 (415) 650-1711