« Project Management Office and the Monorail | Main | Reasons To Be Awake »

Date Math - DateAdd, ProjDateAdd in Microsoft Project

I just ran into someone having trouble making a custom formula in Microsoft Project. They were adding a duration to a date by using a + sign. For example:

[Finish1]+[Duration1]

The result they got was years in the future and was unexpected. The reason for this is that Duration is stored in minutes. The duration of an 8 hour day is 480. Dates, like Finish1, are stored as a serial number which is counting from 1/1/1900, making today 39842. When you add those two numbers together, each minute is treated as a day.

Fortunately MS Project has some functions which will do the date math for you. DateAdd will do simple date addition, and ProjDateAdd will do date addition with any of the Project calendars taken into account. If you have a duration of 5 days stored in the Duration1 field and today is Thursday, then the different functions would give the following results:

Now()+[Duration1] would give a date about 7 years from now.

DateAdd( "d", 5, now()) will give a date five days from today (Tuesday).

ProjDateAdd(Now(),[Duration1],"Standard") would give a date one work week from today. (Thursday)

RELATED POSTS
  • MS Project Tip - Creating User-defined Filters
  • Microsoft Project Tip - Formulas and the IIF statement
  • Telling Time - ProjDateDiff, VB DateDiff and Application.DateDifference
  • New Fields in Microsoft Project 2010
  • Project 2010 Tips and Tricks Webcast
  • Project Server 2010 Technical Requirements
  • Making the move from VBA to VSTO in Microsoft Project
  • Analyze Microsoft Project Resource Usage Data In Excel
  • Microsoft Project VBA - the Instr function
  • Views and Tables in Microsoft Project

  • About

    The previous article is Project Management Office and the Monorail.

    The next article is Reasons To Be Awake.

    Current articles are in the main index page and you can find a complete list of articles in the archives.

    Creative Commons License
    This weblog is licensed under a Creative Commons License.
    Powered by
    Movable Type 3.34