Thread: Date Lookup
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Date Lookup

Hi,

In that case there are 2 options.

1. If column A is sorted ascending then you can get away with

=INDEX(B1:B10,COUNTIF(A1:A10,"<"&C1)+1)

2. If column A isn't sorted you need

=INDEX(B1:B10,MATCH(SMALL(A1:A10,COUNTIF(A1:A10,"< "&C1)+1),A1:A10,0))


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"ck13" wrote:

Hi Mike,

If there is an exact match, i would like it to return the exact match.

"Mike H" wrote:

Hi,

If there was a 1 jan in your data what would you want to return then, an
exact match or the next highest?
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"ck13" wrote:

Hi, assuming the following data:
A B
1 31-Dec-2009 50
2 4-Jan-2010 30
3 5-Jan-2010 20

In C, I have the date for the first day of every month e.g. 1-Jan-2010. In
the adjacent cell in D, i need to lookup the value in B for the first number
that occur for that month (in this case 4-Jan and so, the number should be
30). I tried various formula but as there are no 1-Jan in column A, it
returns the value of 50 (31-Dec). Anyone here has a solution for this? Thanks