Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
cym
 
Posts: n/a
Default 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   Report Post  
Duke Carey
 
Posts: n/a
Default

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
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
Non-sequential VLOOKUP function -OR- sequential sort of web query Eric S Excel Worksheet Functions 1 February 28th 05 07:50 PM
I want to use Vlookup function and AND function in a single formu. prakash Excel Worksheet Functions 3 January 25th 05 07:11 AM
carrying a hyper link when using the vlookup function mike Excel Worksheet Functions 1 November 19th 04 03:49 AM
carrying a hyper link when using the vlookup function mike Excel Worksheet Functions 2 November 18th 04 04:22 PM
Regarding IF function or vLOOKUP function wuwu Excel Worksheet Functions 2 November 13th 04 01:38 PM


All times are GMT +1. The time now is 12:15 AM.

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

About Us

"It's about Microsoft Excel"