Vlookup restricted to 255 String Search ?

SamBo1234

Board Regular
Joined
Aug 21, 2006
Messages
77
Hi all,

Been working with some rather lengthy data, and have just finally after about 2 hours of nearly pulling my hair out realised that VLOOKUP only works with strings = to or less than 255 Characters.

Is there anyway around this problem?

I have strings, approximatley 600+ in some cases and would rather not split the strings up so i can perform a simple VLOOKUP function.

Any help is appreciated. TY all.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try this:
Book1
BCDE
2sallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesallyjessesred
3johndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoeorange
4dilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertdilbertyellow
5
6
7
8orange
9johndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoejohndoe
Sheet2


=INDEX(C:C,MAX(IF(B2:B4=B9,ROW(B2:B4),0))) confirmed with Ctrl+Shift+Enter
 
Upvote 0
Hi There,

Thanks for your reply but it doesnt solve my problem, let me make it a bit clearer.

SHEET 1

I have Strings of text between 0 and 600 in length in column A (Approximatley 1000 rows)

SHEET 2

I have the exact same strings of text in Sheet 2 (different order), in column A but in column B it has references relating to that data. I.e Numbers, Text etc

I want to be able to return the Value in Column B, in Sheet 2, in Column B, Sheet 1 if there is a Match.

Easy enough to do with vlookup however, i cant get around the restriction where vlookup only alows max 255 character string searchs without having to mess about with the data.

Regards
Sam
 
Upvote 0
I tried Hatman's solution and it seems to do what you asked....

This is the formula with the sheet names included. Remember you must confirm it with CTRL+SHIFT+ENTER not just Enter..you'lll see curly brackets at the ends of the formula if you confirmed it correctly...

=INDEX(Sheet2!B:B,MAX(IF(Sheet2!A2:A1000=A2,ROW(Sheet2!A2:A1000),0)))

where A2 bolded is the lookup value in Sheet1.

adjust the ranges to suit and copy down.
 
Upvote 0
Hello Again, Thanks for the help guys really appreciate it,

I still seem to have problems, i have used the formula as given, and used CTRL-SHIFT-ENTER to confirm it however the values are returning as #NUM! for each entry.

This is what my formula is.

{=INDEX('Test Data'!B:B,MAX(IF('Test Data'!A:A='Server Error Data'!G2,ROW('Test Data'!A:A),0)))}

Test Data im assuming represents Sheet2
Server Error Data represents Sheet1

This correct ?
 
Upvote 0
Please post your exact formula.

Also verify that you have not referenced the entire column in the Max() function... in other words =INDEX(C:C,MAX(IF(B:B=E9,ROW(B:B),0))) will result in a #NUM! error, while =INDEX(C:C,MAX(IF(B2:B4=E9,ROW(B2:B4),0))) works fine... it's just the way that Array formulas behave.
 
Upvote 0
Ahhhhhhhh, thats why then.

Sorry i have referenced the entire columns.

I didnt know u had to be specific in the range of cells in the formula, Sorry guys, im just beginning to grasp this sort of stuff :)

I have now tryed it with selected ranges and it works!....

Many thanks all sorry it took so long to figure it out :)

Cheers
 
Upvote 0
Ahhhhhhhh, thats why then.

Sorry i have referenced the entire columns.

I didnt know u had to be specific in the range of cells in the formula, Sorry guys, im just beginning to grasp this sort of stuff :)

I have now tryed it with selected ranges and it works!....

Many thanks all sorry it took so long to figure it out :)

Cheers

HAH! Took me a lot longer than that to figure it out for myself :LOL: No harm, no foul, that's why we are here: to help!

Array formulas are funny things, and they require discreet ranges for iteration to operate porperly... on the OTHER hand, a full column can be referenced within an array formula, as long as it is the argument for a function that CAN deal with a full column... hence the Index() function works fine in yoru example when it references a full column.

If your data may vary in length, thus reulting in varying references that may need updating, you can consider creating a Dynamic Range instead... just a thought.
 
Upvote 0
Hi hatman,

thanks for your solution for the above problem. I have a similar problem, but it's a little bit special and I'm not able to solve it.

It would be great, if you can take a look:

I want to search for the string "xxx" in the cells B2:B4. Therefore I have added to B4 the string "xxx". And changed the formula like follows:
=INDEX(C:C;MAX(IF(B2:B4="*"&B9&"*";ROW(B2:B4);0)))

However I don't get back the value "grey". Instead of that I get back only "0".

Do you know why? Hopefully you have a solution for my problem, or anybody else.

Thanks in advance.
 
Upvote 0
Welcome to the board!

I assume that you have implemented this method because you have values in your table that exceed 255 characters. Unfortunately this method does not support the use of wildcards... only the 3 Lookup() functions can do that. However, the following change can be made to provide a match when the search string is found within the strings contained in the specified range.

Code:
=INDEX(C:C,MAX(IF(ISNUMBER(SEARCH(B9,B2:B4)),ROW(B2:B4),0)))
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,855
Members
449,096
Latest member
Erald

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