How to search for a specific text within a cell and return the value of neighboring cell

sklinke

New Member
Joined
Jun 7, 2011
Messages
2
Hi,

I have a small problem:
I would like to search for a specific text string within different cells that contains a lot of text and return the value of the cell next to the matching cell.

E.G.
In the example below I am looking for the cell containing the string "Blue" (A1) , which is B3, and I would like the formula to return "3" (C3)

Could someone help me?
Thanks in advance!



A1=Blue B1=Black, White C1=1
B2=Yellow, Orange Braun C2=2
B3=Green, Blue Violet C3=3
B4=Red, Pink C4=4
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi,

I have a small problem:
I would like to search for a specific text string within different cells that contains a lot of text and return the value of the cell next to the matching cell.

E.G.
In the example below I am looking for the cell containing the string "Blue" (A1) , which is B3, and I would like the formula to return "3" (C3)

Could someone help me?
Thanks in advance!



A1=Blue B1=Black, White C1=1
B2=Yellow, Orange Braun C2=2
B3=Green, Blue Violet C3=3
B4=Red, Pink C4=4
Maybe this...

Book1
ABC
1BlueBlack, White1
23Yellow, Orange Braun2
3_Green, Blue Violet3
4_Red, Pink4
Sheet1

Formula entered in A2:

=INDEX(C1:C4,MATCH("*"&A1&"*",B1:B4,0))
 
Upvote 0
Thank you so much, both solutions work!
Actually it was the "*"&A1&"*" syntax that I didn't find in my book...

Thanks again! :)
 
Upvote 0
Biff,

Would your vlookup formula work also on my formula? I am having an issue with this one not grabbing the information. The only result that I am getting is the Error code No Such Product Found.

Code:
Private Sub UPCNum_Change()
If Len(UPCNum.Text) = 14 Then
On Error Resume Next
x = Application.WorksheetFunction. _
VLookup(CDbl(UPCNum.Text), Worksheets("Data").Range("A2:E50000"), 2, False)
If Err.Number = 0 Then
Description = x
Else
Description = "No such product found"
End If
On Error GoTo 0
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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