Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 85
Default VLOOKUP with a date, from A1 = Now()

Is it possible to set a VLOOKUP to retrieve values using a Date, then setting
the date cell to =NOW(), then retain those values after the date.

For example, I have a workbook that is used to keep track of arrivel times
at a set location. Every sheet in the wookbook is the same location, one
sheet for each day of the month. Column B has the vehicle numbers use on a
specific day. Each day the drivers use a different vehicle.
The vehicles are entered in a feeder sheet each day in a different workbook.

My idea is to have column B of the location workbook retrieve the vehicle
numbers on the date the location sheet is being used.

So far this is all I have in column B.

=IF($A$1=DATE(2009,12,1),VLOOKUP(A3,Feeder!$F$2:$G $121,2,0),"")

is it possible to set A1 to NOW() and still retrieve the vehicle numbers?

Any help is appreciated.






  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default VLOOKUP with a date, from A1 = Now()

First, =now() includes the date and time, so:

=if(a1=date(...), ...
Will only match if you're lucky enough to calculate at Midnight of that date.

You could use:
=today()
in a1
or modify the formula to ignore the time:
=if(int(a1)=date(...), ...

But the real problem is that the formula will not maintain the results if you
leave it a formula. Even when calculation is set to manual, you'll find that
that cell will recalc sometime when you didn't want it to.

I think the best bet would be to convert the results of the formula to a value
(edit|copy, edit|paste special|values).

Dale G wrote:

Is it possible to set a VLOOKUP to retrieve values using a Date, then setting
the date cell to =NOW(), then retain those values after the date.

For example, I have a workbook that is used to keep track of arrivel times
at a set location. Every sheet in the wookbook is the same location, one
sheet for each day of the month. Column B has the vehicle numbers use on a
specific day. Each day the drivers use a different vehicle.
The vehicles are entered in a feeder sheet each day in a different workbook.

My idea is to have column B of the location workbook retrieve the vehicle
numbers on the date the location sheet is being used.

So far this is all I have in column B.

=IF($A$1=DATE(2009,12,1),VLOOKUP(A3,Feeder!$F$2:$G $121,2,0),"")

is it possible to set A1 to NOW() and still retrieve the vehicle numbers?

Any help is appreciated.



--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 85
Default VLOOKUP with a date, from A1 = Now()

Thanks Dave,
I would need to copy, then paste special, Values. Then just use the standard
VLOOKUP.
= VLOOKUP(A3,Feeder!$F$2:$G$121,2,0)
Would VBA be able to save the formula as a Value?


"Dave Peterson" wrote:

First, =now() includes the date and time, so:

=if(a1=date(...), ...
Will only match if you're lucky enough to calculate at Midnight of that date.

You could use:
=today()
in a1
or modify the formula to ignore the time:
=if(int(a1)=date(...), ...

But the real problem is that the formula will not maintain the results if you
leave it a formula. Even when calculation is set to manual, you'll find that
that cell will recalc sometime when you didn't want it to.

I think the best bet would be to convert the results of the formula to a value
(edit|copy, edit|paste special|values).

Dale G wrote:

Is it possible to set a VLOOKUP to retrieve values using a Date, then setting
the date cell to =NOW(), then retain those values after the date.

For example, I have a workbook that is used to keep track of arrivel times
at a set location. Every sheet in the wookbook is the same location, one
sheet for each day of the month. Column B has the vehicle numbers use on a
specific day. Each day the drivers use a different vehicle.
The vehicles are entered in a feeder sheet each day in a different workbook.

My idea is to have column B of the location workbook retrieve the vehicle
numbers on the date the location sheet is being used.

So far this is all I have in column B.

=IF($A$1=DATE(2009,12,1),VLOOKUP(A3,Feeder!$F$2:$G $121,2,0),"")

is it possible to set A1 to NOW() and still retrieve the vehicle numbers?

Any help is appreciated.



--

Dave Peterson
.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default VLOOKUP with a date, from A1 = Now()

Sure.

If the range of cells always had the same address, you could just record a macro
when you do it once.

Then you could modify the macro so the guts would look like:

with activesheet.Range("F8:I16")
.Copy
.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, _
Transpose:=False
end with

If the range varied each day, you could make sure you selected the range first
and then ran a macro that only worked on that selection. (Make sure it's a
single contiguous range, too).

with Selection
.Copy
.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, _
Transpose:=False
end with

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Dale G wrote:

Thanks Dave,
I would need to copy, then paste special, Values. Then just use the standard
VLOOKUP.
= VLOOKUP(A3,Feeder!$F$2:$G$121,2,0)
Would VBA be able to save the formula as a Value?

"Dave Peterson" wrote:

First, =now() includes the date and time, so:

=if(a1=date(...), ...
Will only match if you're lucky enough to calculate at Midnight of that date.

You could use:
=today()
in a1
or modify the formula to ignore the time:
=if(int(a1)=date(...), ...

But the real problem is that the formula will not maintain the results if you
leave it a formula. Even when calculation is set to manual, you'll find that
that cell will recalc sometime when you didn't want it to.

I think the best bet would be to convert the results of the formula to a value
(edit|copy, edit|paste special|values).

Dale G wrote:

Is it possible to set a VLOOKUP to retrieve values using a Date, then setting
the date cell to =NOW(), then retain those values after the date.

For example, I have a workbook that is used to keep track of arrivel times
at a set location. Every sheet in the wookbook is the same location, one
sheet for each day of the month. Column B has the vehicle numbers use on a
specific day. Each day the drivers use a different vehicle.
The vehicles are entered in a feeder sheet each day in a different workbook.

My idea is to have column B of the location workbook retrieve the vehicle
numbers on the date the location sheet is being used.

So far this is all I have in column B.

=IF($A$1=DATE(2009,12,1),VLOOKUP(A3,Feeder!$F$2:$G $121,2,0),"")

is it possible to set A1 to NOW() and still retrieve the vehicle numbers?

Any help is appreciated.



--

Dave Peterson
.


--

Dave Peterson
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
vlookup by date PointerMan Excel Worksheet Functions 10 February 9th 09 07:54 AM
vlookup using date little bear Excel Discussion (Misc queries) 5 July 29th 06 11:58 PM
VLOOKUP using date problem manse Excel Worksheet Functions 3 January 20th 06 09:56 AM
Vlookup and Date Ted Metro Excel Worksheet Functions 5 December 8th 04 09:37 PM
Date VLookup Court Excel Worksheet Functions 1 November 11th 04 04:01 PM


All times are GMT +1. The time now is 12:03 PM.

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"