Count Unique Alphanumeric numbers in a column with a date range criteria (not using array)

bethlc

New Member
Joined
Jan 28, 2020
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
I'm wanting to count unique alphanumeric value from column 'user ID', but I'm wanting to include a criteria of date range where column 'Date' is between 12/12/2019 - 18/12/2019. I've tried numerous array formula's but they're all too slow so i'm wanting to know if it's possible to do it without an array formula?

If possible, I also want to do it with more than one criteria, e.g unique User ID's with a date range and where 'Did you make a change?' is 'Y'.

Member DateUser IDDid you make a change?
Louise 12/12/201912323324435436dfdfgergY
Louise 12/11/2019dgf5542342344323432432Y
Louise 12/11/2019dgf5542342344323432432Y
Louise 12/11/2019dgf5542342344323432432Y
Louise 12/11/2019dgf5542342344323432432Y
Louise 12/11/201934534t34g34243j76i67yytY
Louise 12/11/201943r243tg5h6uu5643543fgY
Louise 12/11/2019534h65j7776g34r4fgg5y5yN
Louise 12/11/20195yg35yhjjj8i8iu5h56456h6N
Louise 12/11/20195yg35yhjjj8i8iu5h56456h6N
Louise 12/11/20195yg35yhjjj8i8iu5h56456h6N
Louise 12/11/20195yg35yhjjj8i8iu5h56456h6N
Louise 12/11/20195yg35yhjjj8i8iu5h56456h6N
Bob12/11/20195yg35yhjjj8i8iu5h56456h6N
Bob12/11/20195yg35yhjjj8i8iu5h56456h6N
Bob12/11/20195yg35yhjjj8i8iu5h56456h6N
Bob12/11/20195yg35yhjjj8i8iu5h56456h6N
Bob16/12/20195yg35yhjjj8i8iu5h56456h6N
Bob16/12/2019j875t245y45u7i75555r5t45Y
Bob16/12/2019j875t245y45u7i75555r5t45Y
Harry16/12/2019j875t245y45u7i75555r5t45Y
Harry16/12/2019j875t245y45u7i75555r5t45Y
Harry16/12/201912323324435436dfdfgergN
Harry16/12/201912323324435436dfdfgergN
Harry16/12/201912323324435436dfdfgergN
Harry17/12/201912323324435436dfdfgergN
Harry17/12/201912323324435436dfdfgergN
Harry17/12/201912323324435436dfdfgergN
Harry17/12/201912323324435436dfdfgergN
Harry17/12/20195yg35yhjjj8i8iu5h56456h6N
Harry17/12/20195yg35yhjjj8i8iu5h56456h6N
Harry17/12/20195v64563g5f45njj8k9k9k9kN
Harry17/12/2019cv57867k867hhhh75h7586N
Amy16/12/201956n456456gd7j69k78k9k9mN
Amy16/12/201956n456456gd7j69k78k9k9mN
Amy24/12/201956n456456gd7j69k78k9k9mN
Amy24/12/201956n456456gd7j69k78k9k9mN
Amy24/12/201956n456456gd7j69k78k9k9mN
Amy16/12/201956n456456gd7j69k78k9k9mN
Tegan16/12/2019d4346578989ll873h56g5645Y
Tegan16/12/2019jiu6465b156g467hjkjkk8678Y
Tegan16/12/2019546gv7bn775432v54346g6hY
Tegan24/12/2019324356ghhhj8989kd4324rt3N
Megan25/12/2019324356ghhhj8989kd4324rt3N
Megan26/12/2019324356ghhhj8989kd4324rt3N
Megan27/12/2019nj7bn65643g34343ffffffffffY
Megan28/12/2019223d4fgf5g3g5gvgvbvb687Y
Megan29/12/2019m6d1425r6g546g77j87j857Y
Megan30/12/2019k4109385734h59834rggfggN
Megan14/01/2019m6d1425r6g546g77j87j857Y
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
A helper column should speed things up a bit.

I've gone a bit overboard with the formula below, it would work with just the countifs part but the additional logic checks will help to process rows that don't match the criteria faster.

