I've used this site many times over the past year and have always found answers to my questions. This time, I am completely stumped so hopefully I can concisely explain what I am trying to accomplish and hope someone out there can help.
I have 7 workbooks in which each workbook has over 10 worksheets and each worksheet is a pivot table. Using all of this, I need to create a scorecard. I've created a macro which opens the workbooks, goes through each tab to reformat the pivot table for the data I need, and copies and paste that data into a newly created worksheet. Once all the data is collected, the entire dataset worksheet is copied into the scorecard workbook.
The issue I am having has to do with the number of columns and where the data is placed. Some pivot tables have 12 months and some only have 1 month. When the data is copied over, these months may not be aligned properly for me to properly perform a vlookup, hlookup, or an Index Match.
Below is an example of what the final data sheet looks like where each store is a different workbook and each fruit is a specific worksheet from that workbook:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Workbook Data[/TD]
[TD]Worksheet Data[/TD]
[TD]11/1/2017[/TD]
[TD]12/1/2017[/TD]
[TD]1/1/2018[/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Apples[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Apples Sold[/TD]
[TD]7[/TD]
[TD]5[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Apples Total[/TD]
[TD]10[/TD]
[TD]7[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]12/1/2017[/TD]
[TD]1/1/2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Bananas[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Bananas Sold[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Bananas Total[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]5/1/2018[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Apples[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Apples Sold[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Apples Total[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]4/1/2018[/TD]
[TD]5/1/2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Bananas[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Bananas Sold[/TD]
[TD][/TD]
[TD]6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Bananas Total[/TD]
[TD][/TD]
[TD]7[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The scorecard has a worksheet with 12 months for each type of fruit in which it compares the # sold and total from each store. But what I need the macro to do now is align the dates and data in order so the vlookup or index match can correctly place the result for the given month.
Any ideas, thoughts, suggestions would be greatly appreciated! Please let me know if I can clarify some more. Thank you.
I have 7 workbooks in which each workbook has over 10 worksheets and each worksheet is a pivot table. Using all of this, I need to create a scorecard. I've created a macro which opens the workbooks, goes through each tab to reformat the pivot table for the data I need, and copies and paste that data into a newly created worksheet. Once all the data is collected, the entire dataset worksheet is copied into the scorecard workbook.
The issue I am having has to do with the number of columns and where the data is placed. Some pivot tables have 12 months and some only have 1 month. When the data is copied over, these months may not be aligned properly for me to properly perform a vlookup, hlookup, or an Index Match.
Below is an example of what the final data sheet looks like where each store is a different workbook and each fruit is a specific worksheet from that workbook:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Workbook Data[/TD]
[TD]Worksheet Data[/TD]
[TD]11/1/2017[/TD]
[TD]12/1/2017[/TD]
[TD]1/1/2018[/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Apples[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Apples Sold[/TD]
[TD]7[/TD]
[TD]5[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Apples Total[/TD]
[TD]10[/TD]
[TD]7[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]12/1/2017[/TD]
[TD]1/1/2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Bananas[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Bananas Sold[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Store 1[/TD]
[TD]Bananas Total[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]5/1/2018[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Apples[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Apples Sold[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Apples Total[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]4/1/2018[/TD]
[TD]5/1/2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Bananas[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Bananas Sold[/TD]
[TD][/TD]
[TD]6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Store 2[/TD]
[TD]Bananas Total[/TD]
[TD][/TD]
[TD]7[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The scorecard has a worksheet with 12 months for each type of fruit in which it compares the # sold and total from each store. But what I need the macro to do now is align the dates and data in order so the vlookup or index match can correctly place the result for the given month.
Any ideas, thoughts, suggestions would be greatly appreciated! Please let me know if I can clarify some more. Thank you.