How to combine datasets

pjmorris

Well-known Member
Joined
Aug 2, 2012
Messages
2,158
Office Version
  1. 365
Platform
  1. Windows
I have three data sources that I need to consolidate into a single data source:

1. A list of maintenance periods which are uniquely (no repeats) identified by 4 letters and 3 digits, for example CANS118. The Maintenance Periods mentioned in the data sources below will be listed it this list. While any maintenance period can have multiple activities some may not have any activity detailed against it and so will not appear in either of the lists below. This first list looks like this:
A
1Maintenance Period
2CANS118
3OTAD118
4WGND117
5OTA123
6AAAD111
7BBBC222

<tbody>
</tbody>


2. A list of activities that will occur in each maintenance period from source A. For example in two columns:
AB
1Maintenance PeriodActivity
2CANS118A170012345
3CANS118A170012400
4OTAD118A170012345
5OTAD118A170016000

<tbody>
</tbody>

3. A list of activities that will occur in each maintenance period from source B. For example in two columns:
AB
1Maintenance PeriodActivity
2CANS118B170067890
3CANS118B170012345
4WGND117B170012345
5OTAI123B170034520

<tbody>
</tbody>

I think I can do this rather clumsily by first copying the each list of activities against maintenance periods and then adding the list of maintenance periods. This doesn't seem to be a good use of excel's capabilities and I'm sure there is a more elegant solution, but despite various strategies involving pivot tables and establishing relationships I fail to make it work - I end up with every maintenance activity listed against every maintenance period - which is not helpful.

The outcome I'd like to achieve is this:

AB
1Maintenance PeriodActivity
2CANS118A170012345
3CANS118A170012400
4OTAD118A170012345
5OTAD118A170016000
6CANS118B170067890
7CANS118B170012345
8WGND117B170012345
9OTAI123B170034520
10AAAD111
11BBBC222

<tbody>
</tbody>



I'd be grateful for any suggestions as to the approach that could be adopted.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi PJ,

Did you try adding all your three sources in the Data Model, then establishing relationships? If you have unique codes, it shouldn't be a problem.

Then all you have to do is create a pivot table; in it, you can mix & match data from all your three sources.

If you're not sure how to do that, send me the link to a sample file and I'll create the model for you.

Alice
 
Upvote 0
hi Alice,

I tried that by creating named tables, then joining them using the relationships manager in the data ribbon, followed by using a connection in the Pivotable dialogue. All seems to work, but it doesnt include any maintenance periods with no activities and maintenance periods that do have activities show all activities against every maintenance period. I cant post a link to the data as its on a private network. But if you try the example here https://www.intheblack.com/articles/2015/10/01/easy-steps-to-make-data-relationships-work-in-excel and then on the sales sheet change one of the 'Widgets' to 'Broom' and another to 'Bucket' you'll see that the output includes 'Widgets', 'Gadgets, 'Buckets' and 'Brooms' against every state, which is unhelpful.

Hope you can suggest what I'm doing wrong.

Regards
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,576
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