Count unique values for filtered column

drom

Well-known Member
Joined
Mar 20, 2005
Messages
528
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and Thanks in advance!

-If I wanna count the unique values in a table column, I can Use:
  • =SUMPRODUCT(1/COUNTIF(rcTableColumn, rcTableColumn))
    • where rcTableColumn is a named range for this table column
But I would like to use the SumProduct to count the unique values for the visible cells only.

I am using a column where If the row is hidden the value =0 so In this column I can use this formula:
  • =SUMPRODUCT(--(TbRowData[RowVisible]<>""))
    • If the cell are visible this column puts "YES")
    • To count how many cells are visible in a filtered table
How can I combine both SumProduct formulas, kind of:
  • =SUMPRODUCT(--(TbRowData[RowVisible]<>""),--(1/COUNTIF(rcTableColumn;rc,TableColumn)))
    • But tis formula does not work

I do not want to Use UDF, Not Macros
I am not using 365
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try this formula as shown in B15 - note that this is an array formula so you need to enter it using CTRL+SHIFT+ENTER, not just ENTER. I think it's easier to understand as ranges but you can convert to named ranges. Note also that there are 12 rows in A2:A13 (inclusive) and that we start the array processing at A1 since we are offsetting a minimum of 1 row.

Regards

Murray

Book1
AB
1NumberFilter
21YES
32YES
43YES
54YES
61YES
72YES
83YES
94YES
101YES
112
123
134
14
15Unique values in col A4
PhoneList
Cell Formulas
RangeFormula
B15B15=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(A1,ROW(1:12),0)),MATCH(A2:A13,A2:A13,0)),MATCH(A2:A13,A2:A13,0)),1))
Press CTRL+SHIFT+ENTER to enter array formulas.


NumberFilter
2
3
4
Unique values in col A3
 
Upvote 0
Solution

Forum statistics

Threads
1,215,214
Messages
6,123,664
Members
449,114
Latest member
aides

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