Counting unique data

kcleere

Active Member
Joined
Oct 4, 2006
Messages
314
I hope I can articulate this properly.

In my spreadsheet I have a column of customer numbers and in another column I have dates on which they made a payment. There can be one or more of the same date for a customer number.

Customer 2134 could have 4 rows showing 10/23/17 and 1 row showing 10/24/17. This would count 2 unique dates for that customer number and this is what I need to return in a pivot.


Cust Payments
2134 2

Not sure if this is clear enough. Thank you in advance.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Re: Need help counting unique data

Hi kcleere

One way is to load the data/table into Power Pivot Data Model and then create a Pivot Table using "data Model"

You will surely find the Distinct Count in the "Value Field Settings" then

Pivot tables based on Excel Tables/Data (I believe) do not support "Distinct Count" Aggregation
 
Upvote 0
Re: Need help counting unique data

Thank you. What I envisioned was adding a capture column with a formula that returned Qty on unique dates for each customer number and then use that column in the pivot.
 
Upvote 0
Re: Need help counting unique data

I'll have to re-think this. I don't have Power Pivot as an option add-in
 
Upvote 0
Re: Need help counting unique data

I'd prefer a formula that I could add to the data and then I can use that data in a pivot.
 
Upvote 0
Re: Need help counting unique data

kcleere,

Another approach would be to...

Select your data.
Use Advanced Filter, with the "Copy to another location" and "Unique records only" options selected.
Use the result as the data source for a PivotTable.

Cheers,

tonyyy
 
Upvote 0
Re: Need help counting unique data

If your like dates are grouped next to each other rather than intermingled with each other, then this kind of formula should work...

=SUMPRODUCT(0+(B1:B24<>B2:B25))

Note the first range is your actual data range from the first data item to the last... the second range is offset from that range by one cell.
 
Upvote 0
Re: Need help counting unique data

I'd prefer a formula that I could add to the data and then I can use that data in a pivot.

Maybe

A
B
C
1
Customer​
PaymentDate​
CountUnique​
2
2134​
10/23/2017​
2​
3
2134​
10/23/2017​
2​
4
2134​
10/23/2017​
2​
5
2134​
10/24/2017​
2​
6
1234​
10/24/2017​
1​
7
5678​
10/23/2017​
2​
8
5678​
10/23/2017​
2​
9
5678​
10/24/2017​
2​
10
5678​
10/24/2017​
2​

<tbody>
</tbody>


Array formula in C2 copied down
=SUM(IF(FREQUENCY(IF($A$2:$A$10=A2,$B$2:$B$10),$B$2:$B$10),1))
confirmed with Ctrl+Shift+Enter, not just Enter

Pivot Table

Customer​
Max of CountUnique​
1234​
1​
2134​
2​
5678​
2​

<tbody>
</tbody>


Right-click in the CountUnique field and in Summarize Values by...pick Max

M.
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

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