Unique counts

vkorla

New Member
Joined
Dec 12, 2017
Messages
25
In this xlsx (link: https://drive.google.com/open?id=1agN53t1bX8qxCpFGqTOAdHIV_tcBW8ih), I want to find out the following.

For each item listed, I want to know a unique count based on month-year. I.e., for item 4656541653, the count for January 2017 would = 1, December 2017 = 1, November 2017 = 1, even though it appears 3 times in November 2017. Similarly, item 465645 would appear once under the month-year of March 2017, February 2017 and January 2017 even though it appears twice under January and February 2017

How can I do this? Do i need to add a helper column prior to making a pivot table?

The full data set contains thousands of records so I'm not sure of a quick way to achieve this. Thanks everyone!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Here is one way using a helper column:
Copy formula in D2 down as needed.
Copy formula in G3 down and across as needed.
Change ranges to match your data.
Excel Workbook
ABCDEFGHIJ
1ItemDateMonth-YearUnique ?
2952991/26/2017 20:35January 2017TRUEItemJanuary 2017February 2017March 2017April 2017
3465645165312/14/2017 10:00December 2017TRUE952991000
4465645165311/30/2017 13:09November 2017TRUE46564516530000
5465645165311/16/2017 11:18November 2017FALSE4656451110
6465645165311/2/2017 12:45November 2017FALSE89765410001
74656453/9/2017 16:30March 2017TRUE
84656452/23/2017 17:00February 2017TRUE
94656452/9/2017 17:10February 2017FALSE
104656451/26/2017 20:35January 2017TRUE
114656451/12/2017 15:40January 2017FALSE
12897654111/30/2017 12:00November 2017TRUE
13897654111/16/2017 12:36November 2017FALSE
14897654111/2/2017 13:09November 2017FALSE
15897654110/19/2017 14:24October 2017TRUE
16897654110/19/2017 10:00October 2017FALSE
17897654110/5/2017 13:04October 2017FALSE
1889765419/21/2017 11:00September 2017TRUE
1989765419/7/2017 10:00September 2017FALSE
2089765418/24/2017 16:05August 2017TRUE
2189765418/10/2017 13:05August 2017FALSE
2289765417/13/2017 13:10July 2017TRUE
2389765416/29/2017 12:56June 2017TRUE
2489765416/15/2017 13:05June 2017FALSE
2589765416/1/2017 13:00June 2017FALSE
2689765415/18/2017 13:05May 2017TRUE
2789765415/4/2017 12:55May 2017FALSE
2889765414/20/2017 12:55April 2017TRUE
Sheet
 
Upvote 0
With lots of data, a pivot table offers advantages. A helper column is not needed (and it will be faster without). You can even delete the current third column - so if that has a formula, it will be faster again.

NOTE : the offered solution modifies the dataset en route to making the pivot table.

I'll assume there are just the numbers in column A and dates/times in column B. Give the data a defined name, say MyData. Save the file. Start the external data wizard (I'll explain it this way cause I think it works on all Excel versions since pivot tables started in ~1995), such as ALT-D-D-N. Follow the wizard to the end selecting the file and then data on the way. At the last step, choose the option to edit in MS Query. Via the SQL button replace the text by
Code:
SELECT DISTINCT MyData.Item, INT(MyData.Date) - Day(MyData.Date) + 1 AS [MyDate]
FROM .MyData MyData
OK to enter, and OK to acknowledge a message about not being able to graphically represent. Then choose the option to make a pivot table as you finish using MS Query. Then set the pivot table how you want it.

cheers
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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