Search a column for content equal to a cell and return cell value adjacent

ninsianna

New Member
Joined
May 20, 2014
Messages
2
Not sure I described that well, but here's my example:

I have this cross referenced code and reference numbers:
CodeRef numbers
OQ COR 017, 7.1, 7.2, 7.3, 7.4, 7.5, 7.7
OQ COR 025.2, 7.6, 13, 13.1, 13.2, 13.3, 13.4, 13.5,
OQ COR 0310, 10.1, 10.2, 11
OQ COR 048, 8.1, 8.3, 12,
OQ COR 055, 5.1, 5.2,5.3, 8, 8.1, 8.3,

<tbody>
</tbody>

I have a list of reference numbers:

Ref #
4.3
5.1
5.2
5.3
7.1
7.2
7.3
7.4
7.5

<tbody>
</tbody>

<tbody>
</tbody>

I would like to search the Ref numbers to see if the Ref # is included, and if so, return the contents of the adjacent cell.

So : if the contents of C1 are included in column Y, in cell Y3, then return the contents of X3

The biggest issue is of course that the contents in column Y include multiple reference #s, so I'm not looking for an exact match. Even if I split them into individual columns, I'm not getting an accurate result with lookup or vlookup
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try this:

Layout

CodeRef numbers Ref #Codes
OQ COR 017, 7.1, 7.2, 7.3, 7.4, 7.5, 7.7 4.3
OQ COR 025.2, 7.6, 13, 13.1, 13.2, 13.3, 13.4, 13.5, 5.1OQ COR 05
OQ COR 0310, 10.1, 10.2, 11 5.2OQ COR 02OQ COR 05
OQ COR 048, 8.1, 8.3, 12, 5.3OQ COR 05
OQ COR 055, 5.1, 5.2,5.3, 8, 8.1, 8.3, 7.1OQ COR 01
7.2OQ COR 01
7.3OQ COR 01
7.4OQ COR 01
7.5OQ COR 01
8.3OQ COR 04OQ COR 05
****************************************************************************************
<colgroup><col width="57" style="width: 43pt; mso-width-source: userset; mso-width-alt: 2084;"> <col width="201" style="width: 151pt; mso-width-source: userset; mso-width-alt: 7350;"> <col width="17" style="width: 13pt; mso-width-source: userset; mso-width-alt: 621;"> <col width="32" style="width: 24pt; mso-width-source: userset; mso-width-alt: 1170;"> <col width="62" style="width: 47pt; mso-width-source: userset; mso-width-alt: 2267;" span="3"> <tbody> </tbody>

Formula

Code:
In E2 - use Ctrl+Shift+Enter to enter the formula

=IFERROR(INDEX($A$2:$A$6,
SMALL(IF(ISNUMBER(SEARCH(","&$D2&",",","&SUBSTITUTE($B$2:$B$6," ","")&",")),ROW($B$2:$B$6)-ROW($B$2)+1),COLUMNS($E2:E2))),"")

And copy to the right and down.

Markmzz
 
Upvote 0
Thank you for your quick response, and my apologies for my ignorance. I'm just not that experienced with the advanced formula features of excel. Using the formula you provided with the same layout I get the following results, where the Code returned is the same code on that row, as opposed to the code in the cell adjacent to the Ref numbers containing the Ref#. I've been playing around with it a bit, and still am not getting the correctly referenced cell.

CodeRef numbersRef #Codes
OQ COR 017, 7.1, 7.2, 7.3, 7.4, 7.5, 7.74.3OQ COR 01
OQ COR 025.2, 7.6, 13, 13.1, 13.2, 13.3, 13.4, 13.5,5.1OQ COR 02
OQ COR 0310, 10.1, 10.2, 115.2OQ COR 03
OQ COR 048, 8.1, 8.3, 12,5.3OQ COR 04
OQ COR 055, 5.1, 5.2,5.3, 8, 8.1, 8.3,7.1OQ COR 05
7.2
7.3
7.4

<tbody>
</tbody>
 
Upvote 0
Codes and ref numbers are assumed to be in X:Y with headers in the first row.

Refs for which codes must be returned in colum C from row 1 on.

D1, copied down:
Rich (BB code):
=IFERROR(LOOKUP(9.99999999999999E+307,
  SEARCH(","&C1&",",","&SUBSTITUTE(Sheet1!$Y$2:$Y$6," ","")&","),
  Sheet1!$X$2:$X$6),"Not Found")

