Index function to search a string and retain multiple words with reference to another table

jajatidev

Board Regular
Joined
Jul 29, 2016
Messages
69
Office Version
  1. 365
Platform
  1. Windows
Hi,
I'm in need of assistance with the Index Function to search for words within a string with a reference from another sheet. match the values and retain them.

Table 1 contains the following words;
RRDC
RRMF
RROM
SCAL
XBOP
EOL2
INCO

Table 2 contains the word strings;
Order Status
BLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOP
BLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOP
BLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOP
BLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOP
BLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOP
BLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOP
BLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOP
BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCAL
BLCA BLKD C2AP COM-GLA EOL2 NoMP REL SCAL
BLCA BLKD C2AP COM-GLA EOL2 NoMP REL SCAL
BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCAL
BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCAL
BLCA C2AP EOL2 NoMP REL SCAL
BLKD C2AP COM-GLA EOL2 NoMP REL SCAL
BLCA C2AP CFSL COM-GLA NoMP REL XBOP
BLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOP
C2AP COM-GLA INC-VBEP-LDDAT INC-VBEP-MBDAT INC-VBEP-TDDAT INC-VBEP-WADAT INCO NoMP REL
BLCA BLKD C2AP COM-GLA NoMP REL SCAL
BLCA BLKD C2AP COM-GLA NoMP REL RRDC SCAL
BLCA C2AP CFSL COM-GLA NoMP REL XBOP
BLCA BLKD C2AP COM-GLA NoMP PRSE REL RRDC
BLCA BLKD C2AP COM-GLA EOL1 NoMP REL RRDC
BLCA C2AP COM-GLA EOL1 NoMP REL RRDC
C2AP INC-VBAP-CEPOK INCO MDID NoMP REL RROM SCAL
BLCA C2AP EOL2 INC-VBAP-CEPOK INCO MDID NoMP REL RROM SCAL
BLCA BLKD C2AP COM-GLA NoMP REL RRDC SCAL
INC-VBAP-CEPOK INC-VBAP-NETWR INCO NoMP PRSE REL
BLKD C2AP COM-GLA INC-VBAP-ROUTE INCO NoMP REL
BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCAL

The formula [=IFERROR(INDEX(CodeList,MATCH(1,COUNTIF(A9,"*"&CodeList&"*"),0)),"")] I'm using is not giving the desired result.

Therefore, I need assistance with the formula where it should search the string and retain all the words recognized from Table 1.

I am looking forward to hearing from you.

