Vlookup against last character

excel.vba

New Member
Joined
May 26, 2011
Messages
30
Hello

Wanted to know if there is a formula which allows me to look up against the last character of a range. This is necessary especially when i am looking up against a template.

For example.
If i have a codeNo 100-A, and i need to lookup its definition. There are many codeNo like 101-A,102-A...
The range i need to check against would be xxx-A, since they all follow the same definition. I am not sure if wildcard can be used in the lookup range of the VLOOKUP function.
Currently i am using the following function
=VLOOKUP(("xxx"&RIGHT(A5,2)),Tempate!A:B,2,0)

However, there are times where the template could be 0xx-A. So i cant hardcode the first few characters.

any help would be greatly appreciated. Thanks!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Perhaps I havben't understood, but couldn't you use a standard VLOOKUP?

=VLOOKUP("101-A",Range_to_Lookup,Column_to_look_in,0)
 
Upvote 0
The range i am looking up against is a template range so it will only have the following "xxx-A", "xxx-B","xxx-C", etc. Btw xxx doesnt stand for numbers. It is literally "xxx". So i need to match the last letter of the range i am using to lookup against the last letter of the template range. Hope this clears things up abit
 
Upvote 0
Hello

Wanted to know if there is a formula which allows me to look up against the last character of a range. This is necessary especially when i am looking up against a template.

For example.
If i have a codeNo 100-A, and i need to lookup its definition. There are many codeNo like 101-A,102-A...
The range i need to check against would be xxx-A, since they all follow the same definition. I am not sure if wildcard can be used in the lookup range of the VLOOKUP function.
Currently i am using the following function
=VLOOKUP(("xxx"&RIGHT(A5,2)),Tempate!A:B,2,0)

However, there are times where the template could be 0xx-A. So i cant hardcode the first few characters.

any help would be greatly appreciated. Thanks!

Does one of...

=VLOOKUP("*"&RIGHT(A5),Tempate!A:B,2,0)

=VLOOKUP("*"&RIGHT(A5,2),Tempate!A:B,2,0)

give what you want?
 
Upvote 0
I had already gotten around this problem. But this works awesome as well. Will just use this instead. Thank you for your time and solutions. :)
 
Upvote 0

Forum statistics

Threads
1,224,558
Messages
6,179,512
Members
452,920
Latest member
jaspers

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