Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default using dates for lookup

I have a file of historical daily stock prices from this month back nine
years. First column is the date and next the data. Then the next three
columns are the dates for looking back 30, 60, and 90 days. I then tried to
use LOOKUP to use the look back dates to look back and pick up the prices for
30, 60, 90 days back to produce three new columns. That is, I use LOOKUP to
use the 30, 60, 90 day look back dates to lookup the back date in the date
column and return the price on that date. The LOOKUP function returns the
same last (bottom) value in the column for all rows. That is,
=LOOKUP(C7,B$7:B$2268,G$7:G$2268) always returns the value in cell G2268.
Dates get older in down direction. C7 is the first reference date to be
found in B7:B2268 (exact or next older date) and result is in same row in
G7:G2268.
--
Mal
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default using dates for lookup

I am totally confused by your description but...

=LOOKUP(C7,B$7:B$2268,G$7:G$2268)
always returns the value in cell G2268.


In order for that formula to work correctly the range B7:B2268 *must* be
sorted in ascending order.

--
Biff
Microsoft Excel MVP


"Mal" wrote in message
...
I have a file of historical daily stock prices from this month back nine
years. First column is the date and next the data. Then the next three
columns are the dates for looking back 30, 60, and 90 days. I then tried
to
use LOOKUP to use the look back dates to look back and pick up the prices
for
30, 60, 90 days back to produce three new columns. That is, I use LOOKUP
to
use the 30, 60, 90 day look back dates to lookup the back date in the date
column and return the price on that date. The LOOKUP function returns the
same last (bottom) value in the column for all rows. That is,
=LOOKUP(C7,B$7:B$2268,G$7:G$2268) always returns the value in cell G2268.
Dates get older in down direction. C7 is the first reference date to be
found in B7:B2268 (exact or next older date) and result is in same row in
G7:G2268.
--
Mal



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default using dates for lookup

Assume source data in B1:C1 down,
with real dates, chronologic (ie ascending), in B1 down,
corresponding data in C1 down

In D7 down you have listed real dates with which to look back 30 days
Place in say G7:
=INDEX(C:C,MATCH(DATE(YEAR(D7),MONTH(D7),DAY(D7)-30),B:B,1))
Copy down

And in E7 down you have listed real dates with which to look back 60 days
Place in say H7:
=INDEX(C:C,MATCH(DATE(YEAR(E7),MONTH(E7),DAY(E7)-60),B:B,1))
Copy down

And in F7 down you have listed real dates with which to look back 90 days
Place in say I7:
=INDEX(C:C,MATCH(DATE(YEAR(F7),MONTH(F7),DAY(F7)-90),B:B,1))
Copy down
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:27,000 Files:200 Subscribers:70
xdemechanik
---
"Mal" wrote:
I have a file of historical daily stock prices from this month back nine
years. First column is the date and next the data. Then the next three
columns are the dates for looking back 30, 60, and 90 days. I then tried to
use LOOKUP to use the look back dates to look back and pick up the prices for
30, 60, 90 days back to produce three new columns. That is, I use LOOKUP to
use the 30, 60, 90 day look back dates to lookup the back date in the date
column and return the price on that date. The LOOKUP function returns the
same last (bottom) value in the column for all rows. That is,
=LOOKUP(C7,B$7:B$2268,G$7:G$2268) always returns the value in cell G2268.
Dates get older in down direction. C7 is the first reference date to be
found in B7:B2268 (exact or next older date) and result is in same row in
G7:G2268.

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
Lookup between two dates Nikkiv505 Excel Worksheet Functions 3 March 19th 09 02:29 AM
Lookup and dates Danie Excel Discussion (Misc queries) 5 October 24th 08 03:21 PM
Lookup between dates Amanda Excel Discussion (Misc queries) 1 September 22nd 08 01:38 PM
need to retrieve dates from lookup MRT Excel Discussion (Misc queries) 5 March 27th 06 05:23 AM
Lookup a date between other dates spalmarez Excel Worksheet Functions 1 November 4th 04 09:48 PM


All times are GMT +1. The time now is 06:19 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"