Does cell A contain cell C formula/macro help

timohteee

New Member
Joined
Jul 1, 2015
Messages
13
Hello,

I have a spreadsheet right now that contains a column for a unique identifier of a file. These strings can be over 380 characters long. I have another spreadsheet that has a master list of these unique IDs some of which contain a pipe delimiter because they have multiple values within one cell.

I'll try and explain with this simple table (my data is more complex)

Table A:

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[/TR]
[TR]
[TD]cat[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dog[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]door[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]








Table B:

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Column C[/TD]
[TD]Column D[/TD]
[/TR]
[TR]
[TD]cat|lizard|ant|hamster[/TD]
[TD]small[/TD]
[/TR]
[TR]
[TD]dragon|hippo|dog|buffalo[/TD]
[TD]big[/TD]
[/TR]
[TR]
[TD]stove|door|microwave|television[/TD]
[TD]home[/TD]
[/TR]
</tbody>[/TABLE]








Basically what I want is to search for the string 'cat' from Column A in Column C and then pull back Column D into Column B. So the first cell in Column B would be return the value 'small'.

Right now, I have delimited Column C and I'm running multiple VLOOKUPs (one at a time) while also using the RIGHT formula because as I said, the characters exceed the amount accepted by VLOOKUP.

Code:
=VLOOKUP("*"&RIGHT(A1,240),'[Book1.xlsx]Sheet1'!$A:$B,2,0)

If I continue with this method of delimiting the cell and running VLOOKUPs one at a time, I'll have to do at least 40 more VLOOKUPs.

Any easier way to accomplish this?
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hitimohteee
That won't work without a slight change to the data in Table B, you will need every word to be enclosed with the pip IE "cat|lizard|ant|hamster" will need to be "|cat|lizard|ant|hamster|", then this will work:-
=INDEX(Sheet1!$D:$D,MATCH("*|" &A2&"|*",Sheet1!C:C,0),1)

=index(sheet1!$D:$D This will be the range to return in table B Column D, matchMATCH("*|" &A2&"|*" A2 will be the lookup value in Table A column A &"|*",Sheet1!C:C,0),1) and Sheet1!C:C will be the list of names to search
 
Upvote 0
Thanks for your reply, Firesword. However, that doesn't fit my needs as I'm basically looking to search for the string within a cell and pull back the cell right next to it. I don't have all the values that will be within Column C from Table B nor the order they will be in.
 
Upvote 0
That formula will take the name in Table A, Column A, ie Cat and look for cat in any format in table B column C and then return the value in table B column D, is that what you were after? The reason I suggested the change is if you had Catfish in your string, and catfish was infront of cat then it would report the value of catfish and not cat. In your string all you'd need to do is make sure that you start with a | and end with a | for each item.
 
Upvote 0

Forum statistics

Threads
1,223,905
Messages
6,175,297
Members
452,633
Latest member
DougMo

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