See:

https://dl.dropboxusercontent.com/u/65698317/ninsianna lookup search.xlsx
 
Last edited:
Upvote 0
Thank you for your quick response, and my apologies for my ignorance. I'm just not that experienced with the advanced formula features of excel. Using the formula you provided with the same layout I get the following results, where the Code returned is the same code on that row, as opposed to the code in the cell adjacent to the Ref numbers containing the Ref#. I've been playing around with it a bit, and still am not getting the correctly referenced cell.

CodeRef numbersRef #Codes
OQ COR 017, 7.1, 7.2, 7.3, 7.4, 7.5, 7.74.3OQ COR 01
OQ COR 025.2, 7.6, 13, 13.1, 13.2, 13.3, 13.4, 13.5,5.1OQ COR 02
OQ COR 0310, 10.1, 10.2, 115.2OQ COR 03
OQ COR 048, 8.1, 8.3, 12,5.3OQ COR 04
OQ COR 055, 5.1, 5.2,5.3, 8, 8.1, 8.3,7.1OQ COR 05
7.2
7.3
7.4

<tbody>
</tbody>

First, did you press Ctr+Shift+Enter to enter the formula?

Second, could you post the formula that you used?

Markmzz
 
Upvote 0
First, did you press Ctr+Shift+Enter to enter the formula?

Second, could you post the formula that you used?

Markmzz


Hello,

I am trying something very similar to this but with email addresses.

Here is what I have.

Column A has an ID #

Column B has a set of email addresses

Column C has a set of email addresses

If column B has a match anywhere in Column C then I want Column D to display the ID # that is in Column A of the match.
 
Upvote 0
Hello,

I am trying something very similar to this but with email addresses.

Here is what I have.

Column A has an ID #

Column B has a set of email addresses

Column C has a set of email addresses

If column B has a match anywhere in Column C then I want Column D to display the ID # that is in Column A of the match.

Could you post a small example?

Use the table below for that.

ID#Email**EmailID's
**
**
**
**
**
**
**
**
**
**
**********************************************************************************************************

<tbody>
</tbody>

Markmzz
 
Upvote 0
Could you post a small example?

Use the table below for that

ID#Email**EmailID's
12134test@yahoo.com**tester@yahoo.com88888
99999Happy@yahoo.com**test@yahoo.com12134
88888tester@yahoo.com**Happy@yahoo.com99999
**
**
**
**
**
**
**
**********************************************************************************************************

<tbody>
</tbody>

Markmzz

Here you go - Let me know if you have further questions. Basically if there is an email address in Column C that has a match in Column A. Then I want it to return the corresponding ID to the left of Column A in Column D.
 
Upvote 0
Here you go - Let me know if you have further questions. Basically if there is an email address in Column C that has a match in Column A. Then I want it to return the corresponding ID to the left of Column A in Column D.

Try this:

Layout

ID#Email**EmailID's
12134test@yahoo.com**tester@yahoo.com88888
99999Happy@yahoo.com**test@yahoo.com12134
88888tester@yahoo.com**Happy@yahoo.com99999
********************************************************
<colgroup><col width="42" style="width: 32pt; mso-width-source: userset; mso-width-alt: 1536;"> <col width="108" style="width: 81pt; mso-width-source: userset; mso-width-alt: 3949;"> <col width="17" style="width: 13pt; mso-width-source: userset; mso-width-alt: 621;"> <col width="108" style="width: 81pt; mso-width-source: userset; mso-width-alt: 3949;"> <col width="42" style="width: 32pt; mso-width-source: userset; mso-width-alt: 1536;"> <tbody> </tbody>

Formula

Code:
In E2

=IFERROR(INDEX($A$2:$A$4,MATCH($D2,$B$2:$B$4,0)),"")

Markmzz
 
Upvote 0
Try this:

Layout

ID#Email**EmailID's
12134test@yahoo.com**tester@yahoo.com88888
99999Happy@yahoo.com**test@yahoo.com12134
88888tester@yahoo.com**Happy@yahoo.com99999
********************************************************

<tbody>
</tbody>

Formula

Code:
In E2

=IFERROR(INDEX($A$2:$A$4,MATCH($D2,$B$2:$B$4,0)),"")

Markmzz

That did not work for me. It returned blank data.
 
Upvote 0

Forum statistics

Threads
1,216,091
Messages
6,128,775
Members
449,468
Latest member
AGreen17

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