vba 顶部的数据透视表总计
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/560469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Pivot Table Grand Total at the top
提问by Henry B
We have an Excel spreadsheet with the Grand Totals at the top using a Forumla, but this isn't on the actual Pivot Table it's just in the spreadsheet.
我们有一个 Excel 电子表格,顶部是使用 Forumla 的总计,但这不在实际的数据透视表中,它只是在电子表格中。
We have a client that wants the Grand Totals at the top of the Pivot Table and doesn't want us to use Formula. Does anyone know if this is possible (even using VBA or something, just so long as we don't look for a specific column or row name and compare with it (so no GETPIVOTDATA("Grand Total...)))?
我们有一个客户希望将总计放在数据透视表的顶部并且不希望我们使用公式。有谁知道这是否可行(即使使用 VBA 或其他东西,只要我们不查找特定的列或行名称并与之比较(所以没有 GETPIVOTDATA("Grand Total...)))?
回答by barrowc
This slightly hacky solution might help:
这个有点hacky的解决方案可能会有所帮助:
回答by Kevin
Actually, it is possible. I'm doing just that. Here's how. Let's say I in my data source, I have 1 column that contains various work orders. In another column I have all my total dollars spent for each work order, and in my final column I have a number that identifies all of the various work orders as being part of one whole group, or falling under one heading. In my case, each of the work orders fall under one project number. This will place your total at the top and at the bottom. It will also allow you to turn on and off the bottom or the top by selecting a choice under Grand Total on / off for rows / columns.
事实上,这是可能的。我就是这样做的。就是这样。假设我在我的数据源中有 1 列包含各种工作订单。在另一列中,我有我为每个工作订单花费的所有总美元,在我的最后一列中,我有一个数字,将所有不同的工作订单标识为整个组的一部分,或者属于一个标题。就我而言,每个工作订单都属于一个项目编号。这会将您的总数放在顶部和底部。它还允许您通过在行/列的总计开/关下选择一个选项来打开和关闭底部或顶部。
Kevin L
凯文·L
回答by loesbrown
It generally works. but many people in my team make different pivot table layouts. So than this "fake" grand total column really does not work anymore.
它通常有效。但是我团队中的许多人制作了不同的数据透视表布局。所以比这个“假”总计列真的不再起作用了。
回答by Mike Woodhouse
I'd be happy to be proved wrong, but I don't think it's possible. I think you may have to do a little work on managing your client's expectations...
我很高兴被证明是错误的,但我认为这是不可能的。我认为您可能需要做一些工作来管理客户的期望......