Gustav Brock
Gustav at cactus.dk
Tue Apr 19 04:57:50 CDT 2011
Hi David Not exactly. That will loosen the condition to satisfy the question: "such as Every other Saturday before x weeks after 4/16/2011". For example, 2011-03-19 will be accepted, and these values will be as well: StartingSat = #2011/04/17# NumOfSats = 5 SiQ = #2011/05/15# Of course, you may have validated SiQ to be larger than StartingSat as well as StartingSat to be a Saturday prior to calling your easy expression, but how can we know? Also, the DateAdd formula could be reduced to: DateAdd("ww", NumOfSats, StartingSat) /gustav >>> davidmcafee at gmail.com 18-04-2011 22:01 >>> Yes, but I can check if Saturday in Question (SiQ) is less than: IF SiQ < DateAdd("d",(7 * NumOfSats),StartingSat) THEN Is Affected = ((SiQ - StartingSat) Mod 14 = 0) ELSE IsAffected = False END IF Or even easier: ? IIF(SiQ <DateAdd("d",(7 * NumOfSats),StartingSat) ,((SiQ - StartingSat) Mod 14 = 0) ,False) On Mon, Apr 18, 2011 at 11:11 AM, Gustav Brock <Gustav at cactus.dk> wrote: > Hi David > > Easier, yes, but it doesn't answer "such as Every other Saturday for the next x Saturdays starting 4/16/2011". > > /gustav > > > >>> davidmcafee at gmail.com 18-04-2011 19:52 >>> > Thanks AD, that's exactly what I was looking for! > > I was thinking of doing something like Gustav suggested, but knew there had to be an easier way. > > > > On Sat, Apr 16, 2011 at 8:57 PM, A.D. Tejpal <adtp at airtelmail.in> wrote: > > > David, > > > > Another alternative could be considered. > > > > You wish to ascertain whether date Dt2 falls on one of the alternate Saturdays starting from Dt1 which is a Saturday. > > > > If the test is to be reflected via a Boolean variable IsAffected, the following could be tried: > > > > IsAffected = ((Dt2 - Dt1) Mod 14 = 0) > > > > If the condition is to be checked in an If / End If block, the syntax could be as follows: > > > > If (Dt2 - Dt1) Mod 14 = 0 Then > > > > Best wishes, > > A.D. Tejpal