Count Unique Values Based on Multiple Criteria

BrettOlbrys1

Board Regular
Joined
May 1, 2018
Messages
139
Office Version
  1. 365
Platform
  1. Windows
Table of Data
Column AColumn BColumn CColumn DColumn EColumn FColumn GColumn HColumn I
EMPLOYEECUSTOMER NAMEDATEQTYTYPEEMPLOYEE CODE 1EMPLOYEE CODE 2EMPLOYEE CODE 3
AngieJoe's Crab Shack4/1/242Validatede12345e37892e43876
GraceTea With Tracy4/13/245Validatede63524e98735e65326
BrettBob the Builder4/19/246Not Validatede93764e36873e67590
JamesTim's Outhouse4/22/243Validatede18943e15235e28464
JamesTim's Outhouse4/22/247Not Validatede18943e15235e28464
BrettBob the Builder5/18/248Validatede93764e36873e67590
AngieJoe's Crab Shack6/3/241Not Validatede12345e37892e43876
JamesTim's Outhouse6/30/249Validatede18943e15235e28464

- Every employee (column A) has three associated employee codes (columns F - H). NOTE: 1,000+ employees
- I have a unique list of employee codes that keyed an order. NOTE: 500,000+ orders

I want a formula that COUNTS the number of UNIQUE ORDERS based on the following criteria:

- between 4/1/24 and 6/30/24
- TYPE = Validated
- matches any of their three employee codes from columns F, G, or H

The output would be the list of employee names and the # of unique orders.

Thanks
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
If I understand your ask correctly, try...
Book1
ABCDEFGH
1EMPLOYEECUSTOMER NAMEDATEQTYTYPEEMPLOYEE CODE 1EMPLOYEE CODE 2EMPLOYEE CODE 3
2AngieJoe's Crab Shack4/1/20242Validatede12345e37892e43876
3GraceTea With Tracy4/13/20245Validatede63524e98735e65326
4BrettBob the Builder4/19/20246Not Validatede93764e36873e67590
5JamesTim's Outhouse4/22/20243Validatede18943e15235e28464
6JamesTim's Outhouse4/22/20247Not Validatede18943e15235e28464
7BrettBob the Builder5/18/20248Validatede93764e36873e67590
8AngieJoe's Crab Shack6/3/20241Not Validatede12345e37892e43876
9JamesTim's Outhouse6/30/20249Validatede18943e15235e28464
10
11
12Result
13e123451
14e152352
15e189432
16e284642
17e368731
18e378921
19e438761
20e635241
21e653261
22e675901
23e937641
24e987351
Sheet6
Cell Formulas
RangeFormula
B13:B24B13=SUM(($F$2:$H$9=A13)*($E$2:$E$9="Validated")*($C$2:$C$9>=DATE(2024,4,1))*($C$2:$C$9<=DATE(2024,6,30)))
 
Upvote 0
Cubist, thanks for your reply, but not exactly. I should have added more detail to what I am asking.

-------------------------------

The list of employee codes that submitted an order is:

e12345
e65326
e36873
e18943
e93764
e43876
e15235

And the output should be:

Angie - 1
Grace - 1
Brett - 1
James - 2


The explanation for these counts is:

Angie - row 2 falls between the dates, is validated, and the employee code used matches one of her codes (column F)
Grace - same explanation as Angie, except Grace's code is in column H
Brett - row 4 does not count because it is "Not Validated," but row 7 counts because all criteria met
James - rows 5 and 9 count because both meet all criteria, but row 6 does not

Does that help clarify what I am asking?
 
