Counting unique values

HardBeatZ

New Member
Joined
Aug 11, 2009
Messages
11
Hello everyone!

I have a list of clients who visit different locations on different days. I need to count the number of unique clients that are visiting each center on the various days.

The client data is sensitive so I am unable to share the details however below is how the data is put together


Date First Name Last Name Center

01/04/18 John Doe Center 12
01/15/18 Jane Doe Center 11

I then have a table built that lists each center in column A with a cell that allows me to switch the date and am trying to get the number of unique clients in cell B.

I tried using a sum if using frequency, but I keep ending up off by 1, I figured this was due to formulas being written in cells that did not contain data yet so I had it subtract one from every center, but then two of my centers were off by the other way.

I know I can use countifs to come up with a solution, but my understanding is that countifs can be data extensive when using large amounts of data and this could be data that goes up to about 100,000 rows.

I'm clearly missing something just don't know what it is.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I am not sure how you have your cell that allows you to switch the date set up so I am not sure how you would tie this into that but you can use this.

I set up a sheet as mentioned with the columns (Date / First Name /Last Name / Center ) - Columns A, B, C, D

I then put in sample data


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]First Name[/TD]
[TD]Last Name[/TD]
[TD]Center[/TD]
[/TR]
[TR]
[TD]01/04/2018[/TD]
[TD]John[/TD]
[TD]Doe[/TD]
[TD]Center 12[/TD]
[/TR]
[TR]
[TD]01/15/2018[/TD]
[TD]Jane[/TD]
[TD]Doe[/TD]
[TD]Center 11[/TD]
[/TR]
[TR]
[TD]01/15/2018[/TD]
[TD]James[/TD]
[TD]Doe[/TD]
[TD]Center 5[/TD]
[/TR]
[TR]
[TD]01/20/2018[/TD]
[TD]Jill[/TD]
[TD]Doe[/TD]
[TD]Center12[/TD]
[/TR]
[TR]
[TD]01/20/2018[/TD]
[TD]Jack[/TD]
[TD]Doe[/TD]
[TD]Center 5[/TD]
[/TR]
[TR]
[TD]01/20/2018[/TD]
[TD]Joe[/TD]
[TD]Doe[/TD]
[TD]Center 6[/TD]
[/TR]
[TR]
[TD]01/20/2018[/TD]
[TD]Janna[/TD]
[TD]Doe[/TD]
[TD]Center 5[/TD]
[/TR]
[TR]
[TD]01/23/2018[/TD]
[TD]Jon[/TD]
[TD]Doe[/TD]
[TD]Center 6[/TD]
[/TR]
[TR]
[TD]01/23/2018[/TD]
[TD]Jim[/TD]
[TD]Doe[/TD]
[TD]Center 12[/TD]
[/TR]
[TR]
[TD]01/23/2018[/TD]
[TD]Jenny[/TD]
[TD]Doe[/TD]
[TD]Center 11[/TD]
[/TR]
[TR]
[TD]01/24/2018[/TD]
[TD]JoAnn[/TD]
[TD]Doe[/TD]
[TD]Center 12[/TD]
[/TR]
[TR]
[TD]01/24/2018[/TD]
[TD]Jenna[/TD]
[TD]Doe[/TD]
[TD]Center 11[/TD]
[/TR]
[TR]
[TD]01/24/2018[/TD]
[TD]Jamie[/TD]
[TD]Doe[/TD]
[TD]Center 11[/TD]
[/TR]
</tbody>[/TABLE]


Then in the same sheet I entered off to the right, I put a date in Cell I1 - This is where it pulls the date for use in our formula. You would change the date in Cell I1 to change the counts in you list of Centers.

With the date in Cell I1 I then Create A list of Centers on the same sheet, again this is just for demonstration, you will need to adjust for your use. I put my list of centers on the same sheet in Column Q.

Next to the center list in column R i enter the formula

Code:
=COUNTIFS(D:D,Q2,A:A,$I$1)


And then copy this down through the list of Centers. Note the locked cells in the formula ($)

 
Last edited:
Upvote 0
Maybe something like this:
You are right that COUNTIFS can slow things down when you have large amounts of data.
I'm assuming you have no blank cells in your data. If you do we may have to make a few changes.

This is an array formula and must be entered with CTRL-SHIFT-ENTER
Drag formula down as needed.
Excel Workbook
ABCD
1DateFirst NameLast NameCenter
21/4/2018JohnDoeCenter 12
31/20/2018JaneDoeCenter 11
41/20/2018JaneDoeCenter 11
51/20/2018JillDoeCenter 12
61/20/2018JackDoeCenter 5
71/20/2018JoeDoeCenter 6
81/20/2018JannaDoeCenter 5
91/23/2018JonDoeCenter 6
101/23/2018JimDoeCenter 12
111/23/2018JennyDoeCenter 11
121/24/2018JoAnnDoeCenter 12
131/24/2018JennaDoeCenter 11
141/24/2018JamieDoeCenter 11
15
16
17Date1/20/2018
18CenterUnique Count
19Center 52
20Center 61
21Center 111
22Center 121
Sheet
 
Upvote 0

Forum statistics

Threads
1,223,708
Messages
6,174,002
Members
452,542
Latest member
Bricklin

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