interesting vlookup result

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,007
Office Version
  1. 365
Platform
  1. Windows
just did a vlookup that returned a value error. wasn't expecting that so checked my ranges and referencing. all good. to check, did a quick "this cell = that cell" and the result is true. so the lookup value exists in the lookup array. the only thing i can think it might be is that the lookup value in a vlookup is limited to a certain number of characters. seems to be happening to those lookup values with more than 300 characters in the cell. might even be limited below that number. that is just the shortest of the values i am using. any suggestions?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
My understanding is the maximum length can be 255 characters of the value in a VLOOKUP as well as an XLOOKUP, so that's probably your issue.
 
Upvote 0
How about partial VLOOKUP? I mean you can VLOOKUP 255 or less characters only, not 300
For example, below is for 8 characters:
Book1
ABCDE
1abcdefghzzzz5
2
3addd14
4abcdefghijklyyyy25
5ssss36
Sheet2
Cell Formulas
RangeFormula
B1B1=VLOOKUP(LEFT(A1,8),CHOOSE({1,2},LEFT(C3:C5,8),E3:E5),2)
Press CTRL+SHIFT+ENTER to enter array formulas.

1684202483153.png
 
Upvote 0
Both Xlookup & Xmatch can handle more than 255 characters, so you would need to use one of those.
 
Upvote 0
Solution
Both Xlookup & Xmatch can handle more than 255 characters, so you would need to use one of those.
i shall try them and see.as mentioned above, i had thought there was a character limit but couldn't recall whether it had been addressed more recently (thanks Kweaver). I had also tried using partial strings as the lookup value but am dealing with multiple items with very similar codes which can be one or two digits off each other. (thanks bebo)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 1
Fluff: other than you being just plain smart, where is there a spec on Xlookup and Xmatch that says you can use more than 255 in the look-up?
 
Upvote 0
where is there a spec on Xlookup and Xmatch that says you can use more than 255 in the look-up?
No idea, I just discovered by accident that xmatch could & so tested xlookup which was the same.
 
Upvote 0
Thank you SO much for this. I apologise and I've just cluttered up the forum with exactly the same issue, except that my cell values are only 10 characters long.
Have never heard of XLOOKUP before, but just tried it and it works.

Thank you
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

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