View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Look up last and next entry

Try these...

list of dates (from 1/1/08 - 31/12/10) in order


Assumming the range of dates is A2:A1097

E2 = lookup code

For the last instance *before* today:

=LOOKUP(2,1/(B2:INDEX(B2:B1097,MATCH(NOW(),A2:A1097)-1)=E2),C2:INDEX(C2:C1097,MATCH(NOW(),A2:A1097)-1))

For the next instance:

=VLOOKUP(E2,C1097:INDEX(B2:B1097,MATCH(TODAY(),A2: A1097)),2,0)

--
Biff
Microsoft Excel MVP


"Huggy" wrote in message
...
I have a spreadsheet with column A being list of dates (from 1/1/08 -
31/12/10)
in order and column B a list of codes. Each codes periodically is
repeasted
in no fixed order. Column C and D have data that relate to the code in
column
B.

What I would like to do is based on todays date show the last time the
code
was used before today along with the data in column B & C, then show the
next
time the code is used from today onwards along with the data in column B &
C.

Thanks for the help.