If a cell contains specific characters in specific positions, return another specified value

E_Tags

New Member
Joined
Oct 31, 2017
Messages
8
Can someone please help me with a formula to do the following? I can't find any previous solutions.

If a value from column A, features in any value in column C as the 3rd and 4th value, return the value from column B corresponding to the value in column A. Results being returned in column D.

:confused:


[TABLE="width: 500"]
<tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD]Column C[/TD]
[TD]Column D[/TD]
[/TR]
[TR]
[TD]AB[/TD]
[TD]Apples[/TD]
[TD]12XY9009[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]XY[/TD]
[TD]Bananas[/TD]
[TD]35AB1221[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]DX[/TD]
[TD]Pears[/TD]
[TD]96AB9875[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]FR[/TD]
[TD]Oranges[/TD]
[TD]89DX6854[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I think we (I) had the lookup the wrong way round, you can try..

Excel 2013/2016
ABCD
Column AColumn BColumn CColumn D
ABApples12XY9009
XYBananas35AB1221Apples
DXPears96AB9875Apples
FROranges89DX6854Pears
AAGrapesAAZZ123Kiwi
ZZKiwiZZAA123Grapes

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="bgcolor: #FFFF00"]Bananas[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]

[TD="align: center"]6[/TD]

[TD="align: center"]7[/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]D2[/TH]
[TD="align: left"]=INDEX($B$2:$B$7,MATCH(MID(C2,3,2),$A$2:$A$7,0))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


Sorry I missed this response. This works perfectly, thank you so much!!
 
Upvote 0
I think we (I) had the lookup the wrong way round, you can try..

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]D2[/TH]
[TD="align: left"]=INDEX($B$2:$B$7,MATCH(MID(C2,3,2),$A$2:$A$7,0))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


This has worked perfectly for the most part, I have just encountered one issue I am hoping you can help me with? When I use the MID function to select one number it returns "#N/A". It works to return one letter, just not a number. Any ideas?

Below is the formula used:

=INDEX($AP$2:$AP$300,MATCH(MID(B4,22,1),$AN$2:$AN$300,0))
 
Upvote 0
Any ideas?

Hi, if there are a combination of numbers and letters in $AN$2:$AN$300 then try to re-enter the ones in that range that are numbers with a single quote ' in front of the number to make them text.
 
Upvote 0
Hi, if there are a combination of numbers and letters in $AN$2:$AN$300 then try to re-enter the ones in that range that are numbers with a single quote ' in front of the number to make them text.

Perfection, thank you!!
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,214
Members
453,024
Latest member
Wingit77

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