Match a part of text

hello guys
I have two tables
The first table contains column [code1], which contains a code, for example
ab-ss-pt
ab-ss-pt-l2
ab-ws-pr-l1
ab-ws-pr
The second table contains column [code2] containing code, for example
ab-ss-pt-l1-3526         =   ab-ss-pt
ab-ws-pr-l1-3566        =   ab-ws-pr-l1
ab-ss-pt-l1-7885         =   ab-ss-pt
ab-ss-pt                        =   ab-ss-pt
ab-ss-pt-l2                   =   ab-ss-pt-l2
ab-ss-pt-l1                   =   ab-ss-pt

What I want is to create a [matching] column in the second table that searches for the code in column [code2] with column [code1] in the first table, and get the code is closest.

 

thanx

Solved Solved
0 3 131
1 ACCEPTED SOLUTION

Don't know your whole data in Table1, but with a virtual column the formula could be something like..
INDEX(SORT(SELECT(Table1[Code1],CONTAINS([_THISROW].[Code2],[Code1])),TRUE),1)

View solution in original post

3 REPLIES 3

Don't know your whole data in Table1, but with a virtual column the formula could be something like..
INDEX(SORT(SELECT(Table1[Code1],CONTAINS([_THISROW].[Code2],[Code1])),TRUE),1)

Thank you very much, it worked successfully

Good to hear!

Top Labels in this Space