Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-04-2009, 12:10 PM
holiday4ever holiday4ever is offline
Registered User
 
Join Date: 06 May 2008
Posts: 16
holiday4ever is becoming part of the community
VLOOKUP and RIGHT

Please Register to Remove these Ads

I seem cannot get the code right, see below.

Cell: A3= Week 5

=VLOOKUP(RIGHT($A$3,LEN($A$3)-5),Lane!$A$9:$AD$20,3)

It won't work....

However, if I tried as follows,
=VLOOKUP(5,Lane!$A$9:$AD$20,3) OR
=RIGHT($A$3,LEN($A$3)-5)
Both works fine!!!

But I do rather something like as it is shown on the above in RED TEXT

Also I am worried if I have Week 10 the output will look as 0 instead of 10 so please advise what is the right code.

Thank you for your help.

Last edited by holiday4ever; 07-05-2009 at 03:45 AM.
Reply With Quote
  #2  
Old 07-04-2009, 12:18 PM
Ancalagon12321 Ancalagon12321 is offline
Registered User
 
Join Date: 03 Jul 2009
Location: London, England
MS Office Version:Excel 2003
Posts: 17
Ancalagon12321 is becoming part of the community
Re: VLOOKUP and RIGHT

The problem here is the distinction between numbers and text strings.

The RIGHT function is returning the text string "5". But your column of numbers doesn't contain "5" it only contains the number 5.

To convert a text string into a number use VALUE. E.g. VALUE("5") = 5.
Reply With Quote
  #3  
Old 07-04-2009, 12:30 PM
martindwilson's Avatar
martindwilson martindwilson is online now
Forum Guru
 
Join Date: 23 Jun 2007
Location: London,England
MS Office Version:office 97 ,2003 ,2007
Posts: 6,084
martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding
Re: VLOOKUP and RIGHT

Just add - -
=VLOOKUP(--RIGHT($A$3,LEN($A$3)-5),$A$9:$AD$20,3,false)
__________________
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code

how to enter array formula


recommended reading
wiki Mojito

how to say no convincingly

most important think you need
Reply With Quote
  #4  
Old 07-04-2009, 07:32 PM
holiday4ever holiday4ever is offline
Registered User
 
Join Date: 06 May 2008
Posts: 16
holiday4ever is becoming part of the community
Re: VLOOKUP and RIGHT

Thanks Ancalagon12321 and martindwilson. I add "VALUE" see following details....

=VLOOKUP(VALUE(RIGHT($A$3,LEN($A$3)-5)),Lane!$A$9:$AD$20,3)

=VLOOKUP(VALUE(--RIGHT($A$3,LEN($A$3)-5)),Lane!$A$9:$AD$20,3,FALSE)

Both works fine. Thank you very much.

Last edited by holiday4ever; 07-04-2009 at 07:50 PM. Reason: To correct my answer
Reply With Quote
  #5  
Old 07-04-2009, 08:07 PM
martindwilson's Avatar
martindwilson martindwilson is online now
Forum Guru
 
Join Date: 23 Jun 2007
Location: London,England
MS Office Version:office 97 ,2003 ,2007
Posts: 6,084
martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding
Re: VLOOKUP and RIGHT

you dont need "value"
__________________
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code

how to enter array formula


recommended reading
wiki Mojito

how to say no convincingly

most important think you need
Reply With Quote
  #6  
Old 07-04-2009, 08:55 PM
Ancalagon12321 Ancalagon12321 is offline
Registered User
 
Join Date: 03 Jul 2009
Location: London, England
MS Office Version:Excel 2003
Posts: 17
Ancalagon12321 is becoming part of the community
Re: VLOOKUP and RIGHT

martin:

True, but you don't need "--" either

I prefer using VALUE because double-minus only "just so happens" to work, thanks to Excel's implicit type-casting rules, whereas the VALUE function was put there for express purpose of turning text into numbers.

So I think using VALUE is clearer for any non-Excel-guru who has to understand and maintain the formulas.
Reply With Quote
  #7  
Old 07-04-2009, 09:06 PM
martindwilson's Avatar
martindwilson martindwilson is online now
Forum Guru
 
Join Date: 23 Jun 2007
Location: London,England
MS Office Version:office 97 ,2003 ,2007
Posts: 6,084
martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding
Re: VLOOKUP and RIGHT

piffle and balderdash !
__________________
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code

how to enter array formula


recommended reading
wiki Mojito

how to say no convincingly

most important think you need
Reply With Quote
  #8  
Old 07-04-2009, 10:10 PM
holiday4ever holiday4ever is offline
Registered User
 
Join Date: 06 May 2008
Posts: 16
holiday4ever is becoming part of the community
Re: VLOOKUP and RIGHT

Thanks again to you both for pointing this out, martindwilson yeah you are right I do can do without the value. So I understand that I can use either of them. I am looking to improve my knowledge especially in Excel formulas and functions so I am wondering could anyone send a private email of recommended books to me. Thanks
Reply With Quote
  #9  
Old 07-04-2009, 11:08 PM
tigertiger tigertiger is offline
Forum Contributor
 
Join Date: 11 Nov 2008
Location: The Earth
Posts: 194
tigertiger has been very helpful
Re: VLOOKUP and RIGHT

holiday4ever
If that takes care of your need, Plz, EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Forum Jump