Excel 在搜索数组中使用通配符的 Countif

Excel Countif with wildcards in searched array

我搜索了一段时间,但看起来我找到的所有示例都与我需要的相反。有很多方法可以查看带有通配符的字符串是否与数组中的任何值匹配,但我需要采用另一种方式 - 我需要数组包含通配符,并检查目标单元格中​​的字符串是否与任何匹配匹配数组中的字符串,但匹配字符串可以包含通配符。

换句话说,我正在解析大型日志文件,有很多行我想忽略(但不是删除);所以我有一个辅助列:

+---+-------+----------------------------------------+----------------------------+
|   |  A    |    B                                   |  C  (filter for = FALSE)   | Requirement
+---+-------+----------------------------------------+----------------------------+
| 1 | 11:00 | VPN Status                             | =COUNTIF(IgnoreList,B1)>0  + Keep
| 2 | 11:05 | Log at event index 118, time index 115 | =COUNTIF(IgnoreList,B2)>0  + Ignore
| 3 | 11:20 | Log at event index 147, time index 208 | =COUNTIF(IgnoreList,B3)>0  + Ignore
+---+-------+----------------------------------------+----------------------------+

我试图在我的 IgnoreList 范围内放置通配符以捕获任何 "Log at event" 行:

+--------------------------------------+
| IgnoreList                           +
+--------------------------------------+
| State Runtime 1                      + 
| State Runtime 2                      +
| State Runtime 3                      +
| State Runtime 4                      +
| Log at event index *, time index *   + 
+--------------------------------------+

...但这不起作用。

有谁知道如何根据包含通配符的数组检查单元格?

到目前为止,我的 IgnoreList 有 60 个条目,因此单独测试每个单元格并不可行。我可以在日志中有 30,000 或更多条目,因此单独测试将比我希望使用的公式多得多。我也不想在向 IgnoreList 添加条目时编辑公式。

感谢您的帮助!

在 SUMPRODUCT 中使用允许通配符查找的 SEARCH:

=SUMPRODUCT(--ISNUMBER(SEARCH(IgnoreList,B1)))>0


要使用 COUNTIF,需要反转条件并用 SUMPRODUCT 换行:

=SUMPRODUCT(COUNTIF(B1,IgnoreList))>0