How to count visible rows and exclude zero?

honkin

Active Member
Joined
Mar 20, 2012
Messages
385
Office Version
  1. 2016
Platform
  1. MacOS
I have some code which counts the number of selections in a column, but I would like it to exclude 0. it uses subtotal 103 so as to only count visible cells

Here is the code

=SUBTOTAL(103,AA16:AA1048561)

So how can I make this formula exclude all 0 in the column? I tried this, but it was not correct =SUBTOTAL(103,AA16:AA1048561,"<>0")

cheers
 
@JEC - FYI - the "-COUNTIF(A2:A10;0)" doesn't distinguish between filtered and unfiltered zeroes.
So if there are any zeroes in the hidden rows it will deduct more zeroes that it should.
That's nice to know Alex. In the end, I only tested it on unfiltered and it naturally matched the result with your solution. Thanks for the heads up. cheers
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,223,914
Messages
6,175,351
Members
452,638
Latest member
Oluwabukunmi

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