View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Need to find each day prior to first friday, monthly

On Wed, 13 Dec 2006 22:20:49 -0500, Ron Rosenfeld
wrote:

On Wed, 13 Dec 2006 16:51:00 -0800, PaulRMcHanJr
wrote:

I am trying to create a calendar with a "grace period" that ends on the first
friday of each month.
I can identify the first friday:
=AND(WEEKDAY(A1)=6,DAY(A1)<=7)
and the first week:
=AND(DAY(A1)<=7)
but can't get my mind around selecting all the days of the month prior to
the first friday...
Thanks,
Paul



=AND(A1(A1-DAY(A1)),
A1<(A1-DAY(A1)+9-WEEKDAY(A1-DAY(A1)+2)))


--ron



By way of explanation:

A1-DAY(A1)
last day of the preceding month

A1-DAY(A1)+9-WEEKDAY(A1-DAY(A1)+2)
Saturday after the first Friday in the month.

A1(A1-DAY(A1))
A1 is after the last day of the preceding month
A1<(A1-DAY(A1)+9-WEEKDAY(A1-DAY(A1)+2))
A1 is prior to the 1st Sat after the 1st Fri of the month

The above presumes that A1 contains a date, and not a date + a time.
--ron