Reputation: 1053
I have an Excel with 2 columns, each column has a number of 665 Cells. After formatting and find the Duplicate Values, I made a filter so to show me only the duplicate values.
This is a print screen.
In this case I want to find the formula that Count cells from column A or B (after formatting and filter) like it shows in the print screen.
As you can see, I try =COUNTA(A1:A5000)
into a cell from H Column, but doesn't work. Can anyone help me?
Upvotes: 2
Views: 3421
Reputation: 5183
If one need to COUNT the number of visible items in a filtered list, then use the SUBTOTAL function, which automatically ignores rows that are hidden by a filter.
The SUBTOTAL function can perform calculations like COUNT, SUM, MAX, MIN, AVERAGE, PRODUCT and many more (See the table below). It automatically ignores items that are not visible in a filtered list or table. This makes it ideal for showing how many items are visible in a list, the subtotal of visible rows, etc. It also provide control rows hided manually manually.
The solution to your question would be to count the number of non-blank rows visible in Column A and Column B when a filter is active, use:
=SUBTOTAL(103,$A:$A)
Points to remember when you apply SUBTOTAL formula:
Upvotes: 2
Reputation: 197
For Filtered data or you can say Visible cell Sutotal & Countifs can be used, coz both ignores Filtered rows.
=Subtotal (3,A1:D10) =Subtotal (103,A1:D10)
To use Countifs a helper col is required, suppose your Filtered data are in Range A2 to D20, then in E2 write this, =if(B2:B20,"UK", 1,"") Then =COUNTIF (B2 :B20, "UK", E2 :E20, "1")
NB: Change cell address as you need.
Upvotes: -1
Reputation: 9966
Use SubTotal function, which will give you the count of filtered cells only. Also exclude the header from the range, I guess that is not required.
=SUBTOTAL(3,A2:A5000)
Upvotes: 1