How to search strings larger than lookup strings?

Fractalis

Active Member
Joined
Oct 11, 2011
Messages
328
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a list of strings in column A and I want to search strings that are smaller and larger than the list in column A.

To search smaller strings I could use wildcard within VLOOKUP(), but how to search larger strings?

For example, if I compare the string ABCDEFGHIJKLM in D5 with the strings in Col A, the strings that are more similar with string in D5
are ABCDEFG and ABCDEFGHIW, but the selected should be ABCDEFGHIW since it has 9 characters in common and only has 7 characters
in common with string ABCDEFG. So, the Letter related is Y, that would be the correct answer.

ABCDEFGHIJKLM
ABCDEFGHIW --> 9 characters in common in same order from left to right

ABCDEFGHIJKLM
ABCDEFG --> 7 characters in common in same order from left to right


File1.xlsx
ABCDE
1STRINGLETTERSTRING SMALLER THAN COL A STRINGSLETTER
2ABCJKPORQABCDEH
3ABCDEFGH
4ABCKKHSPLLZTSTRING LARGER THAN COL A STRINGSLETTER
5ABCDEFGHIWYABCDEFGHIJKLMY
Sheet1
Cell Formulas
RangeFormula
E2E2=VLOOKUP(D2&"*",A1:B5,2,FALSE)
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
There's probably a much better wayt but maybe try TRUE in place of FALSE. TRUE returns an approximate match whereas FALSE is an exact match.
 
Upvote 0
There's probably a much better wayt but maybe try TRUE in place of FALSE. TRUE returns an approximate match whereas FALSE is an exact match.
Uhhh, no. Doesn't work. VLOOKUP() alone only works for exact matches in my case
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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