Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Look up last and next entry

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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Look up last and next entry

Please note that these formulas are array formulas. You create array formulas
in the same way that you create other formulas, except you press
CTRL+SHIFT+ENTER to enter the formula. If successful in 'Formula Bar' you can
notice the curly braces at both ends like "{=<formula}"

In cell E1 enter the code

'To return the last values based on date from ColC and ColD copy this
formula and copy across to the right

=INDEX(OFFSET(C$1,0,0,MATCH(TODAY(),$A:$A,0),1),SM ALL(IF(OFFSET($B$1,0,0,MATCH(TODAY(),$A:$A,0),1)=$ E$1,ROW(OFFSET($B$1,0,0,MATCH(TODAY(),$A:$A,0),1)) ),COUNTIF(OFFSET($B$1,0,0,MATCH(TODAY(),$A:$A,0),1 ),$E$1)+ROW(A1)-1))

'To return the next entry copy thebelow formula and copy to the right cell..
=INDEX(C:C,SMALL(IF($B$1:$B$65535=$E$1,ROW($B$1:$B $65535)),COUNTIF(OFFSET($B$1,0,0,MATCH(TODAY(),$A: $A,0),1),$E$1)+1))


If this post helps click Yes
---------------
Jacob Skaria


"Huggy" wrote:

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.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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.



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
Excel 2002 date entry: Cannot get away from d-m-yy entry format Steve Eklund Excel Discussion (Misc queries) 3 May 11th 09 04:57 PM
Control Data Entry - push entry to next cell Ofelia Excel Discussion (Misc queries) 0 July 7th 08 04:19 PM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
How do I set up entry box to auto-alphabatize each entry in list? jhakers Excel Discussion (Misc queries) 0 February 14th 08 08:01 PM
Cell Entry That Locks Selected Cells From Any Data Entry. ron Excel Worksheet Functions 5 February 16th 07 09:52 PM


All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"