+ Reply to Thread
Results 1 to 7 of 7

Vlook for dates and share price

  1. #1
    Registered User
    Join Date
    11-11-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    16

    Vlook for dates and share price

    Hello all,

    Something that it should be straight away it's turning into a nightmare...

    I have a column of dates and then set of pair columns with dates and share prices. I want to use Vlookup to get the share price of the different stocks on the dates of the first column, however is not working properly.

    I cant' not see why is not working - I have tried the usual tricks pass it all to text, trim it... still don't know

    Could you have a look at the attachment and let me know what do you think is the reason?

    vlook up stock price.xlsx

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vlook for dates and share price

    dates in column a are text
    =VLOOKUP(VALUE(A3),G3:$H$3349,2,FALSE) works or change col a to real dates
    select column a data/text to columns next next select dmy click finish
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    11-11-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Vlook for dates and share price

    Thanks Martin,

    I've standardised all columns dates to text but the problem still persists
    I don't see any other difference between the column dates (attached)

    Any other idea?

    Cheers
    Attached Files Attached Files

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vlook for dates and share price

    ??? why to text, to real dates is probably best
    besides that when i open it i see this,looks ok
    but
    what is the 2 for?
    =VLOOKUP(A3,$G$3:$H$6205,2,2) it will work but is just wrong its the same a putting TRUE
    it should be true or false and for an exact match you use FALSE
    =VLOOKUP(A3,$G$3:$H$6205,2,false) or =VLOOKUP(A3,$G$3:$H$6205,2,0) (to all intents 0=FALSE any other number = TRUE)
    if it was TRUE your dates in each column G I K would need to be sorted ascending then vlookup would find he largest value that is less than or equal to lookup_value.
    Attached Images Attached Images
    Last edited by martindwilson; 03-18-2013 at 05:16 AM.

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Vlook for dates and share price

    hi xtasio, why did you use "2" for the last argument of VLOOKUP? use FALSE like martin mentioned or 0:
    =VLOOKUP(A3,$G$3:$H$6205,2,0)

    do the same for the other 2. to counter errors when the dates are not found, use IFERROR (available only from 2007 onwards):
    =IFERROR(VLOOKUP(A3,$G$3:$H$6205,2,0),"")

    to do a standardised formula throughout Column B to D, try:
    =INDEX($G$3:$L$6205,MATCH($A3,INDEX($G$3:$L$6205,,MATCH(B$1,$G$1:$L$1,0)),0),MATCH(B$1,$G$1:$L$1,0)+1)

    your dates are not real dates. but since they are all not real dates, you can continue to use them i guess. as long as it's standardized. to convert to real dates, martin also mentioned about Text To Columns.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  6. #6
    Registered User
    Join Date
    11-11-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Vlook for dates and share price

    Thanks for your help! For some reason I thought 2 meant FALSE on the formula and that it was creating the problem.

    I hope in the future I can help others.

    Cheers

  7. #7
    Registered User
    Join Date
    11-11-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Vlook for dates and share price

    Thanks for your help! For some reason I thought 2 meant FALSE on the formula and that it was creating the problem.

    Also thanks for the additional formulas!

    I hope in the future I can help others.

    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1