ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Assign period to date based on rules. (https://www.excelbanter.com/excel-worksheet-functions/175001-assign-period-date-based-rules.html)

Sebastian

Assign period to date based on rules.
 
I have a list of dates from 1/1/2005 all the way through 12/31/2008.
To this list I need to assign a period as follows:
- Every date in January 2005 up to the last Friday of the month will be
"Period 1"
- Every date immediately after the last Friday in January up until the last
Friday in February will be assigned "Period 2".
- This will continue all the way through the list.

I searched here and found a number of ways on how to identify the last
Friday of a month given a date.
This is the formula that I'm using.
{=MAX(IF(WEEKDAY(ROW(INDIRECT(A2&":"&EOMONTH(A2,0) )),2)=5,ROW(INDIRECT(A2&":"&EOMONTH(A2,0)))))}

If I have my list of dates on column A and insert this formula on column B
like so:

A B
1/1/2005 1/28/2005
1/2/2005 1/28/2005
..... ....
1/28/2008 1/28/2005
1/29/2005 1/0/1900
1/30/2005 1/0/1900
1/31/2005 1/0/1900
2/1/2005 2/25/2005

The formula will evaluate fine for all the dates in a month that are before
the last Friday of the month... but will revert to 1/0/1900 (serial number 0)
on the days in the month that fall after the last Friday of said month.
What I need is for those to go to the next period...
1/29/2005 would evaluate to 2/25/2005 and so on.

Is this possible?

Thanks.
Sebastian


All times are GMT +1. The time now is 02:15 AM.

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