How to consolidate data that is different shapes [BYOD]

Last week, I asked my email newsletter readers to submit “one data analysis problem you are struggling with”. We called it BYOD – Bring your own data. More than 100 people have emailed various interesting (and often very difficult) problems. This week (between 16th of February to 20th of February), let’s take a look at some of these problems and solve them.

Consolidating data in different shapes

We can use either VBA or Excel’s consolidation features to combine data that has same shape (ie same number & type of columns). Here is one way to do it.

But what if we need to consolidate data that is in different shapes?

Something like this:

consolidating-data-in-different-shapes-excel-problem

In such cases, we can use 3 powerful tools.

  1. Multiple Consolidation Ranges – Pivot Tables
  2. VBA
  3. Power Query

So let’s examine how to use these approaches to consolidate data in different shapes.

Multiple consolidation ranges – Pivot

The first approach involves using a hidden feature in Excel, called as multiple consolidation ranges.

  1. Let’s say your data is spread across multiple worksheet tabs
  2. Go to any tab and press ALT+D P (press D first, release the key, press P)
  3. This opens Insert Pivot dialog from Excel 2003 days

    Insert a multiple consolidation ranges - pivot table using Excel

  4. In the next screen, select “I will create page fields”
  5. In the step 3, select & add the ranges one at a time and click finish.
    How to set up multiple consolidation ranges in Excel - Pivot tables
  6. And your consolidation is done!

[Related: Introduction to Excel Pivot Tables]

Combining data in multiple shapes – Using VBA & Power Query

For these 2 methods, please watch below video.

(Click here to see this video on Chandoo.org youtube channel)

Download Example Workbook

Please click here to download the example workbook. It contains only the VBA solution. For pivot table solution, use the above steps. For Power Query solution, follow the video and create it on your Excel.

How do you consolidate such data?

My preference is to use VBA as consolidation tends to be a repetitive task (every month we need to consolidate) and it works in any version of Excel. That said, I also like the flexibility and diversity Power Query offers. You can do so much more than just consolidating with PQ.

What about you? Have you faced any such consolidation challenges in your work? How did you solve them? Please share your thoughts and solutions in the comments section.