Thanks,
Dev
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Your problem description needs more detail. What do you want the =IF(INDEX(.... formula to do? Please explain what is the "desired result".
Also, how is CodeList defined?
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Hi, I have updated the requested details.
 
Upvote 0
Your problem description needs more detail. What do you want the =IF(INDEX(.... formula to do? Please explain what is the "desired result".
Also, how is CodeList defined?

I need an INDEX function that looks into the cell string in Table 2 and retains the Words captured in Table 1 (Contents of Table 1 is the CodeList)

Example 1;
From the string
C2AP COM-GLA INC-VBEP-LDDAT INC-VBEP-MBDAT INC-VBEP-TDDAT INC-VBEP-WADAT INCO NoMP REL

The formula should search this string by cross-referencing Table 1 to retain INCO


Example 2;
From the string
BLCA C2AP EOL2 INC-VBAP-CEPOK INCO MDID NoMP REL RROM SCAL

The formula should search and retain EOL2, INCO, RROM, SCAL
 
Upvote 0
Hi, I have updated the requested details.
Thanks for that.
Is this what you want
Fluff.xlsm
ABCD
1Order Status
2RRDCBLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOPSCAL XBOP
3RRMFBLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOPSCAL XBOP
4RROMBLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOPSCAL XBOP
5SCALBLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOPSCAL XBOP
6XBOPBLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOPXBOP
7EOL2BLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOPXBOP
8INCOBLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOPXBOP
9BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCALSCAL EOL2
10BLCA BLKD C2AP COM-GLA EOL2 NoMP REL SCALSCAL EOL2
11BLCA BLKD C2AP COM-GLA EOL2 NoMP REL SCALSCAL EOL2
12BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCALSCAL EOL2
13BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCALSCAL EOL2
14BLCA C2AP EOL2 NoMP REL SCALSCAL EOL2
15BLKD C2AP COM-GLA EOL2 NoMP REL SCALSCAL EOL2
16BLCA C2AP CFSL COM-GLA NoMP REL XBOPXBOP
17BLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOPXBOP
18C2AP COM-GLA INC-VBEP-LDDAT INC-VBEP-MBDAT INC-VBEP-TDDAT INC-VBEP-WADAT INCO NoMP RELINCO
19BLCA BLKD C2AP COM-GLA NoMP REL SCALSCAL
20BLCA BLKD C2AP COM-GLA NoMP REL RRDC SCALRRDC SCAL
21BLCA C2AP CFSL COM-GLA NoMP REL XBOPXBOP
22BLCA BLKD C2AP COM-GLA NoMP PRSE REL RRDCRRDC
23BLCA BLKD C2AP COM-GLA EOL1 NoMP REL RRDCRRDC
24BLCA C2AP COM-GLA EOL1 NoMP REL RRDCRRDC
25C2AP INC-VBAP-CEPOK INCO MDID NoMP REL RROM SCALRROM SCAL INCO
26BLCA C2AP EOL2 INC-VBAP-CEPOK INCO MDID NoMP REL RROM SCALRROM SCAL EOL2 INCO
27BLCA BLKD C2AP COM-GLA NoMP REL RRDC SCALRRDC SCAL
28INC-VBAP-CEPOK INC-VBAP-NETWR INCO NoMP PRSE RELINCO
29BLKD C2AP COM-GLA INC-VBAP-ROUTE INCO NoMP RELINCO
30BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCALSCAL EOL2
Sheet6
Cell Formulas
RangeFormula
D2:D30D2=LET(x,TEXTSPLIT(C2," "),TEXTJOIN(" ",,XLOOKUP($A$2:$A$8,x,x,"")))
 
Upvote 0
Thanks for that.
Is this what you want
Fluff.xlsm
ABCD
1Order Status
2RRDCBLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOPSCAL XBOP
3RRMFBLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOPSCAL XBOP
4RROMBLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOPSCAL XBOP
5SCALBLCA BLKD C2AP COM-GLA NoMP REL SCAL XBOPSCAL XBOP
6XBOPBLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOPXBOP
7EOL2BLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOPXBOP
8INCOBLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOPXBOP
9BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCALSCAL EOL2
10BLCA BLKD C2AP COM-GLA EOL2 NoMP REL SCALSCAL EOL2
11BLCA BLKD C2AP COM-GLA EOL2 NoMP REL SCALSCAL EOL2
12BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCALSCAL EOL2
13BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCALSCAL EOL2
14BLCA C2AP EOL2 NoMP REL SCALSCAL EOL2
15BLKD C2AP COM-GLA EOL2 NoMP REL SCALSCAL EOL2
16BLCA C2AP CFSL COM-GLA NoMP REL XBOPXBOP
17BLCA BLKD C2AP CFSL COM-ATP COM-FDL COM-GLA NoMP REL XBOPXBOP
18C2AP COM-GLA INC-VBEP-LDDAT INC-VBEP-MBDAT INC-VBEP-TDDAT INC-VBEP-WADAT INCO NoMP RELINCO
19BLCA BLKD C2AP COM-GLA NoMP REL SCALSCAL
20BLCA BLKD C2AP COM-GLA NoMP REL RRDC SCALRRDC SCAL
21BLCA C2AP CFSL COM-GLA NoMP REL XBOPXBOP
22BLCA BLKD C2AP COM-GLA NoMP PRSE REL RRDCRRDC
23BLCA BLKD C2AP COM-GLA EOL1 NoMP REL RRDCRRDC
24BLCA C2AP COM-GLA EOL1 NoMP REL RRDCRRDC
25C2AP INC-VBAP-CEPOK INCO MDID NoMP REL RROM SCALRROM SCAL INCO
26BLCA C2AP EOL2 INC-VBAP-CEPOK INCO MDID NoMP REL RROM SCALRROM SCAL EOL2 INCO
27BLCA BLKD C2AP COM-GLA NoMP REL RRDC SCALRRDC SCAL
28INC-VBAP-CEPOK INC-VBAP-NETWR INCO NoMP PRSE RELINCO
29BLKD C2AP COM-GLA INC-VBAP-ROUTE INCO NoMP RELINCO
30BLKD C2AP COM-GLA EOL0 EOL2 NoMP REL SCALSCAL EOL2
Sheet6
Cell Formulas
RangeFormula
D2:D30D2=LET(x,TEXTSPLIT(C2," "),TEXTJOIN(" ",,XLOOKUP($A$2:$A$8,x,x,"")))
Thanks, Fluff.
Is it possible to have the output in order to its appearance (Left to Right) in the string to provide clarity?
 
Upvote 0
Not sure what you're saying, can you post some sample data along with expected results.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Not sure what you're saying, can you post some sample data along with expected results.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
Row - 15 from the solution.

String:
BLKD C2AP COM-GLA EOL2 NoMP REL SCAL

Output
SCAL EOL2

Is it possible to have the output in the order the two words appear in the string EOL2 SCAL? It's essential to maintain the sequence for MIS.
 
Upvote 0
Ok, how about
Excel Formula:
=LET(x,TEXTSPLIT(C2," "),TEXTJOIN(" ",,XLOOKUP(x,$A$2:$A$8,$A$2:$A$8,"")))
 
Upvote 1
Solution

Forum statistics

Threads
1,215,219
Messages
6,123,678
Members
449,116
Latest member
HypnoFant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top