Calculated fields are a feature in Project 2000 and greater which are very useful, however there are some conditions which cause confusion. This page addresses some of the common problems.
My formula refers to Baseline or Deadline fields.
When there is "NA" in the baseline or deadline it gives an error:
This problem is caused by the fact that the project gives a numerical value of 4294967296 (2 to the 32nd power - 1) if the field is "NA" (blank). Why it does this rather than giving a value of 0 I do not know, however once you know that it uses this number you can write a formula which accounts for it.
The solution is to use an iif statement. The syntax for an iif statement is as follows:
iif(expression, value if true, value if false)
Iif([Baseline Finish] > 50000, "There is no baseline for this task", [Baseline Finish]-[Finish])
Another alternative is to use ProjDateValue to evaluate the data stored in the baseline. Since an empty baseline shows "NA" for dates such as Baseline Finish, you can test for it directly.
iif([Baseline Finish]=projdatevalue("NA"), "Has Baseline", "No, Baseline")
I am getting unexpected values when using work or duration in my formula.
The problem is usually caused by failing to convert the units correctly. When you use duration or work in a formula Project uses the value of either in MINUTES. This can be confusing if you are subtracting a duration of 1 day from a duration of 2 days. You would expect that 2 - 1 = 1, but in Project it equals 480 minutes.
Now you may wonder why 480 minutes? There are 24 hours in a day x 60 minutes, however by default a Project day is 8 hours or 480 minutes. One easy way to handle this is to simply divide by 480 as in this example.
([Baseline Duration]-[Duration])/480 & " days"
([Baseline Duration]-[Duration])/[Minutes Per Day] & " days"
I want to subtract one date from another in Project.
There are a number of ways to do date subtraction. The first is to simply subtract one from the other like this:
[Finish]-[Start]
So there is another method that Project provides to do date math. It is to use the ProjDateDiff function. The syntax is as follows:
ProjDateDiff( date1, date2, calendar )
ProjDateDiff([Start],[Finish])