Upvote 0
How about this?
Book1
ABCDEFGH
1EMPLOYEECUSTOMER NAMEDATEQTYTYPEEMPLOYEE CODE 1EMPLOYEE CODE 2EMPLOYEE CODE 3
2AngieJoe's Crab Shack453832Validatede12345e37892e43876
3GraceTea With Tracy453955Validatede63524e98735e65326
4BrettBob the Builder454016Not Validatede93764e36873e67590
5JamesTim's Outhouse454043Validatede18943e15235e28464
6JamesTim's Outhouse454047Not Validatede18943e15235e28464
7BrettBob the Builder454308Validatede93764e36873e67590
8AngieJoe's Crab Shack454461Not Validatede12345e37892e43876
9JamesTim's Outhouse454739Validatede18943e15235e28464
10
11
12Order listEmployeeCount
13e12345Angie1
14e65326Grace1
15e36873Brett1
16e18943James2
17e93764
18e43876
19e15235
Sheet3
Cell Formulas
RangeFormula
B13:B16B13=UNIQUE(A2:A9)
C13:C16C13=SUM( BYROW( --ISNUMBER(XMATCH(FILTER($F$2:$H$9,($A$2:$A$9=B13)*($E$2:$E$9="Validated")*($C$2:$C$9>=DATE(2024,4,1))*($C$2:$C$9<=DATE(2024,6,30))),$A$13:$A$19)), LAMBDA(r,--(SUM(r)>0))) )
Dynamic array formulas.
 
Upvote 0
Cubist, thanks again. I believe I messed up when setting up my example and did not explain it correctly, so hopefully you are willing to help once again, and this should be the last time.

I have two data tables ("EMPLOYEE TABLE" and "ORDER TABLE") and the "OUTPUT TABLE"

The EMPLOYEE TABLE is setup like this:
EMPLOYEE NAMEEMPLOYEE IDEMPLOYEE CODE 1EMPLOYEE CODE 2EMPLOYEE CODE 3
AngieAng12345e12345e37892e43876
BrettBre12345e93764e36873e67590
GraceGra12345e63524e98735e65326
JamesJam12345e18943e15235e28464


The ORDER TABLE is setup like this:
CUSTOMER NAMEDATEEMPLOYEE CODE USEDQTYTYPE
Joe's Crab Shack4/1/24e123452Validated
Tea With Tracy4/13/24e675904Validated
Bob the Builder4/19/24e653265Not Validated
Tim's Outhouse4/22/24e189431Validated
Tim's Outhouse4/22/24e152352No Validated
Bob the Builder5/18/24e653263Validated
Joe's Crab Shack6/3/24e378923Not Validated
Tim's Outhouse6/30/24e152353Validated


The OUTPUT TABLE is setup like this:
EMPLOYEE IDORDER COUNT
Ang12345? - result should be 1
Bre12345? - result should be 1
Gra12345? - result should be 1
Jam12345? - result should be 2

I want a formula that COUNTS the number of ORDERS (from the ORDER TABLE) for each employee based on the following criteria:

- between 4/1/24 and 6/30/24
- TYPE = Validated
- matches any of their three employee codes from the EMPLOYEE TABLE
 
Upvote 0
Try:
Book1
ABCDE
1EMPLOYEE NAMEEMPLOYEE IDEMPLOYEE CODE 1EMPLOYEE CODE 2EMPLOYEE CODE 3
2AngieAng12345e12345e37892e43876
3BrettBre12345e93764e36873e67590
4GraceGra12345e63524e98735e65326
5JamesJam12345e18943e15235e28464
6
7CUSTOMER NAMEDATEEMPLOYEE CODE USEDQTYTYPE
8Joe's Crab Shack4/1/24e123452Validated
9Tea With Tracy4/13/24e675904Validated
10Bob the Builder4/19/24e653265Not Validated
11Tim's Outhouse4/22/24e189431Validated
12Tim's Outhouse4/22/24e152352No Validated
13Bob the Builder5/18/24e653263Validated
14Joe's Crab Shack6/3/24e378923Not Validated
15Tim's Outhouse6/30/24e152353Validated
16
174/1/246/30/24
18EMPLOYEE IDORDER COUNT
19Ang123451
20Bre123451
21Gra123451
22Jam123452
Sheet6
Cell Formulas
RangeFormula
B19:B22B19=SUM(COUNTIFS($C$8:$C$15,FILTER($C$2:$E$5,$B$2:$B$5=A19),$E$8:$E$15,"Validated",$B$8:$B$15,">="&$A$17,$B$8:$B$15,"<="&$B$17))
 
Upvote 0
Solution

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