简体   繁体   中英

match multiple partial strings from string in excel

So here I have 2 tables.

ring    layer1  layer2  output
12      45      46      bingo
12      34      75  
13      23      47  
14      23      34      nice_work
14      12      15  
14      45      23  
14      67      89      wow
25      90      124 
67      76      341 


ring    whole_string    value as output
12      23_45_12_78_46  bingo
12      78_89_23_45_90  great
13      23_89_90        awesome
14      45_78_23_45_34  nice_work
14      88_86_85_12     cool
14      67_89_111       wow

what I need is: value as output from tbl2 if
1. tbl1 ring = tbl2 ring
2. tbl1 layer1 & layer2 values must be present in tbl2 whole_string

Can someone help me with excel formula?

Thank you...

I tried using a for loop. It takes a whole lot time.

You could use:

在此处输入图片说明

Formula in D2 :

=IFERROR(INDEX($H$1:$H$7,AGGREGATE(14,3,($F$2:$F$7=A2)*(IF(ISNUMBER(SEARCH("_"&B2&"_","_"&$G$2:$G$7&"_")),1,""))*(IF(ISNUMBER(SEARCH("_"&C2&"_","_"&$G$2:$G$7&"_")),1,""))*ROW($F$2:$F$7),1)),"")

Entered as array formula through: Ctrl + Shift + Enter

Drag down...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM