Lookup string within list of values

LEXCERM

Active Member
Joined
Jun 26, 2004
Messages
320
Office Version
  1. 365
Platform
  1. Windows
Hi.

I have three values, AB CD EF, in separate columns (col A, B and C)

I want to look these up in a list of strings in column E:
ABTGFR
FVCDXY
YTDREF
ABXYEF

Now here's the difficult bit of trying to explain it!

1) Take AB and look this up in the first two characters only of each string in the list.
2) Take CD and look this up within the 3rd and 4th characters only of each string in the list.
3) Take EF and look this up in the last two characters only of each string in the list.

If the string in the list is ABCDEF then you have a complete match. If the string is, say, ABxxEF, or xxCDEF, or just xxCDxx, then these are partial matches.

I need to identify which strings in the list match any part of AB CD EF in that order.

Easy peasy! :-S

Many thanks in advance. :)
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try
=IFERROR(SEARCH($A$1&"????",E1),0)+IFERROR(SEARCH("??"&$B$1&"??",E1),0)+IFERROR(SEARCH("????"&$C$1,E1),0)
 
Upvote 0
A hacked together method would be something like:

SUM(IF(Left(range, 2)="AB", 1, 0), IF(MID(range,3,2)="CD", 1, 0), IF(RIGHT(range,2)="EF", 1, 0))

Edit: this would return 3 for a complete match, 1 or 2 for a partial match and 0 for no match. If you want it to be more dynamic I could come up with something - do you have any particular requirements?

Second edit: As pointed out below, the MID() should be MID(range,3,2)
 
Last edited:
Upvote 0
Makers the mid should be
=SUM(IF(LEFT(E1, 2)="AB", 1, 0), IF(MID(E1,3,2)="CD", 1, 0), IF(RIGHT(E1,2)="EF", 1, 0))
 
Upvote 0
Thank you very much for all your feedback. Will try these out today. :)
 
Upvote 0

Forum statistics

Threads
1,215,581
Messages
6,125,656
Members
449,247
Latest member
wingedshoes

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