Count all nonblanks in a column, but exclude duplicates and hidden rows.

Telefonstolpe

Board Regular
Joined
Sep 25, 2014
Messages
55
Hi,

I´m looking for a function that counts all nonblanks in a column, but excludes duplicates and hidden rows.
Been trying for a while to solve this problem with sumproduct- and subtotal functions, but I can't get it to work in the end. I realized it was more difficult than it seemed.

Example of what I'm trying to do:

A
1Apple
2Apple
3Pear
4Pear
5Pear
6
7Orange
8Orange
9Orange

<tbody>
</tbody>

In this example red-marked rows number 3, 4, 5 and 8 are hidden
The function I'm looking for should in this case return "2", one apple plus one orange, and thus exclude duplicates, hidden rows and blanks.

Thanks in advance!
/Chris
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try the following formula, which needs to be confirmed with CONTROL+SHIFT+ENTER...

=SUM(IF(FREQUENCY(IF(SUBTOTAL(103,OFFSET(A1:A9,ROW(A1:A9)-ROW(A1),0,1))>0,MATCH("~"&A1:A9,A1:A9&"",0)),ROW(A1:A9)-ROW(A1)+1)>0,1))

Note that rows hidden via the AutoFilter are also taken into consideration.

Hope this helps!
 
Upvote 0
Thank you very much!

Works perfectly!

It's gonna take me a while to figure out the logic behind this function :)

Thanks again!

/Chris
 
Upvote 0

Forum statistics

Threads
1,216,128
Messages
6,129,030
Members
449,482
Latest member
al mugheen

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