简体   繁体   English

Excel VBA高级筛选器,筛选所有内容

[英]Excel VBA Advanced Filter, Filter everything BUT

let say I have a database of customers, internationally. 假设我有一个国际客户数据库。

I know I can use advanced filter to copy all customers from United States, using criteria that looks like: 我知道我可以使用类似以下条件的高级过滤器来复制美国的所有客户:

- --

Country 国家

United States 美国

- --

However, what if I want to filter everything BUT United states? 但是,如果我想过滤所有美国境内的东西怎么办? is this possible? 这可能吗?

My current solution is to use the AND operator by listing all the countries except US, which is not pretty. 我当前的解决方案是使用AND运算符,以列出除美国以外的所有国家/地区,这并不好。

Hope someone can help, and if this is a duplicate, please let me know. 希望有人可以提供帮助,如果重复的话,请告诉我。 I tried searching with terms such as "excepting", "exception", "everything but" with excel advanced filter but did not find any. 我尝试使用excel高级过滤器搜索诸如“ exception”,“ exception”,“ everything but”之类的术语,但未找到任何内容。

Thanks, 谢谢,

This is using advance filter: Just use not equal operator in criteria range. 这是使用高级过滤器的:仅在条件范围内使用不等于运算符。

在此处输入图片说明

This is formula for filtering your data. 这是用于过滤数据的公式。 Its just a excel array formula. 它只是一个excel数组公式。 Press Ctrl+Shift+Enter after entering formula. 输入公式后按Ctrl + Shift + Enter。

=IFERROR(INDEX(A:A,SMALL(IF($A$3:$A$9<>"USA",ROW($A$3:$A$9)),ROWS($A$3:$A3))),"")

在此处输入图片说明

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

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