Results 1 to 2 of 2
  1. #1
    Join Date
    May 2009

    Unanswered: Subtract Weekdays

    I am trying to write a formula to subtract the leadtime from the purchase order due date to give me the date the order needs to be placed.

    CURDUE_10 is the due date of the purchase order.

    PURLT_01 is the leadtime on the item in business days.

    This formula (which came from the Crystal Reports help file) totally ignored the weekday part and just gives me due date minus leadtime days as calendar days:


    This formula (which I copied off a website and do not understand at all) worked great on the first record but then not so hot on the second and by the time it got 50 records down, it had order placement dates of three years ago so obviously something wasn't working at all:

    numbervar counts;datevar lastday;datevar firstday;numbervar loops;

    while counts <{Part_Master.PURLT_01} do(
    if dayofweek(firstday+loops)in [2 to 6] then counts:=counts+1);


    Help please!

  2. #2
    Join Date
    May 2009
    This formula should work:


    but it would be easier to simply write the function:


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts