Results within results

gberg

Board Regular
Joined
Jul 16, 2014
Messages
205
Office Version
  1. 365
Platform
  1. Windows
I have a table that I want to count the unique values based on; "Year-Month", "Type" and "District". Within those results I want to only count the unique "Job Numbers".

This table is a simplified version of the larger table. The "Year-Month", "Type" and "District" all meet the criteria I want, in the real table these values will not always match.

Year - MonthJob NumberTypeDistrict
2024 - 03 March71D0097CON71
2024 - 01 January71D0099CON71
2024 - 01 January71D0099CON71
2024 - 01 January71D0102CON71
2024 - 04 April71D0102CON71
2024 - 01 January71D0103CON71
2024 - 01 January71D0105CON71
2024 - 01 January71D0106CON71
2024 - 01 January71D0106CON71
2024 - 01 January71D0107CON71
2024 - 01 January71D0107CON71
2024 - 01 January71D0108CON71
2024 - 04 April71D0108CON71
13​
Unique Job #'s
7​


All 13 items match the criteria for "Year" = 2024, "Type" = CON and "District" = 71, I have the following formula to look for this combination:

VBA Code:
SUMPRODUCT(--(C2:C14="CON"),--(TEXT(D2:D14,0)="71"),--(LEFT(A2:A14,4)="2024"))

Within these results there are 7 unique Job Numbers. I want to have a formula that looks for the "Year", "Type" and "District" but then looks for the unique Job Numbers within these results. I would need this all as one formula. So the final value I am looking for would be 7 from the table above
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
How about:

Excel Formula:
=ROWS(UNIQUE(FILTER(B2:B14,IFERROR(MAP(A2:A14,C2:C14,D2:D14,LAMBDA(a,b,c,AND(SEARCH(2024,a),b="CON",c=71))),FALSE)=TRUE)))

It seems there are 8 unique IDs based on your criteria...
 
Upvote 0
Another option
Fluff.xlsm
ABCDEF
1Year - MonthJob NumberTypeDistrict
22024 - 03 March71D0097CON718
32024 - 01 January71D0099CON71
42024 - 01 January71D0099CON71
52024 - 01 January71D0102CON71
62024 - 04 April71D0102CON71
72024 - 01 January71D0103CON71
82024 - 01 January71D0105CON71
92024 - 01 January71D0106CON71
102024 - 01 January71D0106CON71
112024 - 01 January71D0107CON71
122024 - 01 January71D0107CON71
132024 - 01 January71D0108CON71
142024 - 04 April71D0108CON71
Sheet6
Cell Formulas
RangeFormula
F2F2=ROWS(UNIQUE(FILTER(B2:B100,(LEFT(A2:A100,4)="2024")*(C2:C100="con")*(D2:D100=71))))
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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