EXCEL如何反向匹配以查找通配符

问题描述 投票:0回答:2

我在excel中有两个列表,一个带有通配符,一个带有特定字符串。

我想为每个字符串首先知道哪个通配符与之匹配。

      A                      B            C          D               E
   2 Text                                Wildcard              
   3 The Fries Paradise                  *pizza*       
   4 CrabbyPatty Burger                  *burger*        
   5 Fries Work                          *fries*         
   6 Pizza & Burgers        
   7 Pizzaderia                 
   8 OverloadedFries   

So in B3 should be *fries*, in B4 *burger* etc

我无法绕过MATCH函数扭转局面,有人知道吗?

excel excel-formula match wildcard
2个回答
2
投票

数组公式:

=INDEX($C$3:$C$5,MATCH(1,COUNTIF(A3,$C$3:$C$5),0))

1
投票

您可以使用AGGREGATE来确定匹配的第一个通配符文本(尽管此解决方案实际上只是替换了通配符):

=INDEX($C$2:$C$4,AGGREGATE(15,6,ROW($A$1:$A$3)/ISNUMBER(SEARCH(SUBSTITUTE($C$2:$C$4,"*",""),A2)),1))

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.