Go Back

Summary count of non-blank categories

Excel allows a user to create a summary count of non-blank categories using the COUNTIFS function. This step by step tutorial will assist all levels of Excel users in creating a summary count of non-blank categories.

Figure 1. The result of the COUNTIFS function

Syntax of the COUNTIFS Formula

The generic formula for the COUNTIFS function is:

=COUNTIFS(criteria_range1, criteria1, criteria_range2, criteria2, ... )

The parameters of the COUNTIFS function are:

  • criteria_range1, criteria_range2 – ranges where we want to apply our criteria
  • criteria1, criteria2 – a criteria in criteria ranges which we want to count.

Setting up Our Data for the COUNTIFS Function

Figure 2. Data that we will use in the COUNTIFS example

In the first data table, we have 3 columns: “Product” (column B), “Date” (column C) and “Sales Amount” (column D). In the summary table (F2:G5), we want to count days with sales for each product.

Create a Summary Count of Non-blank Categories with the COUNTIFS table

In our example, we want to count for each product days with sales (where sales amount is not blank). Therefore, the first criteria will be a product and the second sales amount different than blank.

The formula looks like:

=COUNTIFS($B$3:$B$20, F3, $D$3:$D$20, "<>")

The parameter criteria_range1 is $B$3:$B$20 and the criteria1 is in the cell F3. The parameter criteria_range2 is $D$3:$D$20 and the criteria2 is “<>”.

We must fix both criteria ranges, as they are not changing when we copy the formula across the cells. For criteria1 we must fix the column, as only the row is changing.

To apply the COUNTIFS function, we need to follow these steps:

  • Select cell G3 and click on it
  • Insert the formula: =COUNTIFS($B$3:$B$20, F3, $D$3:$D$20, "<>")
  • Press enter
  • Drag the formula down to the other cells in the row by clicking and dragging the little “+” icon at the bottom-right of the cell to the right.

Figure 3. Creating the summary count of non-blank categories with the COUNTIFS

For Product A, there are 3 days with Sales amount (1/7/2019, 1/9/2019 and 1/12/2019). Therefore, the result in the cell G3 is 3.

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

I need to update a formula on the "Summary Tab 2" in cell E3. The formula currently totals non-blank cells on two rows on the "Tracker" tab with the condition that "Amy Perkins" is in the 3rd row. Instead of counting non-blank cells, I want to count cells with dates in between or equal to 1/1/2018 and 6/30/2018 (still with the condition of "Amy Perkins" being in the third row.
Solved by F. B. in 30 mins
Ive attached an Excel file I use. Ive filled all non-blank cells with red. The numbers in column A are the number of blank cells from column B to the last non-blank cell. Im wondering if theres a way to get Excel to calculate this number for me automatically. The trick is that I dont want to count the total number blank cells in the row, just the number up to the non-blank cell. If Excel could tell the me the column header of the first assignment skipped(or the last two or three skipped) as well that would be great. Thanks.
Solved by E. C. in 14 mins
I have a formula that counts non blank cells in Cell A2 now i want to create another array formula where in i want to use this count as one of the reference i.e. $F$1:$F$(value in cell A2). Please advice?
Solved by B. C. in 19 mins

Leave a Comment