Forum Discussion
ParthaPratimGhosh
Jun 05, 2024Copper Contributor
Counting unique records with multiple condition in excel
Hi Experts, Seeking advise on how to find unique count of records using date and multiple conditions. My Raw data is below: Date Name Dept Location Status 2024-02-01 King Finance Cana...
Lorenzo
Jun 05, 2024Silver Contributor
365 variant:
=LET(
_headers, {"Dept","Count"},
IF(COUNTA(I4:I6) < 3, _headers,
LET(
pre_filter, FILTER(Table1[[Name]:[Dept]], (Table1[Date]>=I4) * (Table1[Date]<=I5) * (Table1[Status]=I6), NA()),
col_dept, CHOOSECOLS(pre_filter, 2),
_depts, SORT(UNIQUE(Table1[Dept])),
CntRws, LAMBDA(dept,
ROWS( UNIQUE( FILTER(pre_filter, col_dept = dept, NA()) ) )
),
VSTACK(
_headers,
HSTACK(_depts, IFNA(BYROW(_depts, CntRws), 0))
)
)
)
)ParthaPratimGhosh
Jun 05, 2024Copper Contributor
Thank you for this. It is working perfectly.