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:
In such cases, we can use 3 powerful tools.
- Multiple Consolidation Ranges – Pivot Tables
- 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.
- Let’s say your data is spread across multiple worksheet tabs
- Go to any tab and press ALT+D P (press D first, release the key, press P)
- This opens Insert Pivot dialog from Excel 2003 days
- In the next screen, select “I will create page fields”
- In the step 3, select & add the ranges one at a time and click finish.
- 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.
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.