简体   繁体   English

使用和/或Excel数据透视表搜索过滤器

[英]Excel pivot table search filter with and / or

I am trying to filter a field in a pivot table so that it only shows some values. 我试图过滤数据透视表中的字段,以便它仅显示一些值。

I have a field which is product code and I want to only show the product codes that are H01, P07, F04, L43, ... and the list continues. 我有一个产品代码字段,我只想显示H01,P07,F04,L43等产品代码,列表继续。 For the moment, I have to click the little arrow next to the field, do a search on the code and then click on the checkbox add current filter to selection and hit ok. 目前,我必须单击该字段旁边的小箭头,对代码进行搜索,然后单击复选框,将当前过滤器添加到选择中,然后单击确定。 I have to do this 20 times for the 20 different product codes. 对于20种不同的产品代码,我必须执行20次。

Is there a way to enter in the search box immediately H01, P07, F04, L43, ... just once and then hit ok and I ll see all the product codes immediately? 有没有一种方法可以立即在搜索框中输入H01,P07,F04,L43 ...一次,然后单击确定,我将立即看到所有产品代码?

Thanks, 谢谢,

John. 约翰。

You can loop through pivot items and select the ones that match your criteria using VBA as suggested here: 您可以按照以下建议使用VBA遍历数据透视表项并选择与您的条件匹配的项:

Looping through report filters to change visibility doesn't work 遍历报告过滤器以更改可见性不起作用

The only issue I've had with this sort of approach is that you cannot deselect the only selected item, so if you are going to be deselecting then you should make sure to select particular items as well. 我对这种方法的唯一问题是您不能取消选择唯一的选定项目,因此,如果要取消选择,则还应确保选择特定的项目。

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

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