+ Reply to Thread
Results 1 to 2 of 2

Vlookup w/Date Function

  1. #1
    cym
    Guest

    Vlookup w/Date Function

    I use VLOOKUP with DATE function as the lookup value. I set the
    range_lookup=FALSE so I am expecting an exact match or an error will result
    (#NA).
    Within the DATE function, I determine the year and month and then I supply a
    day value between 0-31. Everything works as expected if the day value is
    between 1-31. But if the day value is 0, then the VLOOKUP returns result for
    the last day of the previous month instead of an error. Here is the function:
    VLOOKUP(DATE(YEAR(R31C2),MONTH(R31C2),DAY(R[-1]C)),
    Scheduled_Installation_Date,2,FALSE)


  2. #2
    Duke Carey
    Guest

    RE: Vlookup w/Date Function

    Force an error by using this in place of your DAY() function:

    IF(DAY(R[-1]C)=0,NA() ,DAY(R[-1]C))

    "cym" wrote:

    > I use VLOOKUP with DATE function as the lookup value. I set the
    > range_lookup=FALSE so I am expecting an exact match or an error will result
    > (#NA).
    > Within the DATE function, I determine the year and month and then I supply a
    > day value between 0-31. Everything works as expected if the day value is
    > between 1-31. But if the day value is 0, then the VLOOKUP returns result for
    > the last day of the previous month instead of an error. Here is the function:
    > VLOOKUP(DATE(YEAR(R31C2),MONTH(R31C2),DAY(R[-1]C)),
    > Scheduled_Installation_Date,2,FALSE)
    >


+ 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