Thread: Check date
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Check date

Sorry, *it* is refer to the date store in G3. First of all, ignore the
leap year. I just concern on MONDAY only since the vba code only check on
the cell that contains this formula on Monday. I would like to get the
result of, if the date in G3 is the first Monday on or after the 29th of
each month, return True, other Mondays return false.


Assuming you mean that March 1st would qualify as the first day after the
imaginary February 29th of a non-leap year, then the following formula will
return True if the date in G3 falls is a first Monday following the 29th of
a month...

=(G3=DATE(YEAR(G3),MONTH(G3)-(DAY(G3)<7),28)+8-WEEKDAY(DATE(YEAR(G3),MONTH(G3)-(DAY(G3)<7),28)-1))

Maybe that statement above needs a little clarification (to make sure I
actually calculated what you wanted). If the date in G3 falls within the
first week of its month, then the date it is compared to is the first Monday
following the 29th of the previous month. Take June 4, 2007 as an example...
the above formula returns True for if G3 contains the date June 4, 2007
because that date is the first Monday that follows May 29, 2007. Take
September 29, 2008 as another example. If G3 contains this date, the above
formula also returns True because that date falls on a Monday.

Rick