Vlookup variables

Smeggy

Board Regular
Joined
Mar 7, 2013
Messages
151
Hi All,
Hopefully this should be quick and simple and ive probaby asked about it before but; this is the original vlookup:


Range("D" & a).Formula = "=VLOOKUP(" & Range("A" & a) & ",'[17-09-2014_Name.xls]9. MEAS Site Detail'!$B:$X,23,FALSE)"


What i need to do is add a variable date i.e. Now -1 (yesterdays date)
This is what ive got but desn't work


Range("D" & a).Formula = "=VLOOKUP(" & Range("A" & a) & ",'(Format(now - 1, "dd-mm-yyyy")) & ["_Name.xls"]9. MEAS Site Detail'!$B:$C,2,FALSE)"

Any help would be appreciated.
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Comfy

Well-known Member
Joined
Dec 21, 2009
Messages
3,377
Give this a try:

Range("D" & a).Formula = "=VLOOKUP(" & Range("A" & a) & ",'[" & Format(now() - 1, "dd-mm-yyyy") & "_Name.xls]9. MEAS Site Detail'!$B:$C,2,FALSE)"
 

Watch MrExcel Video

Forum statistics

Threads
1,108,969
Messages
5,525,961
Members
409,673
Latest member
Riseee

This Week's Hot Topics

Top