ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Lookup Formula (https://www.excelbanter.com/excel-programming/324531-lookup-formula.html)

snax500[_2_]

Lookup Formula
 
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


Shawn O'Donnell

Lookup Formula
 
"snax500" wrote:
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?


All times are GMT +1. The time now is 08:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com