Distinct COUNTIF in Filtered Table

torkaman

New Member
Joined
Nov 15, 2023
Messages
2
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have the below table in Excel with 3 columns. I need to do a distinct count for type 1 and type 2 on the SN column with the filter working. Duplicate values are in Red, they shouldn't be counted two times and just count visible cells in the table.

Screenshot1.png


in the below screenshot, the Class A filter is applied:

Screenshot2.png


in the below screenshot, the Class B filter is applied:

Screenshot3.png
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi & welcome to MrExcel.
For type 1 how about
Excel Formula:
=IFERROR(ROWS(UNIQUE(FILTER(Table2[SN],(Table2[Type]=1)*(BYROW(Table2[Type],LAMBDA(br,SUBTOTAL(3,br)))=1)))),0)
 
Upvote 1
Solution
Hi & welcome to MrExcel.
For type 1 how about
Excel Formula:
=IFERROR(ROWS(UNIQUE(FILTER(Table2[SN],(Table2[Type]=1)*(BYROW(Table2[Type],LAMBDA(br,SUBTOTAL(3,br)))=1)))),0)
You're AWSOME!!!
It works perfectly. I didn't know about the LAMBDA function at all.
I was wondering if you could walk me through the calculation.
 
Upvote 0
The BYROW effectively "loops" through the range one row at a time & the SUBTOTAL returns either 1 or 0 depending on whether that row is visible or not.
 
Upvote 1

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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