on 6/6/07 7:09 AM, John Wenmeekers stated:

> On Wed, 6 Jun 2007 07:34:50 -0400, Jason L. DeLooze
> <[EMAIL PROTECTED]> wrote:
> 
>> Even cooler if it worked in all cases, like 3/1/2007 to 2/28/2008, for
>> example.  
> 
> Hi Jason, thanks for hopping in,
> 
> maybe I'm missing something, but when I use your proposed dates in Tom's
> calc, the result is 2 x Jan and 2 x Feb.
> Seems to be ok for me....
> 
> I calculate the part of the beginning month and the part of the ending month.
> 
> The only problem left is to find a decent way to check for a leap year if
> there 
> are multiple years involved.
> 
> Or is there something hidden that I don't see ?
> Wouldn't be the first time.... :-)

I fudged a couple of CF to get decent results:

MonthList (StartDate, EndDate) =

Let (
   [
   m = Month ( StartDate ) ;
   y = Year ( StartDate ) ;
   start = Date ( m ; 1 ; y ) ;
   end = Date ( Month ( EndDate ) ; 1 ; Year ( EndDate ) );
   list =  If (start  ¾ end ; Right("00" & Month ( start ); 2) &  "¶" &
MonthList ( Date ( m+1 ; 1 ; y ) ; end ))
   ] ; list)


MonthOccur (StartDate, EndDate) =
Let (
   [
   l = MonthList ( StartDate ; EndDate );
m1 = If ( PatternCount ( l ; "01" ) = 0 ; "" ; "Jan = "  & PatternCount ( l
; "01" ) ); 
m2 = If ( PatternCount ( l ; "02" ) = 0 ; "" ; "Feb = "  & PatternCount ( l
; "02" ) ); 
m3 = If ( PatternCount ( l ; "03" ) = 0 ; "" ; "Mar = "  & PatternCount ( l
; "03" ) ); 
m4 = If ( PatternCount ( l ; "04" ) = 0 ; "" ; "Apr = "  & PatternCount ( l
; "04" ) ); 
m5 = If ( PatternCount ( l ; "05" ) = 0 ; "" ; "May = "  & PatternCount ( l
; "05" ) ); 
m6 = If ( PatternCount ( l ; "06" ) = 0 ; "" ; "Jun = "  & PatternCount ( l
; "06" ) ); 
m7 = If ( PatternCount ( l ; "07" ) = 0 ; "" ; "July = "  & PatternCount ( l
; "07" ) ); 
m8 = If ( PatternCount ( l ; "08" ) = 0 ; "" ; "Aug = "  & PatternCount ( l
; "08" ) ); 
m9 = If ( PatternCount ( l ; "09" ) = 0 ; "" ; "Sep = "  & PatternCount ( l
; "09" ) ); 
m10 = If ( PatternCount ( l ; "10" ) = 0 ; "" ; "Oct = "  & PatternCount ( l
; "10" ) ); 
m11 = If ( PatternCount ( l ; "11" ) = 0 ; "" ; "Nov = "  & PatternCount ( l
; "11" ) ); 
m12 = If ( PatternCount ( l ; "11" ) = 0 ; "" ; "Dec = "  & PatternCount ( l
; "12" ) );
b = 
m1 & If(not IsEmpty ( m2 )  and  not IsEmpty ( m1 ); "¶"; "") &
m2 & If(not IsEmpty ( m3 ) and not IsEmpty ( m2 ); "¶"; "") &
m3 & If(not IsEmpty ( m4 ) and not IsEmpty ( m3 ); "¶"; "") &
m4 & If(not IsEmpty ( m5 ) and not IsEmpty ( m4 ); "¶"; "") &
m5 & If(not IsEmpty ( m6 ) and not IsEmpty ( m5 ); "¶"; "") &
m6 & If(not IsEmpty ( m7 ) and not IsEmpty ( m6 ); "¶"; "") &
m7 & If(not IsEmpty ( m8 ) and not IsEmpty ( m7 ); "¶"; "") &
m8 & If(not IsEmpty ( m9 ) and not IsEmpty ( m8 ); "¶"; "") &
m9 & If(not IsEmpty ( m10 ) and not IsEmpty ( m9 ); "¶"; "") &
m10 & If(not IsEmpty ( m11 ) and not IsEmpty ( m10 ); "¶"; "") &
m11 & If(not IsEmpty ( m12 ) and not IsEmpty ( m11 ); "¶"; "") &
m12]

;

b)

Do I win anything?

Don Wieland
DW DATA CONCEPTS
~~~~~~~~~~~~~~~~~~~~~~~~~

Direct Line - (714) 389-4026
Fax - (714) 389-4027
[EMAIL PROTECTED]
http://www.dwdataconcepts.com

Integrated data solutions to fit your business needs.

APPOINTMENT 1.0v7 - Add powerful scheduling to your database system.

http://www.appointment10.com/

Reply via email to