Excel VLookup公式中的分隔查找字符串

Jam*_*mes 1 excel vba vlookup

数据表值

                           A                                       B
Life Insurance;Banks;Non-life Insurance;Nonlife Insurance     Manufacturing
Mobile Telecommunications;Fixed Line Telecommunications        Retailing
Run Code Online (Sandbox Code Playgroud)

查找值

    A                                             Return
Life Insurance                                 Manufacturing
NonLife Insurance                              Manufacturing
Mobile Telecommunications                      Retailing
Run Code Online (Sandbox Code Playgroud)

目前确实如此

查找值

    A                                             Return
Life Insurance                                 Manufacturing
NonLife Insurance                              Retailing
Mobile Telecommunications                      Retailing
Run Code Online (Sandbox Code Playgroud)

在'返回'栏中我有

= IFERROR(INDEX($ F $ 32:$ F $ 33 MATCH(H31,LEFT($ E $ 32:$ E $ 33 SEARCH( ";",$ E $ 32:$ E $ 33,1)-1)),0) ,IFEXROR(INDEX($ F $ 32:$ F $ 33,MATCH(H31,MID)($ E $ 32:$ E $ 33,搜索(";",$ E $ 32:$ E $ 33)+ 1,SEARCH(";", $ E $ 32:$ E $ 33,SEARCH(";",$ E $ 32:$ E $ 33)+1) - SEARCH(";",$ E $ 32:$ E $ 33) - 1)),0),INDEX( $ F $ 32:$ F $ 33,MATCH(H31,右($ E $ 32:$ E $ 33,LEN($ E $ 32:$ E $ 33) - 搜索(";",$ E $ 32:$ E $ 33,搜索(" ;",$ E $ 32:$ E $ 33)+ 1))),0)))

试图使用";"查看左,右和中间选项 作为一个分手点,然后做一个匹配和索引,它不是很有效.有没有办法在同一列中用';'分隔多个值的vlookup?

谢谢,

Sco*_*ner 6

使用:

=INDEX(B:B,MATCH("*" & D1 & "*",A:A,0))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


还有一个简单的VLOOKUP:

=VLOOKUP("*" & D1 & "*",A:B,2,FALSE)
Run Code Online (Sandbox Code Playgroud)

  • @OP:请注意,"NonLife Insurance"不符合"非人寿保险".数据首先需要清理.我还怀疑`LifeInsurance`将匹配`NonLifeInsurance`. (4认同)