GeertD
Board Regular
- Joined
- Dec 22, 2020
- Messages
- 60
- Office Version
- 365
- Platform
- Windows
DISTINCTCOUNTCOLUMNVISIBLECELLS: Count the visible unique elements in a ColumnVector, regardless of their frequencies. Works only on a ColumnVector.
This one is not so trivial. IMO "DistinctCount" should be just another function in the toolbox of the SUBTOTAL function.
This one is not so trivial. IMO "DistinctCount" should be just another function in the toolbox of the SUBTOTAL function.
Excel Formula:
=LAMBDA(Source,LET(
IndexFromZero,SEQUENCE(ROWS(Source),,0),
IsVisible,SUBTOTAL(103,OFFSET(Source,IndexFromZero,0,1)),
VisibleSourceData,IF(IsVisible,Source,""),
COUNTA(UNIQUE(VisibleSourceData))-(1-PRODUCT(IsVisible))
))
DXLR's LAMBDA.LET Library_v00.07.xlsb | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | Filtered Table: | |||||||||||
2 | First Name | Last Name | Score | Country | CountRows: | 20 | ||||||
3 | Alice | Livingstone | 6 | Germany | DistinctCount: | 14 | (First Name) | |||||
4 | Mikayla | Lindberg | 14 | Germany | DistinctCountColumnVisibleCells: | 4 | (First Name) | |||||
7 | Myla | Stukeby | 5 | Germany | ||||||||
9 | Mikayla | Slater | 14 | Mexico | ||||||||
11 | Alice | Johansen | 34 | Mexico | DistinctCount: | 16 | (Score) | |||||
12 | Karl | Tilton | 11 | Mexico | DistinctCountColumnVisibleCells: | 6 | (Score) | |||||
21 | Karl | Ingoldsby | 13 | Germany | ||||||||
23 | ||||||||||||
24 | Unfiltered Table: | |||||||||||
25 | First Name | Last Name | Score | Country | ||||||||
26 | Alice | Livingstone | 6 | Germany | ||||||||
27 | Mikayla | Lindberg | 14 | Germany | ||||||||
28 | Charles | Hurst | 3 | Poland | ||||||||
29 | London | Edmund | 1 | Argentina | ||||||||
30 | Myla | Stukeby | 5 | Germany | ||||||||
31 | Xzavier | Angus | 4 | Romania | ||||||||
32 | Mikayla | Slater | 14 | Mexico | ||||||||
33 | Alice | Poole | 4 | Finland | ||||||||
34 | Alice | Johansen | 34 | Mexico | ||||||||
35 | Karl | Tilton | 11 | Mexico | ||||||||
36 | Mikayla | Bruno | 18 | Finland | ||||||||
37 | Paxton | Chadsey | 3 | USA | ||||||||
38 | Lamont | Lacy | 17 | Slovakia | ||||||||
39 | Jaylan | Forbes | 9 | Egypt | ||||||||
40 | Paxton | Beckley | 15 | Brazil | ||||||||
41 | Alejandra | Donoso | 22 | Spain | ||||||||
42 | Deonte | Astley | 13 | Thailand | ||||||||
43 | Alfred | Sarisbury | 27 | Argentina | ||||||||
44 | Karl | Ingoldsby | 13 | Germany | ||||||||
45 | Rylan | Hasbrouck | 33 | Indonesia | ||||||||
46 | ||||||||||||
Sandbox_Mr.Excel |
Cell Formulas | ||
---|---|---|
Range | Formula | |
H2 | H2 | =COUNTA(tblTop[First Name]) |
H3 | H3 | =DistinctCount(tblTop[First Name]) |
H4 | H4 | =DistinctCountColumnVisibleCells(tblTop[First Name]) |
H11 | H11 | =DistinctCount(tblTop[Score]) |
H12 | H12 | =DistinctCountColumnVisibleCells(tblTop[Score]) |
Upvote
0