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

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

数据表值

                           A                                       B
Life Insurance;Banks;Non-life Insurance;Nonlife Insurance     Manufacturing
Mobile Telecommunications;Fixed Line Telecommunications        Retailing

查找值

    A                                             Return
Life Insurance                                 Manufacturing
NonLife Insurance                              Manufacturing
Mobile Telecommunications                      Retailing

目前确实如此

查找值

    A                                             Return
Life Insurance                                 Manufacturing
NonLife Insurance                              Retailing
Mobile Telecommunications                      Retailing

在'返回'栏中我有

= IFERROR(指数($ F $ 32:$ F $ 33,MATCH(H31,LEFT($ E $ 32:$ E $ 33,搜索(“;”,$ E $ 32:$ E $ 33,1)-1) ,时尚(指数($ F $ 32:$ F $ 33,MATCH(H31,MID)($ E $ 32:$ E $ 33,搜索(“;”,$ E $ 32:$ E $ 33) $ E $ 32:$ E $ 33,SEARCH(“;”,$ E $ 32:$ E $ 33)+1) - SEARCH(“;”,$ E $ 32:$ E $ 33) - 1),0),INDEX( $ F $ 32:$ F $ 33,MATCH(H31,RIGHT($ E $ 32:$ E $ 33,LEN($ E $ 32:$ E $ 33) - 搜寻(“;”$ $ ;“,$ E $ 32:$ E $ 33)+ 1)))

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

谢谢,

excel vba vlookup
2个回答
6
投票

使用:

=INDEX(B:B,MATCH("*" & D1 & "*",A:A,0))

enter image description here


还有一个简单的VLOOKUP:

=VLOOKUP("*" & D1 & "*",A:B,2,FALSE)

1
投票

具有以下数据布局

A列包含数据表

列D:E保持值被查找

您可以在单元格B1中尝试以下公式(不区分大小写)

=LOOKUP(2^15,SEARCH(";"&$D$1:$D$3&";",";"&SUBSTITUTE(A1,"-","")&";",1),$E$1:$E$3)

根据需要复制。

注意:

我添加了SUBSTITUTE函数来处理额外的“ - ”。

您可以使用FIND代替SEARCH,使其区分大小写。

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