VLOOKUP on partial text in a string

raheem

New Member
Joined
Apr 24, 2017
Messages
34
I want to detect a part of string from a cell and then apply vlookup to get corresponding value from another table. Please refer below tables. Values are to be extracted from second table into first table: (there are also few spaces in first table in start of string)

First Table
StructureValue
** WBS 99OP-11223.P.01 Project RT
* WBS 99OP-11223.P.01.01 Project Roots Data
WBS 99OP-11223.P.01.01.01 First Line Item
WBS 99OP-11223.P.01.01.02 Second Line Products
WBS 99OP-11223.P.01.01.03 Third Line Items

<colgroup><col><col></colgroup><tbody>
</tbody>

Second Table
StructureValue
99OP-11223.P.0125,254,759
99OP-11223.P.01.0125,254,759
99OP-11223.P.01.01.011,910,442
99OP-11223.P.01.01.027,176,356
99OP-11223.P.01.01.033,796,289

<colgroup><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi. See if this works for you:

=INDEX($B$9:$B$13,MATCH(TRUE,INDEX(ISNUMBER(SEARCH(" "&$A$9:$A$13&" "," "&A2&" ")),0),0))

Table 1 in A1:B6. Table 2 in A8:B13
 
Upvote 0
something like...

B3=LOOKUP(2^15,SEARCH($A$11:$A$15,A3),$B$11:$B$15)

Row\Col
A​
B​
1​
First Table
2​
Structure
Value​
3​
** WBS 99OP-11223.P.01 Project RT
25254759​
4​
* WBS 99OP-11223.P.01.01 Project Roots Data
25254759​
5​
WBS 99OP-11223.P.01.01.01 First Line Item
1910442​
6​
WBS 99OP-11223.P.01.01.02 Second Line Products
7176356​
7​
WBS 99OP-11223.P.01.01.03 Third Line Items
3796289​
8​
9​
Second Table
10​
Structure
Value​
11​
99OP-11223.P.01
25,254,759​
12​
99OP-11223.P.01.01
25,254,759​
13​
99OP-11223.P.01.01.01
1,910,442​
14​
99OP-11223.P.01.01.02
7,176,356​
15​
99OP-11223.P.01.01.03
3,796,289​

<tbody>
</tbody>
 
Upvote 0

Unknown
AB
1StructureValue
2** WBS 99OP-11223.P.01 Project RT25254759
3* WBS 99OP-11223.P.01.01 Project Roots Data25254759
4WBS 99OP-11223.P.01.01.01 First Line Item1910442
5WBS 99OP-11223.P.01.01.02 Second Line Products7176356
6WBS 99OP-11223.P.01.01.03 Third Line Items3796289
7
8
9StructureValue
1099OP-11223.P.012,52,54,759
1199OP-11223.P.01.012,52,54,759
1299OP-11223.P.01.01.0119,10,442
1399OP-11223.P.01.01.0271,76,356
1499OP-11223.P.01.01.0337,96,289
15
12 bom page
Cell Formulas
RangeFormula
B2=INDEX($B$10:$B$14,AGGREGATE(14,6,ISNUMBER(SEARCH($A$10:$A$14,A2))*(ROW($A$10:$A$14)-ROW($A$10)+1),1))
 
Upvote 0
This worked great as desired with a little modification. Search should be SEARCH(" "&$A$11:$A$15&" "," "&A3&" "). Otherwise it will search also the value with shorter if exact string is not found.

Thanks for the tip.
 
Upvote 0
something like...

B3=LOOKUP(2^15,SEARCH($A$11:$A$15,A3),$B$11:$B$15)

Row\Col
A​
B​
1​
First Table
2​
Structure
Value​
3​
** WBS 99OP-11223.P.01 Project RT
25254759​
4​
* WBS 99OP-11223.P.01.01 Project Roots Data
25254759​
5​
WBS 99OP-11223.P.01.01.01 First Line Item
1910442​
6​
WBS 99OP-11223.P.01.01.02 Second Line Products
7176356​
7​
WBS 99OP-11223.P.01.01.03 Third Line Items
3796289​
8​
9​
Second Table
10​
Structure
Value​
11​
99OP-11223.P.01
25,254,759​
12​
99OP-11223.P.01.01
25,254,759​
13​
99OP-11223.P.01.01.01
1,910,442​
14​
99OP-11223.P.01.01.02
7,176,356​
15​
99OP-11223.P.01.01.03
3,796,289​

<tbody>
</tbody>

This worked great as desired with a little modification. Search should be SEARCH(" "&$A$11:$A$15&" "," "&A3&" "). Otherwise it will search also the value with shorter if exact string is not found.

Thanks for the tip.

 
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,101
Members
449,205
Latest member
ralemanygarcia

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