Excel table filter achieving something like an IN statement in SQL language

时间:2016-02-12 22:14:22

标签: excel excel-2010

I'm convinced this has to be something very straightforward - I just couldn't find any stack exchange posts referencing it. I apologize if it's already out there.

I'm trying to filter out a couple of numbers from a long list that I have in an excel table. Something similar to an 'in' clause in SQL, but I'm not using a formula - just trying to use the table functionality in Excel 2010. Any help appreciated on how to input multiple numbers/id's at once.

The closest I've found so far is using advanced filters as suggested here - but it's not quite as simple as keying something into the search bar: https://superuser.com/questions/623380/excel-filter-a-column-by-more-than-two-values

Thanks

Excel dropdown filter

2 个答案:

答案 0 :(得分:0)

主页标签>突出显示值列>排序&过滤按钮>过滤器>从excel表中,您可以从值列的顶部按数字过滤它。

答案 1 :(得分:0)

简短的回答是不,不是真的。在Excel中,您可以使用两个条件进行过滤(通过or),但据我所知,您不能超过两个。

如果你对黑客感兴趣,可以选择一个。

  1. 创建第二个表,其中包含要过滤的值列表。确保它是一个表,而不是范围,以实现可伸缩性

  2. 在原始表中创建一个新字段,并针对新表vlookup您的值。这样的事情:

  3. =IF(ISNA(VLOOKUP([@UID],NewTable[[#All],[FilterItems]],1,FALSE)),"","Y")
    

    现在您的原始表格中有一个可以过滤的字段" Y"获取列表中的项目。

    因为你把它作为一个表而不是一个范围,如果你添加项目,vlookup将动态扩展以包含那些新项目,而不必你做诅咒的A:A范围。

    enter image description here