View Single Post
  #22   Report Post  
Posted to microsoft.public.excel.worksheet.functions
daddylonglegs
 
Posts: n/a
Default 1st Monday of a month in date range??


scwilly Wrote:
Example:

How many 5th Fridays are between 5/1/2006 and 6/30/2006

The answer should be 1, your formula works if I change the end date to
7/1/2006 but not for 6/30/2006 which I need and would love.

It is more for a date range where the begin and end date could fall on
days other than the first of the month.

Thanks again, cheers


Hi scwilly, how are you getting 1 for the above? If you include the
start and end dates should it not be 2, 31st March and 30th June? Or
are you not counting the start and end dates as part of the range?
Assuming you are you could use this formula

=SUMPRODUCT(--(TEXT(ROW(INDIRECT(A1&":"&A2)),"ddd")=A4),--(ABS(DAY(ROW(INDIRECT(A1&":"&A2)))-A3*7+3)<4))

works for any start/end dates


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=535648