Vlookup w/Date Function

G

Guest

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)
 
G

Guest

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

MONTH function 2
vlookup formatting problem 1
Trapping errors in a VLOOKUP function 1
Nested If with VLookup result a 0 8
vlookup help plz 2
date function 10
DATE function 5
Excel Vba to change displayed year automatically. 14

Top