How to Countif filtered data/list with criteria in Excel?
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.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
In this article, I will take the following table as example. Here, I have filtered out Julie and Nicole in the Salesman column.
This method will guide you to add an extra help column, and then you can apply the COUNTIFS function to count the filtered data in Excel. (Note: This method requires you have filtered your original table before following steps.)
1. Find a blank cell besides the original filtered table, says Cell G2, enter =IF(B2="Pear",1,""), and then drag the Fill Handle to the range you need. (Note: In the formula of =IF(B2="Pear",1,""), B2 is the cell you will count, and the "Pear" is the criteria you will count by.)
Now a help 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 of =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.
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.
|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
(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.
You are guest
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 3 months agoThanks a lot. It's really excellent! Thanks once a lot.
- To post as a guest, your comment is unpublished.· 2 years agoExcellent!!! Now able to filter and countif based on creiteria.
- To post as a guest, your comment is unpublished.· 2 years agoHow would I add another criteria to the filtered data formula?
- To post as a guest, your comment is unpublished.· 2 years agoHi Kane,
Which kind of filter criteria do you want to add? More detailed information can help we understand and solve your problem quicker.
- To post as a guest, your comment is unpublished.· 2 years agoSame with my question. How to count filtered if there are two criteria "Pear" for fruit and "Julie" for salesman?
- To post as a guest, your comment is unpublished.· 2 years agoHi,
In this situation, I guess a helper column I introduced in the first method may be easier to count.
- To post as a guest, your comment is unpublished.· 3 years agoAWESOME, I used the formula, and it was exactly what I need.
- To post as a guest, your comment is unpublished.· 3 years agoWHERE CAN I DOWNLOAD A TRIAL VERSION OF KUTOOLS FOR MAC?
- To post as a guest, your comment is unpublished.· 3 years agowow, powerful and easy to use. THANKS!