Create pivottable with 2 tables with duplicates in each column

Acoma7

New Member
Joined
Jan 9, 2024
Messages
1
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hi
I am trying to work out how to make a pivottable that counts how many members are in each group that exist in each club.
Names are the members of each group or club.
The pivottable in the example is to give you an idea of what I am trying to work out.
I have tried using Data Modal but it says I can not do this with duplicates entries in the columns.
So a bit stuck, any advice would be really greatful.
The full data model is about 4000 names, 200 groups and 100 clubs.

Example.xlsx
ABCDE
1NameGroups
2PersonAGroup1
3PersonBGroup1
4PersonCGroup2
5PersonDGroup3
6PersonAGroup3
7PersonBGroup2
8PersonDGroup4
9PersonBGroup3
10PersonCGroup4
11PersonDGroup1
12PersonAGroup4
13
14NameClubs
15PersonAClub2
16PersonBClub3
17PersonCClub4
18PersonDClub1
19PersonAClub3
20PersonBClub2
21PersonDClub2
22PersonBClub4
23PersonCClub1
24PersonDClub3
25PersonAClub4
26
27PivotTableClub1Club2Club3Club4
28Group11332
29Group21112
30Group31332
31Group42222
Groups
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Power Query Solution

Power Query:
let
    T1 = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    T2=Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    MQ = Table.NestedJoin(T1, {"Name"},T2, {"Name"}, "Table2", JoinKind.FullOuter),
    #"Expanded Table2" = Table.ExpandTableColumn(MQ, "Table2", {"Clubs"}, {"Table2.Clubs"}),
    #"Pivoted Column" = Table.Pivot(#"Expanded Table2", List.Distinct(#"Expanded Table2"[Table2.Clubs]), "Table2.Clubs", "Name", List.Count),
    #"Reordered Columns" = Table.ReorderColumns(#"Pivoted Column",{"Groups", "Club1", "Club2", "Club3", "Club4"})

in
    #"Reordered Columns"

Book6
ABCDE
1NameGroups
2PersonAGroup1
3PersonBGroup1
4PersonCGroup2
5PersonDGroup3
6PersonAGroup3
7PersonBGroup2
8PersonDGroup4
9PersonBGroup3
10PersonCGroup4
11PersonDGroup1
12PersonAGroup4
13
14NameClubs
15PersonAClub2
16PersonBClub3
17PersonCClub4
18PersonDClub1
19PersonAClub3
20PersonBClub2
21PersonDClub2
22PersonBClub4
23PersonCClub1
24PersonDClub3
25PersonAClub4
26
27
28GroupsClub1Club2Club3Club4
29Group11332
30Group21112
31Group31332
32Group42222
Sheet2
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,025
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