View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Last Saturday of each month(check on Monday)

On Wed, 9 May 2007 04:19:00 -0700, Joel wrote:

I couldn't get eomonth() function working on my computer so I took the 1st of
the next month and subtracted one to get last day of month.

What you ned is the difference between the last day of the month and the
current date is greater or equal to 5 and less than 12.

if it is Monday, there are 5 days between Monday and Saturday. If the
difference between the last day of month and the current date is less than 5
there is no Saturday. If the difference between the last date of the month
and the currrent date is 12 or more there is two Saturdays until the end of
the month.

EOMONTH() is equivalent to DATE(YEAR(NOW()),MONTH(NOW())+1,1)-1


or, more simply:

DATE(YEAR(NOW()),MONTH(NOW()),0)



=IF(AND((DATE(YEAR(NOW()),MONTH(NOW())+1,1)-1)-TODAY()=5,(DATE(YEAR(NOW()),MONTH(NOW())+1,1)-1)-TODAY()<12),TRUE,FALSE)


I note some inconsistencies in your formula.

I substituted A1 for NOW() and TODAY() in your formula.

If A1 contains the Last Saturday of the month, your formula sometimes returns
TRUE and sometimes returns FALSE.

If the OP only looks at the cell on MONDAY, then it makes no difference.
--ron