使用OR条件过滤Excel数据透视表 [英] Using an OR condition to filter an Excel Pivot Table

查看:418
本文介绍了使用OR条件过滤Excel数据透视表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名Excel业余爱好者,我刚刚开始学习使用数据透视表。问题是,我需要将透视表过滤的结果包含在内。

I'm an Excel amateur and I'm just starting to learn to use Pivot Tables. The issue is, I need the pivot table filtered results to be inclusive.

所以,我有一个表格有一些数据行和3列A,B,C可能值X,Y,Z ...我为列A,B,C指定一个过滤器,例如我可以检索具有A = Y或B = Z OR C = X的数据行。

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.

我遇到的问题是默认过滤器使用AND条件。所以如果我选择第一个值为A = Y,它将删除所有其他行。

The problem I have is that the default filters use an AND condition. So if I select the first value as A=Y, it will remove all other rows.

任何想法?我知道您可以使用高级过滤器做类似的操作,但是我不知道是否有更简单的解决方案。

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.

非常感谢!

推荐答案

理想情况下,在计算字段中完成数据透视表的所有数据操作。
但是,我发现您不能使用计算字段,而不是值部分(您正在尝试在此处看起来)的部分。

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.

您可以执行以下操作: (OR(A = Y,B = Z,C = X),显示,隐藏)$ b $($)

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.

这篇关于使用OR条件过滤Excel数据透视表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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