How can I find and group unique combinations

sbiitmcdk

New Member
Joined
Nov 16, 2010
Messages
2
I am really stock in this :confused:

I have a list of users and their privilege represented by a value in this example setup.

I have then made a pivot to group the privileges by the users to get an overview. But what I really need is to show how many unique combinations based on users there are in my table.

In the given example we have the combination of 1,2,3 and 4 on user A, so that is one unique combination. Now I need to know how many users (and who) shares this unique combi.

Again user B has a different unique combination, who else have that?

etc.

My data is 44000 rows with 1900 different users and 150 different privileges. So it's going to be a very long night...

table_and_pivot.gif
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
This is a little tricky. There may be a more elegant way to do this, but this is what I could come up with.

I used an abbreviated list of your data for this example.

Make a Pivot Table of your raw data from columns A and B where User is in the row area and Privilege is in the column area

It would look something like this (except many more columns)
Excel Workbook
ABCD
14Sum of PrivilegePrivilege
15User123
16A123
17B123
18C12
19D13
...


For each user, you should have a list of their privileges. In the next empty column to the right of that pivot table, put this formula (column E in this example)
=MCONCAT(B15:D15, ",")
and copy it down the column for each user. Give this column the Header Privileges.

MCONCAT is a custom function that concatinates a range of cells. You can see the descriptions for it at Morefunc add-in Download: Morefunc.

Then you should have something like this...
Excel Workbook
ABCDE
15User123Privilages
16A1231,2,3
17B1231,2,3
18C121,2,
19D131,3
...


Now select all the data in the pivot table including the Privileges column (A15:E19) and make a second pivot table from that data where Privileges is in the Row area, User is in the column Area, and Count of Privileges is in the data Area. It should look something like this...
Excel Workbook
GHIJKL
15Count of PrivilagesUser
16PrivilagesABCDGrand Total
171,2,3112
181,2,11
191,311
...
 
Upvote 0
Update!

A better MCONCAT formula would be
=TRIM(MCONCAT(B16:D16," "))
...to eliminate any trailing delimiters.
 
Upvote 0
Thanks for the fast reply.

I cannot get it to work in the first step, because when I make a pivot with users and privileges what I get in the value area is the sum of user/privilege which is the number '1'.

So user will have a lot '1' presented along the row.

For the example it's maybe better to use these text strings as privileges instead of numbers: QAZ, WSX, EDC, RFV.

Thanks a lot for the effort.

/SBI
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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