当源数据包含日期的列标题时,如何构建合并的数据透视表?
我有一位客户目前正在使用 Excel 进行员工规划。他们有许多针对不同项目的工作簿,每个项目包含 1 张或多张包含实际人员配置数据的工作表:
客户希望将所有这些工作表和工作簿中的所有数据合并到一个数据透视表中。 “合并”数据透视表不是一个选项,因为他们希望能够混淆源数据中的所有(非日期)字段。他们不想仅限于“行”和“列”。我当前的解决方案是一个宏,它通过相当复杂的复制和旋转过程来合并工作簿中的所有数据。我首先复制一行“元数据”(不是日期的所有内容),然后将元数据行的日期复制/转置到单个“日期”列中。然后我扩展元数据,以便为每个日期定义相同的数据。
我有一个单独的工作簿,它从每个工作簿中获取合并工作表,并从中构建一个数据透视表。
它确实有效,但效率相当低,因为任务/分配的总数有数千个。在我的梦想中,我希望完全消除整合步骤,但我不认为这种情况会发生。更有效的整合方法是我目前所希望的最好方法。
如果有人有一些“跳出框框”的想法,我洗耳恭听! 该解决方案需要在 Windows XP、Office 2002 和 2003 上运行。
I have a customer who is currently using Excel to do their staff planning. They have many workbooks for different projects and each project contains 1 or more sheets containing the actual staffing data:
The customer wants to consolidate all of the data from all of these many sheets and workbooks into a single pivot table. A 'consolidated' pivot is not an option because they want to be able to mess with all of the (non-date) fields in the source data. They don't want to be limited to only 'Row' and 'Column'. My current solution is a macro that consolidates all of the data within a workbook through a fairly convoluted copy and rotate process. I copy a row of 'meta data' (everything that's not a date) first, then I copy / transpose the dates for the meta data row into a single 'Date' column. Then I extend the meta data so that the same data is defined for each date.
I have a separate workbook that grabs the consolidated sheet from each workbook and builds a single pivot table from them.
It works, but it's pretty inefficient, since the total number of tasks / assignments number in the many thousands. In my dreams, I would love to eliminate the consolidation step completely, but I don't see that happening. A more efficient consolidation approach is about the best I'm hoping for at this point.
If anyone has some 'outside the box' ideas, I'm all ears!
The solutions needs to work on windows XP, Office 2002 and 2003.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于找到了一个可接受的解决方案,如果有人感兴趣的话。它使用数据透视表和 TextToColumns< /a> 函数。一旦我掌握了这种方法,将其转化为代码就非常简单了。下面的代码确实引用了我使用的一些便利函数,例如“DeleteSheet”和“LastRowOn”,但您明白了。
I finally found an acceptable solution, if anyone is interested. It's uses a combination of a Pivot Table and the TextToColumns function. Once I had the approach, turing it into code was pretty simple. The code below does refer to a few conveniance functions I use, such as 'DeleteSheet' and 'LastRowOn', but you get the idea.