简体   繁体   English

Excel 2013:表格切片器选择不会更改计算字段的值(无VBA)

[英]Excel 2013: Table Slicers selection not changing values for calculated field (without VBA)

I have a ODBC query in Excel that I have attached slicers to in order to filter the data. 我在Excel中有一个ODBC查询,已附加了切片器以过滤数据。

Those slicers are on the main page along with a series of formulas to analyze the data. 这些切片器以及一系列用于分析数据的公式位于主页上。

ie Table on Sheet 2 contains rows with a unique ID, state, county, zip, and other fields. 即工作表2上的表包含具有唯一ID,州,县,邮政编码和其他字段的行。

I have Slicers on Sheet 1 that filter the data in the Table in Sheet 2. On sheet one I also have a series of calculations in Sheet 1 such as: 我在工作表1上有切片器,用于过滤工作表2中的表中的数据。在工作表1中,工作表1中也有一系列计算,例如:

=count(Sheet2!A:A)

=countif(Sheet2!B:B,1)/count(Sheet2!A:A)

So with no slicers selected, the formulas should count the total in Sheet2!A:A , however when I select a value from the slicer to filter the table, it shows the same calculated value essentially ignoring the filters. 因此,在未选择任何切片器的情况下,公式应在Sheet2!A:A计算总数,但是当我从切片器中选择一个值以过滤表时,它实际上显示了相同的计算值,而忽略了过滤器。

Is there anyway to ensure that the calculated fields are based on the filtered data without using VBA? 是否有任何方法可以确保在不使用VBA的情况下计算字段基于过滤后的数据?

Figured it out: 弄清楚了:

Need to use the SUBTOTAL function then the corresponding function # (ie 2 is count, 9 is sum etc.) 需要使用SUBTOTAL函数,然后使用相应的函数#(即2为计数,9为总和, SUBTOTAL

so the calculation looks like this 所以计算看起来像这样

=count(Sheet2!A:A) becomes =subtotal(2,Sheet2!A:A) =count(Sheet2!A:A)变为=subtotal(2,Sheet2!A:A)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM