Combine two data sets. Pivot Table?

wakerider017

Board Regular
Joined
Jun 10, 2015
Messages
77
Hey guys, I have two data sets that I want to combine. Data is currently on two different worksheets.

Below is an example of what I am trying to do, but my actual data has more columns for both Opportunity and Contacts. I also have many more rows.

OpportunityAccount Stage
11Open
22Closed
33Open
41Open
52Closed

<colgroup><col style="text-align: center;"><col span="2" style="text-align: center;"></colgroup><tbody>
</tbody>


ContactAccountName
13Bob
22John
31Mary
43Tina
51Tim

<colgroup><col style="text-align: center;"><col span="2" style="text-align: center;"></colgroup><tbody>
</tbody>



I need to link them by the Account number.
Ideally I'd like a hierarchy, where each Opportunity has its own row and lists all the related contacts underneath. Not sure how to do that? Can this be done in a pivot table

Thinking output would be something like this:

OpportunityAccount Stage
11Open
ContactAccountName
31Mary
51Tim
OpportunityAccount Stage
22Closed
ContactAccountName
22John
OpportunityAccount Stage
33Open
ContactAccountName
13Bob
43Tina
OpportunityAccount Stage
41Open
ContactAccountName
31Mary
51Tim
OpportunityAccount Stage
52Closed
ContactAccountName
22John

<colgroup><col><col span="2"></colgroup><tbody>
</tbody>
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
maybe something like this with PowerQuery

OpportunityAccountStageContactAccountNameOpportunityAccountStageContactAccount.1Name
1​
1​
Open
1​
3​
Bob
1​
1​
Open
3​
1​
Mary
2​
2​
Closed
2​
2​
John
1​
1​
Open
5​
1​
Tim
3​
3​
Open
3​
1​
Mary
4​
1​
Open
3​
1​
Mary
4​
1​
Open
4​
3​
Tina
4​
1​
Open
5​
1​
Tim
5​
2​
Closed
5​
1​
Tim
3​
3​
Open
1​
3​
Bob
3​
3​
Open
4​
3​
Tina
2​
2​
Closed
2​
2​
John
5​
2​
Closed
2​
2​
John

Code:
[SIZE=1]let
    Source = Table.NestedJoin(Table1,{"Account"},Table2,{"Account"},"Table2",JoinKind.FullOuter),
    #"Expanded Table2" = Table.ExpandTableColumn(Source, "Table2", {"Contact", "Account", "Name"}, {"Contact", "Account.1", "Name"})
in
    #"Expanded Table2"[/SIZE]
 
Upvote 0

Forum statistics

Threads
1,213,549
Messages
6,114,264
Members
448,558
Latest member
aivin

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