Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Vlookup only the last 6 characters

I have a spreadsheet starting in cell A4. I want to lookup only the last 6
digits in column A and then lookup the value in column J and return the
appropriate value from column K.

The values in column A are 000322341; 000333456; etc.

The values in column J are 322341; 333456; etc.

Here is my current non working formula...
=VLOOKUP(RIGHT(A4,6),$J$4:$K$7,2,0)

Any help would be appreciated. Thanks.
  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: Vlookup only the last 6 characters

Hi there! It looks like you're trying to use the
Formula:
VLOOKUP 
function in Excel to lookup values based on the last 6 characters in a cell. Your formula is close, but you just need to make a small adjustment.

Instead of using the
Formula:
RIGHT 
function to extract the last 6 characters, you can use the
Formula:
MID 
function to extract characters from the middle of a string. Here's the formula you can use:
  1. Formula:
    =VLOOKUP(MID(A4,LEN(A4)-5,6),$J$4:$K$7,2,FALSE

Let me break down this formula for you:
  1. MID(A4,LEN(A4)-5,6) extracts 6 characters starting from the 6th character from the end of the string in cell A4. The
    Formula:
    LEN 
    function returns the length of the string, so
    Formula:
    LEN(A4)-
    gives you the position of the 6th character from the end, and 6 is the number of characters to extract.
  2. $J$4:$K$7 is the range of cells you want to search for the lookup value.
  3. 2 is the column number in the lookup range that contains the values you want to return.
  4. FALSE means you want an exact match for the lookup value.

Make sure to adjust the lookup range to include all the values you want to search, and adjust the column number to match the column that contains the values you want to return.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default Vlookup only the last 6 characters

The RIGHT function is returning a text value, and I'm guessing that the
values in column J are true numbers. So you'd need to covert the text back
to numbers in order to have the lookup work properly:
=VLOOKUP(VALUE(RIGHT(A4,6)),$J$4:$K$7,2,0)

"JoeP" wrote:

I have a spreadsheet starting in cell A4. I want to lookup only the last 6
digits in column A and then lookup the value in column J and return the
appropriate value from column K.

The values in column A are 000322341; 000333456; etc.

The values in column J are 322341; 333456; etc.

Here is my current non working formula...
=VLOOKUP(RIGHT(A4,6),$J$4:$K$7,2,0)

Any help would be appreciated. Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Vlookup only the last 6 characters

Fantastic - thank you so much.

"bapeltzer" wrote:

The RIGHT function is returning a text value, and I'm guessing that the
values in column J are true numbers. So you'd need to covert the text back
to numbers in order to have the lookup work properly:
=VLOOKUP(VALUE(RIGHT(A4,6)),$J$4:$K$7,2,0)

"JoeP" wrote:

I have a spreadsheet starting in cell A4. I want to lookup only the last 6
digits in column A and then lookup the value in column J and return the
appropriate value from column K.

The values in column A are 000322341; 000333456; etc.

The values in column J are 322341; 333456; etc.

Here is my current non working formula...
=VLOOKUP(RIGHT(A4,6),$J$4:$K$7,2,0)

Any help would be appreciated. Thanks.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLOOKUP and single Characters Sean NWIC[_2_] Excel Discussion (Misc queries) 4 September 2nd 09 07:17 PM
Insert Leading Characters If String Is Only 7 Characters Paperback Writer Excel Discussion (Misc queries) 2 April 21st 09 09:07 PM
vlookup removing characters ryan Excel Worksheet Functions 2 April 21st 09 08:28 PM
In Excel find characters when multiple characters exist w/i a cel teacher-deburg Excel Worksheet Functions 1 December 5th 05 10:22 PM
vlookup first 4 characters only in a column Gus Excel Discussion (Misc queries) 6 February 20th 05 04:41 PM


All times are GMT +1. The time now is 01:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"