Lookup Formula

  • Thread starter Thread starter snax500
  • Start date Start date
S

snax500

In Excel2000, I have the following data:

Weekending Fiscal Month
2/19/2005 FEB
2/26/2005 FEB
3/5/2005 MAR
3/12/2005 MAR

I want to have a lookup formula that looks up all dates before the
weekending date. For example for the following:

2/25/2005 = Feb
2/26/2005 = Feb
2/27/2005 = Mar
2/28/2005 = Mar
2/29/2005 = Mar
3/1/2005= Mar

Thanks
 
snax500 said:
I want to have a lookup formula that looks up all dates before the
weekending date.

I'm not sure what it is you're after: do you want to be told the week ending
date for a given date, or do you want a list of all the dates for the week
that ends on a given date? If you really want a lookup, what's it supposed
to do?

In the first case,

Public Function WeekendingDate(day As Date) As Date
'could use some parameter checking... day <> 0, etc.
Dim daynumber As Integer
daynumber = Weekday(day)
WeekendingDate = day + 7 - daynumber
End Function

In the second case, just use date arithmetic: day - 1, day - 2, etc.

Or were you after something else?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top