excel 筛选 索引列表_Excel筛选器以匹配项目列表

excel 筛选 索引列表

To make it easy to filter for several different items, you create a list of those items on a worksheet. Then, filter your data based on that list, so you don't have to check all the items manually each time.

为了使筛选多个不同项目变得容易,您可以在工作表上创建这些项目的列表。 然后,根据该列表过滤数据,因此您不必每次都手动检查所有项目。

两种过滤方式 (Two Options for Filtering)

Here's the sample data, and the list of items that we want to filter. The table in column F is named tblFind, and cells F2:F3 are named FindList.

这是示例数据,以及我们要过滤的项目列表。 F列中的表名为tblFind ,单元格F2:F3名为FindList

We'll look at two options for filtering the list:

我们将看两个过滤列表的选项:

  1. Filter rows that have an exact Product match for items in the list

    筛选出与列表中的商品完全匹配的产品

  2. Filter rows that contain an item in the list, anywhere in the Product field

    在产品字段中的任何位置过滤列表中包含项目的

进阶筛选 (Advanced Filter)

Both options will use an Advanced Filter, so a Criteria range is added to the worksheet.

这两个选项都将使用Advanced Filter ,因此Criteria范围将添加到工作表中。

We'll be using a formula in the criteria cell, so type a heading that is different from any heading in the data table, or leave the criteria heading blank.

我们将在条件单元格中使用公式,因此键入与数据表中任何标题均不同的标题,或将条件标题留为空白。

列表中项目的完全匹配 (Exact Match For Items in List)

For the first filter, we want to find rows with a product that is an exact match for one of the list items.

对于第一个过滤器,我们要查找具有与列表项之一完全匹配的产品的行。

  • In cell C2, enter the following formula. It refers to the named range in the list of items, and the first Product cell in the data table.

    在单元格C2中,输入以下公式。 它引用了项目列表中的命名范围以及数据表中的第一个“产品”单元格。

    =COUNTIF(FindList,C5)

    = COUNTIF(FindList,C5)

The formula uses the COUNTIF function to check each record, and test for the list items. Rows with an exact match will be returned in the filter.

该公式使用COUNTIF函数检查每个记录,并测试列表项。 完全匹配的行将在过滤器中返回。

运行高级过滤器 (Run the Advanced Filter)

To run the Advanced Filter:

运行高级过滤器:

  • Select a cell in the data table

    在数据表中选择一个单元格
  • On the Data tab of the Ribbon, in the Sort & Filter group, click Advanced

    在功能区的“数据”选项卡上的“排序和筛选”组中,单击“高级”。
  • For Action, select Filter the list, in-place

    对于“操作”,选择“就地过滤列表”
  • For List range, select the data table

    对于列表范围,选择数据表
  • For Criteria range, select C1:C1 – the criteria heading and formula cells

    对于“条件范围”,请选择C1:C1 –条件标题和公式单元格
  • Click OK, to see the results

    单击确定,以查看结果

The 4 rows that have a product that is exactly "Milk" or "Cookies" (case does not matter), are visible, and all other rows are hidden.

产品完全为“牛奶”或“饼干”(大小写无关)的4行是可见的,所有其他行均被隐藏。

在列表中包含一个项目 (Contain an Item in the List)

For the second filter, we want to find rows with a product that contains one of the list items, anywhere in the Product cell.

对于第二个过滤器,我们要在“产品”单元格中的任何位置查找包含产品的行,其中包含列表项之一。

  • In cell C2, enter the following formula. It refers to the named range in the list of items, and the first Product cell in the data table.

    在单元格C2中,输入以下公式。 它引用项目列表中的命名范围,并引用数据表中的第一个“产品”单元格。

    =SUMPRODUCT(COUNTIF(C5,"*"& FindList &"*"))>0

    = SUMPRODUCT(COUNTIF(C5,“ *”&FindList&“ *”))> 0

The COUNTIF function checks each Product cell, and tests for the list items. The * wildcards are used before and after the list item, so the text can be found anywhere in the Product cell. The SUMPRODUCT function sums the number, and if it's greater than zero, the result is TRUE.

COUNTIF函数检查每个产品单元格,并测试列表项。 *通配符用于列表项的前后,因此可以在“产品”单元格中的任何位置找到文本。 SUMPRODUCT函数对数字求和,如果它大于零,则结果为TRUE。

Run the Advanced Filter with the same settings as in the first example, and the 6 rows that contain "Milk" or "Cookies" (case does not matter) in the product cell are visible.

使用与第一个示例相同的设置运行“高级筛选器”,并且在产品单元格中包含“牛奶”或“饼干”(大小写无关)的6行可见。

进阶筛选影片 (Advanced Filter Video)

Watch this video to see how to set up the Advanced Filter, and filter for exact matches in the item list.

观看此视频,以了解如何设置“高级过滤器”以及在项目列表中过滤出完全匹配的内容。

演示地址

下载样本文件 (Download the Sample File)

To download the workbook with sample data and Excel advanced filter criteria, go to the Advanced Filter Criteria page on my Contextures website.

若要下载带有示例数据和Excel高级筛选条件的工作簿,请转到Contextures网站上的“ 高级筛选条件”页面

Scroll down to the Download section, and click the download link. The zipped file is in xlsx format, and does not contain macros.

向下滚动到“下载”部分,然后单击下载链接。 压缩文件为xlsx格式,不包含宏。

相关链接 (Related Links)

Advanced Filter Basics

高级过滤器基础

Advanced Filter Criteria

进阶筛选条件

Advanced Filter Criteria Slicers

先进的过滤器标准切片器

Advanced Filter Macros

进阶筛选器巨集

Filter to Different Sheet

筛选到不同的工作表

Filter Unique Items

筛选唯一项目

翻译自: https://contexturesblog.com/archives/2017/05/18/excel-filter-to-match-list-of-items/

excel 筛选 索引列表

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值