Count Distinct Values in Un-Filtered Table across Multiple Columns with 1 Criteria

zero269

Active Member
Joined
Jan 16, 2023
Messages
253
Office Version
  1. 365
Platform
  1. Windows
Hello @Fluff,

This is a follow-up question regarding my earlier thread here, using your following formula:
Excel Formula:
=LET(a,REDUCE("",t_MUs[[Theme A]:[Theme C]],LAMBDA(x,y,VSTACK(x,IF(SUBTOTAL(103,y),y,"")))),ROWS(UNIQUE(FILTER(a,a<>""))))
The filtered results are working great. However, I wanted to create a Summary sheet that can return the same results from the entire table where one criteria is based on a cell value in Column A:
VBA Testing.xlsm
ABCDEF
1Assigned Themes
2DestinctTotal
3P1811
4P2912
5
6IDMUDescriptive CodeTheme ATheme BTheme C
7P133Random DC for MU 3301 - Theme09 - Theme10 - Theme
8P1157Random DC for MU 15701 - Theme03 - Theme11 - Theme
9P1176Random DC for MU 17606 - Theme08 - Theme
10P1191Random DC for MU 19106 - Theme07 - Theme10 - Theme
11P289Random DC for MU 8902 - Theme05 - Theme
12P2148Random DC for MU 14803 - Theme04 - Theme10 - Theme
13P2181Random DC for MU 18106 - Theme09 - Theme11 - Theme
14P2297Random DC for MU 29701 - Theme09 - Theme
Ct. Unique

I thought I could simply add a 2nd criteria where if ID = D3, then it would use that to tally the Destinct values in the range of Themes.

I found this sample code from M$:
Excel Formula:
=FILTER(A5:D20,(C5:C20=H1)*(A5:A20=H2),"")
So I tried modifying your original code from this to that:
Excel Formula:
ROWS(UNIQUE(FILTER(a,a<>"")))
ROWS(UNIQUE(FILTER(a,(a<>"") * (t_Mus[ID] = D3) )))
Obviously that bombed, and I really have no clue on what I'm doing. I'd really appreciate your help on this.

Also, I discovered a similar thread here where you helped someone with a similar request, but it looks like it's only counting the visible rows and not the UNIQUE values in the range of Themes (D:F).
Excel Formula:
=IFERROR(ROWS(UNIQUE(FILTER(t_MUs[[Theme A]:[Theme C]],(t_MUs[ID]=D3)*(BYROW(t_MUs[ID],LAMBDA(br,SUBTOTAL(3,br)))=1)))),0)
Thank you,
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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