Count Visible Cells

DougStroud

Well-known Member
Joined
Aug 16, 2005
Messages
2,976
Office Version
  1. 365
Platform
  1. MacOS
I need to count the number of visible cells with data after filtering.

Example- Range is: A2-A66, Filter out array of 15 cells. How many cells/rows are left?

I tried the "COUNT" formula, but this is not correct.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
subtotal() ignores filtered cells, so

=subtotal(3,a2:a66)

No luck. In column "A" I have differing values. When I tried changing all the values to "1" and try the formula suggested, I just got the value "1", not say 45 for the total visible cells in the range a2:a66
 
Upvote 0
'3' is the argument that tells the subtotal() which function to use over the range, in this case counta(). (For example, 1 is average, 4 is max etc - check out the help file entry for the details)
 
Last edited:
Upvote 0
'3' is the argument that tells the subtotal() which function to use over the range, in this case counta(). (For example, 1 is average, 4 is max etc - check out the help file entry for the details)

Thank you!
 
Upvote 0
subtotal() ignores filtered cells, so

=subtotal(3,a2:a66)

What about combining the two formulas: SUBTOTAL(3,F2:f66) and =SUMPRODUCT(--($F$2:$F$66="b")) to return only the visible cells w/ the value "b"?

I tried this: subtotal(3(SUMPRODUCT(--($F$2:$F$66="b"))), =SUBTOTAL(3,F2:F66(SUMPRODUCT(--($F$2:$F$66="b"))))

(They both failed)
 
Last edited:
Upvote 0
You're on the right track.

The below will count the number of cells in the range f2:f66 that (a) are visible and (b) contain the value 'b':

=SUMPRODUCT(SUBTOTAL(3,OFFSET(F2:F66,ROW(F2:F66)-ROW(F2),0,1,1)),--(F2:F66="b"))
 
Upvote 0
You're on the right track.

The below will count the number of cells in the range f2:f66 that (a) are visible and (b) contain the value 'b':

=SUMPRODUCT(SUBTOTAL(3,OFFSET(F2:F66,ROW(F2:F66)-ROW(F2),0,1,1)),--(F2:F66="b"))

Thank you so much... I don't know about being on the right track... at all-- but thank you!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top