Share via

Formula for date duration

Anonymous
2013-11-06T20:49:00+00:00

Hi-

I was trying to create a formula in Microsoft Project 2010.  The formula that I am trying to create is basically saying, take today's date, look 20 days before and 60 days ahead, then flag it as yes.  For instance, if today's date is 11/6, 20 days less is about 10/10, 60 days more is 2/11 (based on my working calendar).  Any finish date that falls in between 10/10 and 2/11 should be flagged as yes.

So I created a column- "Date 10", within "Date 10" the formula of [Current Date] was inserted.  So it automatically populates the current date.

From there, I tried developing the following formula to try and encompass the duration of 10/10 to 2/11:

IIf ([Finish]>=DateAdd("d",-20,[Date10]) And [Finish]<=DateAdd("d",60,[Date10])),yes,no)

For some reason, it isn't flagging the correct dates.  Anyone have any suggestions???

Thanks in advance!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2013-11-07T07:46:26+00:00

    Sorry for falling in. Just a hint: Use ProjDateAdd( date; duration; calendar )  instead of DateAdd to get non working days respected.

    Regards

    Barbara

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-11-07T02:02:13+00:00

    You had added your holidays to the Standard calendar, yes?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-11-06T22:32:26+00:00

    Hmmm.  It appeared to be working fine using both auto scheduled and manually scheduled tasks.  What service pack do you have applied to Project 2010?  I am running Project 2010 with SP-2.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-11-06T22:15:15+00:00

    Hi Julie,

    I tried entering your formula into the timeline and is coming up with the same issue.

    The finish date is within the constraints of -20 days of today or greater than +60 days of today, however it is showing "No". Also, there are some finish dates outside the range of (-20 days and +60 days) which will show "Yes".

    I do have a lot of non-working time in my calendar, hence my 60 days is projected much further.

    I'll try adding the spare date fields.

    Thanks again.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2013-11-06T22:00:31+00:00

    I had to clean up some syntax errors, but other wise your formula appears to be working correctly.

    I am using the formula below in a Flag field:

    IIf([Finish]>=DateAdd("d",-20,[Date10]) And [Finish]<=DateAdd("d",60,[Date10]),Yes,No)

    When you say it isn't flagging the correct dates, can you be more specific? Is it not flagging summary tasks?  Did you set the summary task to use the formula?

    I'm guessing you must have quite a bit of non-working time your calendar as using the Standard calendar (Monday through Friday with no holidays) 60 days from today is January 5.

    You might try adding two spare date fields and calculating the minus 20 and plus 60 just to see if that is what is throwing off your flagging.

    Was this answer helpful?

    0 comments No comments