Count unique values with a couple of criteria's

Cantrecallmyusername

Board Regular
Joined
May 24, 2021
Messages
50
Office Version
  1. 365
Platform
  1. Windows
Hi there,
I have some data which I want to count unique values based on the values in a specific column and it meets 2 other criteria.
The high level is that I want to count how many unique terms are in my raw data tab if they are marked approved in a column and belong to a dept.

  1. Term is in Column A on Raw Data Tab
  2. Status is column B on Raw Data Tab
  3. Dept is in column S on Raw Data Tab

Status can be approved or Under Review and I have these in cellsT1 and T2 on my Stats Tab
The dept names are listed in cells B4:BB10 on the stats tab

I have tried the following formula but needs the second criteria passed into also (the dept names) using Ctrl + Shift

Excel Formula:
=SUM(IF(T1='Raw Data'!B:B, 1/(COUNTIFS('Raw Data'!B:B, T1, 'Raw Data'!A:A,'Raw Data'!A:A)), 0))

Any help would be greatly appreciated.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
365 makes quick work of it:
MrExcelPlayground12.xlsx
ABCDEFGHIJKLMNOPQRST
1TermStatusDept
2AApprovedX3
3BUnder ReviewX
4CApprovedY
5BApprovedY
6CApprovedZ
7EUnder ReviewZ
8AUnder ReviewX
9BApprovedX
10CApprovedX
11DUnder ReviewX
12EApprovedY
13AApprovedX
Sheet28
Cell Formulas
RangeFormula
T2T2=ROWS(UNIQUE(FILTER(A2:A13,(B2:B13="Approved")*(S2:S13="X"))))
 
Upvote 0
365 makes quick work of it:
MrExcelPlayground12.xlsx
ABCDEFGHIJKLMNOPQRST
1TermStatusDept
2AApprovedX3
3BUnder ReviewX
4CApprovedY
5BApprovedY
6CApprovedZ
7EUnder ReviewZ
8AUnder ReviewX
9BApprovedX
10CApprovedX
11DUnder ReviewX
12EApprovedY
13AApprovedX
Sheet28
Cell Formulas
RangeFormula
T2T2=ROWS(UNIQUE(FILTER(A2:A13,(B2:B13="Approved")*(S2:S13="X"))))
Thanks for this however I dont have 365 on my PC for this to work - I am getting the "#CALC!" error with this , any similar function/formula that would work for me?
 
Upvote 0
Maybe something like this.

Book2
ABRSTU
1TermStatusDeptApproved3
2AApprovedXUnder Review3
3BUnder ReviewX
4CApprovedY
5BApprovedY
6CApprovedZ
7EUnder ReviewZ
8AUnder ReviewX
9BApprovedX
10CApprovedX
11DUnder ReviewX
12EApprovedY
13AApprovedX
Sheet1
Cell Formulas
RangeFormula
U1:U2U1=SUM(IF(FREQUENCY(IF($B$2:$B$13<>"",IF($B$2:$B$13=T1,IF($S$2:$S$13="x",MATCH($A$2:$A$13&"/"&$B$2:$B$13,$A$2:$A$13&"/"&$B$2:$B$13,0)))),ROW($A$2:$A$13)-ROW($A$2)+1),1))
 
Upvote 0
Maybe something like this.

Book2
ABRSTU
1TermStatusDeptApproved3
2AApprovedXUnder Review3
3BUnder ReviewX
4CApprovedY
5BApprovedY
6CApprovedZ
7EUnder ReviewZ
8AUnder ReviewX
9BApprovedX
10CApprovedX
11DUnder ReviewX
12EApprovedY
13AApprovedX
Sheet1
Cell Formulas
RangeFormula
U1:U2U1=SUM(IF(FREQUENCY(IF($B$2:$B$13<>"",IF($B$2:$B$13=T1,IF($S$2:$S$13="x",MATCH($A$2:$A$13&"/"&$B$2:$B$13,$A$2:$A$13&"/"&$B$2:$B$13,0)))),ROW($A$2:$A$13)-ROW($A$2)+1),1))
Hi,
Thanks for this - I have tried the formula provided in my spreadsheet where I have the source data on a tab called Raw Data but it returns 0
X in your formula is cell B4 in my sheet. Any ideas on why this might not be working?

Excel Formula:
=SUM(IF(FREQUENCY(IF('Raw Data'!B:B<>"",IF('Raw Data'!B:B=$T$1,IF('Raw Data'!S:S=B4,MATCH('Raw Data'!A:A&"/"&'Raw Data'!B:B,'Raw Data'!A:A&"/"&'Raw Data'!B:B,0)))),ROW('Raw Data'!A:A)-ROW('Raw Data'!A2)+1),1))
 
Upvote 0
Hi,
Thanks for this - I have tried the formula provided in my spreadsheet where I have the source data on a tab called Raw Data but it returns 0
X in your formula is cell B4 in my sheet. Any ideas on why this might not be working?

Excel Formula:
=SUM(IF(FREQUENCY(IF('Raw Data'!B:B<>"",IF('Raw Data'!B:B=$T$1,IF('Raw Data'!S:S=B4,MATCH('Raw Data'!A:A&"/"&'Raw Data'!B:B,'Raw Data'!A:A&"/"&'Raw Data'!B:B,0)))),ROW('Raw Data'!A:A)-ROW('Raw Data'!A2)+1),1))
Ignore I have figured it out, thank you.
 
Upvote 0

Forum statistics

Threads
1,214,872
Messages
6,122,026
Members
449,061
Latest member
TheRealJoaquin

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