简体   繁体   English

使用OR条件筛选Excel数据透视表

[英]Using an OR condition to filter an Excel Pivot Table

I'm an Excel amateur and I'm just starting to learn to use Pivot Tables. 我是Excel业余爱好者,我刚开始学习使用数据透视表。 The issue is, I need the pivot table filtered results to be inclusive. 问题是,我需要透视表过滤结果包含在内。

So, I have a table with some data rows and 3 Columns A, B, C with possible values X, Y, Z... I specify a filter for columns A, B, C such as that I can retrieve the data rows that have A=Y OR B=Z OR C=X. 所以,我有一个包含一些数据行和3列A,B,C的表,可能的值为X,Y,Z ...我为A,B,C列指定了一个过滤器,例如我可以检索到的数据行A = Y OR B = Z OR C = X.

The problem I have is that the default filters use an AND condition. 我遇到的问题是默认过滤器使用AND条件。 So if I select the first value as A=Y, it will remove all other rows. 因此,如果我选择第一个值为A = Y,它将删除所有其他行。

Any ideas? 有任何想法吗? I know that you can do something similar with an Advanced Filter, but I don't know if there's a simpler solution. 我知道你可以用高级过滤器做类似的事情,但我不知道是否有更简单的解决方案。

Many thanks! 非常感谢!

Ideally all data manipulation for a pivot table is done in a calculated field. 理想情况下,数据透视表的所有数据操作都在计算字段中完成。 However I've found that you can not use a calculated field for sections other than the value section (which you are trying to do here it seems). 但是我发现你不能在值部分以外的部分使用计算字段(你似乎在这里试图做)。

A workaround I've used is to add a new column to the source data that contains a formula to group the data by. 我使用的一种解决方法是向源数据添加一个新列,其中包含一个用于对数据进行分组的公式。

You could do something like: 你可以这样做:

IF(OR(A=Y, B=Z, C=X), "Display", "Hide")

And filter on that column's Display or Hide results in the pivot. 并过滤该列的显示或隐藏结果。

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

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