+ Reply to Thread
Results 1 to 8 of 8

Application.VLookup returns ZERO instead of a number

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    tokyo
    MS-Off Ver
    Excel 2003
    Posts
    9

    Application.VLookup returns ZERO instead of a number

    Hi,

    I have spent too many hours on this simple macro which just doesn't seem to work ultimately.

    I am trying to bring data from one excel sheet into another using VLookup. The two sheets have different time frequencies in that one is weekly and the other daily. My code returns NA's instead of integers.

    The problem is with the Application.VLookup. Here is my code and I would be grateful for any help!
    Please Login or Register  to view this content.
    Note: msgbox(last_fri) already returns the correct value; a date. The value I am aiming to retrieve is in the 8th column of the sheet"Weekly".

    Thanks,
    Darius
    Last edited by Paul; 04-05-2012 at 06:07 PM.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Having problems with Application.VLookup

    If you lookup table is a single column, H5:H1500, you can possibly compare the lookup value against the 8th column in the lookup table, it just doesn't have a 2nd never mind an 8th.

  3. #3
    Registered User
    Join Date
    04-05-2012
    Location
    tokyo
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Having problems with Application.VLookup

    Hi Bob, can you clarify what you mean? Thanks, Darius

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Application.VLookup returns ZERO instead of a number

    Hi Darius,

    I don't think the Range argument you're using in the Vlookup is correct. Perhaps try:
    Please Login or Register  to view this content.
    I think Bob saw the $a$5:$h$1500 and thought it was $h$5:$h$1500.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Application.VLookup returns ZERO instead of a number

    I reckon that if there is an exact match on the date (which is what you are looking for) then you oughta be using:
    Please Login or Register  to view this content.
    I'd use the range syntax Paul mentioned myself but either one should work fine.

  6. #6
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Application.VLookup returns ZERO instead of a number

    Quote Originally Posted by Paul View Post
    I think Bob saw the $a$5:$h$1500 and thought it was $h$5:$h$1500.
    I saw Paul, I did . My age is destroying my eyes.

  7. #7
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Application.VLookup returns ZERO instead of a number

    With any luck, Bob, you'll be a rabbit in your next life, eating lots of carrots and having perfect vision. And lots of little rabbits.

  8. #8
    Registered User
    Join Date
    04-05-2012
    Location
    tokyo
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Application.VLookup returns ZERO instead of a number

    Hi guys, many thanks for the prompt replies. Josephs Cdbl function ultimately did the trick!! I can go to sleep now!!! Have a good one everyone.

+ 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