Skip to main content

How to Countif filtered data/list with criteria in Excel?

Author: Kelly Last Modified: 2022-10-09

You may notice that no matter you have filtered your table or not, the COUNTIF function will ignore the filtering and return a fixed value. In some cases, you are required to count filtered data with a specific criteria, so how to get it done? In this article, I will introduce a couple of ways to Countif filtered data/list in Excel quickly.


Countif filtered data with criteria by adding a helper column in Excel

In this article, I will take the following table as an example. Here, I have filtered out Julie and Nicole in the Salesman column.

Original data:

Filtered data:

This method will guide you to add an extra helper column, and then you can apply the COUNTIFS function to count the filtered data in Excel. (Note: This method requires you to filter your original table before following the steps below.)

1. Find a blank cell besides the original filtered table, say the cell G2, enter =IF(B2="Pear",1,""), and then drag the Fill Handle to the range you need. (Note: In the formula =IF(B2="Pear",1,""), B2 is the cell you will count, and the "Pear" is the criteria you will count by.)

Now a helper column is added besides original filtered table. The "1" indicates it's pear in the Column B, while blank hints it's not pear in Column B.

2. Find a blank cell and enter the formula =COUNTIFS(B2:B18,"Pear",G2:G18,"1"), and press the Enter key. (Note: In the formula =COUNTIFS(B2:B18,"Pear",G2:G18,"1"), the B2:B18 and G2:G18 are ranges you will count, and "Pear" and "1" are criteria you will count by.)

Now you will get the count number at once. Please note that the count number will not change if you disable filtering or change filtering.

Sum/Count/Average visible cells only in a specified range with ignoring hidden or filtered cells/rows/columns

The normally SUM/Count/Average function will count all cells in the specified range on matter cells are hidden/filtered or not. While the Subtotal function can only sum/count/average with ignoring hidden rows. However, Kutools for Excel SUMVISIBLE/COUNTVISIBLE/AVERAGEVISIBLE functions will easily calculate the specified range with ignoring any hidden cells, rows, or columns.


ad sum count average visible cells only

Countif filtered data with criteria by Excel functions

If you want the count number changes as the filter changes, you can apply the SUMPRODUCT functions in Excel as following:
In a blank cell enter the formula =SUMPRODUCT(SUBTOTAL(3,OFFSET(B2:B18,ROW(B2:B18)-MIN(ROW(B2:B18)),,1)),ISNUMBER(SEARCH("Pear",B2:B18))+0), and press the Enter key.

note ribbon Formula is too complicated to remember? Save the formula as an Auto Text entry for reusing with only one click in future!
Read more…     Free trial

Notes:
(1) In the above formula, B2:B18 is the range you will count, and "Pear" is the criteria you will count by.
(2) The returning value will change when you disable filtering or filtering changes.

Easily split a range to multiple sheets based on criteria in a column in Excel

Comparing to complex array formulas, it may be much easier to save all filtered records into a new worksheet, and then apply the Count function to count the filtered data range or list.

Kutools for Excel’s Split Data utility can help Excel users easily split a range to multiple worksheets based on criteria in one column of original range.


ad split data 0


Related Articles

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
When i change the filter, the count will change automatically ?
This comment was minimized by the moderator on the site
Is there a way to modify the formula for filtered data if I'm wanting to gather the information but for both pears and oranges?
This comment was minimized by the moderator on the site
Hi there,

With the first method, you can enter the following formula in the helper column: =IF(B2="Pear",1,IF(B2="Orange",1,"")
And then use the following formula to get the total count: =COUNTIFS(G2:G18,1)

Amanda
This comment was minimized by the moderator on the site
Sweet, this works!
This comment was minimized by the moderator on the site
hey i want to count value greater than 1 but with filtered visible data, can you help?
This comment was minimized by the moderator on the site
Hi,
I need help calculating the percentage of PP students (column F) with SEN (column E) who have s or b (column G)

Here's the formula I've been trying to use but it's not working.

Any help/advice appreciated.

=SUMPRODUCT(ISNUMBER(MATCH($E$2:$E$30,{"<>"},0))*ISNUMBER(MATCH($F$2:$F$30,{"<>"},0))*ISNUMBER(MATCH($T$2:$T$30,{"s","b"},0)))/SUMPRODUCT(ISNUMBER(MATCH($E$2:$E$30,{"<>"},0))*ISNUMBER(MATCH($F$2:$F$30,{"<>"},0)))

Claire
This comment was minimized by the moderator on the site
How about if “pear” needs to be a number value “<0” what do you use instead of (search?
This comment was minimized by the moderator on the site
Hi Sib,
You can apply the COUNTIFS functions to count items with two or more criteria. In the case of this webpage, you can use the formulas =COUNTIFS(B2:B21,"Pear",C2:C21,"<0") to count the pears whose amount is less than 0.
However, the count result is solid and won’t change when you change the filter.
This comment was minimized by the moderator on the site
Thanks a lot. It's really excellent! Thanks once a lot.
This comment was minimized by the moderator on the site
Excellent!!! Now able to filter and countif based on creiteria.
This comment was minimized by the moderator on the site
How would I add another criteria to the filtered data formula?
This comment was minimized by the moderator on the site
Hi Kane,
Which kind of filter criteria do you want to add? More detailed information can help we understand and solve your problem quicker.
This comment was minimized by the moderator on the site
Same with my question. How to count filtered if there are two criteria "Pear" for fruit and "Julie" for salesman?

Thanks.
This comment was minimized by the moderator on the site
Hi,
In this situation, I guess a helper column I introduced in the first method may be easier to count.
This comment was minimized by the moderator on the site
AWESOME, I used the formula, and it was exactly what I need. thanks!!
There are no comments posted here yet
Load More
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations