Doing a countif formula not counting empty or hidden fields

crlsmiro

New Member
Joined
Feb 19, 2010
Messages
4
Im working on a spreadsheet where I need to count the occurrences of a specific number in a column (Example)
A
0
1
0
0
2

0

As I filter other columns I want to be able to know how many 0's, how many 1's and how many 2's (not including the hidden or blank ones). I know I can't use subtotal. Any help will be appreciated.









0





0
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Im working on a spreadsheet where I need to count the occurrences of a specific number in a column (Example)
A
0
1
0
0
2

0

As I filter other columns I want to be able to know how many 0's, how many 1's and how many 2's (not including the hidden or blank ones). I know I can't use subtotal. Any help will be appreciated.









0





0
To count the number of 1s in the range B5:B20 of a filtered (or unfiltered) list:

=SUMPRODUCT(SUBTOTAL(3,OFFSET(B5,ROW(B5:B20)-ROW(B5),0)),--(B5:B20=1))
 
Upvote 0
Why not use SUBTOTAL? It's the only way I know how to do it. Try this and just change all of the references to A:A to either your column letter or your range such as A1:A21. Should still work.

=SUMPRODUCT(SUBTOTAL(102,OFFSET(A:A,ROW(A:A)-MIN(ROW(A:A)),0,1)),--(A:A=2))

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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