>dStartDate = CTOD('12/31/2016') >FOR i = 1 TO 40 > dStartDate = dStartDate + i > > FOR nDays2Advance = 1 TO 20 > m.TodayDow = DOW(dStartDate) > m.RealDaysToAdvance = m.nDays2Advance + INT((m.TodayDow + m.nDays2Advance - 1) / 5) * 2 > dEndDate = dStartDate + m.RealDaysToAdvance > IF DOW(dEndDate) = 1 OR DOW(dEndDate) = 7 > MESSAGEBOX("Wrong day. " + " Start Date: " + DTOC(dStartDate) + ; > " Days to Advance " + ALLTRIM(STR(m.nDays2Advance)) + " Real days to advance: " + ALLTRIM(STR(m.RealDaysToAdvance)) + CHR(13) + ; > "End Date: " + DTOC(dEndDate) + " which is " + ALLTRIM(STR(DOW(dEndDate)))) > ENDIF > ENDFOR > >ENDFOR >The formula uses a convention where 1 = Monday, 6 and 7 are weekend days. So, if you change to m.TodayDow = DOW(dStartDate, 2), the advanced days won't fall on a weekend (you can leave the test as it is, that is, for the test you can use the convention 1 = Sunday, it's irrelevant).