Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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.

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

Countif filtered data with criteria by Excel functions

Countif filtered data with criteria by splitting data range into multiple sheets and then counting

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. Full Feature Free Trial 60-day!
ad sum count average visible cells only


arrow blue right bubbleCountif filtered data with criteria by adding a help column in Excel

In this article, I will take the following table as 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 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.


arrow blue right bubbleCountif 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.


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.

Easily split a range to multiple sheets based on criteria in a column in Excel
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. Full Feature Free Trial 60-day!
ad split data 0


arrow blue right bubbleRelated Articles


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Soumya K · 1 years ago
    Excellent!!! Now able to filter and countif based on creiteria.
  • To post as a guest, your comment is unpublished.
    Kane · 1 years ago
    How would I add another criteria to the filtered data formula?
    • To post as a guest, your comment is unpublished.
      Tang Kelly · 1 years ago
      Hi 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.
        faj · 1 years ago
        Same with my question. How to count filtered if there are two criteria "Pear" for fruit and "Julie" for salesman?

        Thanks.
        • To post as a guest, your comment is unpublished.
          kelly001 · 1 years ago
          Hi,
          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.
    Bagatelli · 2 years ago
    AWESOME, I used the formula, and it was exactly what I need.
    thanks!!
  • To post as a guest, your comment is unpublished.
    MAY · 2 years ago
    WHERE CAN I DOWNLOAD A TRIAL VERSION OF KUTOOLS FOR MAC?

    REGARDS
  • To post as a guest, your comment is unpublished.
    CS · 2 years ago
    wow, powerful and easy to use. THANKS!