Book1
ABCDEFGH
1MemberDateUser IDDid you make a change?UniqueStart date16/12/2019
2Louise12/12/201912323324435436dfdfgergY0End date17/12/2019
3Louise12/11/2019dgf5542342344323432432Y0ChangeY
4Louise12/11/2019dgf5542342344323432432Y0Count of unique4
5Louise12/11/2019dgf5542342344323432432Y0
6Louise12/11/2019dgf5542342344323432432Y0
7Louise12/11/201934534t34g34243j76i67yytY0
8Louise12/11/201943r243tg5h6uu5643543fgY0
9Louise12/11/2019534h65j7776g34r4fgg5y5yN0
10Louise12/11/20195yg35yhjjj8i8iu5h56456h6N0
11Louise12/11/20195yg35yhjjj8i8iu5h56456h6N0
12Louise12/11/20195yg35yhjjj8i8iu5h56456h6N0
13Louise12/11/20195yg35yhjjj8i8iu5h56456h6N0
14Louise12/11/20195yg35yhjjj8i8iu5h56456h6N0
15Bob12/11/20195yg35yhjjj8i8iu5h56456h6N0
16Bob12/11/20195yg35yhjjj8i8iu5h56456h6N0
17Bob12/11/20195yg35yhjjj8i8iu5h56456h6N0
18Bob12/11/20195yg35yhjjj8i8iu5h56456h6N0
19Bob16/12/20195yg35yhjjj8i8iu5h56456h6N0
20Bob16/12/2019j875t245y45u7i75555r5t45Y1
21Bob16/12/2019j875t245y45u7i75555r5t45Y0
22Harry16/12/2019j875t245y45u7i75555r5t45Y0
23Harry16/12/2019j875t245y45u7i75555r5t45Y0
24Harry16/12/201912323324435436dfdfgergN0
25Harry16/12/201912323324435436dfdfgergN0
26Harry16/12/201912323324435436dfdfgergN0
27Harry17/12/201912323324435436dfdfgergN0
28Harry17/12/201912323324435436dfdfgergN0
29Harry17/12/201912323324435436dfdfgergN0
30Harry17/12/201912323324435436dfdfgergN0
31Harry17/12/20195yg35yhjjj8i8iu5h56456h6N0
32Harry17/12/20195yg35yhjjj8i8iu5h56456h6N0
33Harry17/12/20195v64563g5f45njj8k9k9k9kN0
34Harry17/12/2019cv57867k867hhhh75h7586N0
35Amy16/12/201956n456456gd7j69k78k9k9mN0
36Amy16/12/201956n456456gd7j69k78k9k9mN0
37Amy24/12/201956n456456gd7j69k78k9k9mN0
38Amy24/12/201956n456456gd7j69k78k9k9mN0
39Amy24/12/201956n456456gd7j69k78k9k9mN0
40Amy16/12/201956n456456gd7j69k78k9k9mN0
41Tegan16/12/2019d4346578989ll873h56g5645Y1
42Tegan16/12/2019jiu6465b156g467hjkjkk8678Y1
43Tegan16/12/2019546gv7bn775432v54346g6hY1
44Tegan24/12/2019324356ghhhj8989kd4324rt3N0
45Megan25/12/2019324356ghhhj8989kd4324rt3N0
46Megan26/12/2019324356ghhhj8989kd4324rt3N0
47Megan27/12/2019nj7bn65643g34343ffffffffffY0
48Megan28/12/2019223d4fgf5g3g5gvgvbvb687Y0
49Megan29/12/2019m6d1425r6g546g77j87j857Y0
50Megan30/12/2019k4109385734h59834rggfggN0
51Megan14/01/2019m6d1425r6g546g77j87j857Y0
Sheet1
Cell Formulas
RangeFormula
H4H4=SUM(E:E)
E2:E51E2=--IF(AND(B2>=$H$1,B2<=$H$2,D2=$H$3),COUNTIFS(B$2:B2,">="&$H$1,B$2:B2,"<="&$H$1,D$2:D2,$H$3,C$2:C2,C2)=1)
 
Upvote 0
You can use power query editor which uses in-memory and can handle millions records quite rapidly
User IDCheck_PeriodCount
12323324435436dfdfgerginclude
8​
5yg35yhjjj8i8iu5h56456h6include
3​
j875t245y45u7i75555r5t45include
4​
5v64563g5f45njj8k9k9k9kinclude
1​
cv57867k867hhhh75h7586include
1​
56n456456gd7j69k78k9k9minclude
3​
d4346578989ll873h56g5645include
1​
jiu6465b156g467hjkjkk8678include
1​
546gv7bn775432v54346g6hinclude
1​

Power Query applied Steps
1580210243137.png
 
Upvote 0
In addtion to the helper column method, this is the array method that I would use (if you haven't already tried it).

{=SUM(IFERROR(1/COUNTIFS($C$2:$C$51,$C$2:$C$51,$B$2:$B$51,">="&$H$1,$B$2:$B$51,"<="&$H$1,$D$2:$D$51,$H$3),0))}

If your data range is variable then I would suggest using dynamic named ranges instead of oversized fixed ranges or full columns, one common cause for slow array formulas is including a lot of empty rows in the data ranges. If you use entire columns in a formula with only 10k rows of data then that means that over 99% of the effort is wasted :oops:
 
Upvote 0

Forum statistics

Threads
1,215,537
Messages
6,125,386
Members
449,221
Latest member
DFCarter

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