Excel Pivot表范围参考 [英] Excel Pivot table range reference

查看:136
本文介绍了Excel Pivot表范围参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Excel数据透视表中存储的数据开始进行一些计算.

Hi I’m trying to make some calculation starting from data stored in an excel pivot table.

我知道有一个GetPivotData函数,该函数非常有用,但是只允许检索单个值.我想使用工作表功能来查询"我的数据(例如,在不过滤数据透视表的情况下对某列中的一些值求和),但是我找不到一种轻松引用数据透视表范围的方法. 可以假定表的结构"是固定的,但其中的数据不是固定的:我发现的最佳解决方案是编写一个UDF函数以获取对该表范围的引用:

I know there is a GetPivotData function, which is very useful, but it only allows retrieving single values. I’d like to use worksheets function to "query" my data (for example, sum some values in a column, without filtering the pivot table), but I can’t find a way to easily reference the range of the pivot table. The "structure" of the table may be assumed to be fixed, but not the data in it: the best solution I found is to write a UDF function to get the reference to the range of the table:

 Function getPvRange(firstcell As Range) As Range
    Set getPvRange = firstcell.PivotTable.TableRange1
 End Function

我可以在公式中使用此函数.我想知道是否有一种简单的方式(我的意思是没有定义动态范围名称)直接方式(我的意思是,没有使用VBA)来引用数据透视表范围?

I can use this function in my formulas. I was wondering if there is a simple (I mean without defining dynamic range names) direct way (I mean, not using VBA), to reference the Pivot Table range?

推荐答案

如果只想将数据透视表中的单元格称为普通单元格,则可以禁用自动生成的GetPivotData函数.调出数据透视表工具栏,单击添加按钮,然后选择'Generate GetPivotData'.然后,您可以使用新按钮切换自动公式.

If you just want to refer to cells within a pivot table as normal cells, you can disable the automatically generated GetPivotData functions. Bring up the pivot table toolbar, click add buttons, and select 'Generate GetPivotData'. You can then use the new button to toggle the automated formulas.

还是您正在尝试做一些更复杂的事情?如果是这样,请您举个例子吗?

Or are you trying to do something a bit more complicated? If so, please could you post an example?

这篇关于Excel Pivot表范围参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