Three Point Estimation (PERT) in Project 2010: Take 1

  

As some of you may already know the PERT Addin that was in Project for several versions was NOT included in Project 2010. The good news is that below we have the first version of some sample code you can use to add the feature back into the product! This first version does not use a form like the old one. It uses custom fields at the task level to store the Pessimistic, Optimistic and Most Likely estimates and the weights for each estimate. This is just a preliminary version. We hope to gather feedback and then release a future version of the code as a Visual Studio project that can be customized and used to create a Project 2010 Addin.

 

This code depends on using 7 task level custom fields:

Field Name Purpose
Duration1 Optimistic Duration
Duration2 Most Likely Duration
Duration3 Pessimistic Duration
Number1 Optimistic Weight
Number2 Most Likely Weight
Number3 Pessimistic Weight
Text30 Calculation State

 

The image below shows a Gantt Chart view with these fields inserted. In this example we see weights only on the first task. This is an option you can set in the code. If the option is set to ‘False’ then each task can have its own set of weights. Duration estimates are inserted for each task. The code at this point will estimate every task. (We could add the option to allow a project manager to specify which tasks should be estimated.)

image

 

To use this sample code in your own projects:

  1. Open Project 2010
  2. Click on the View Tab of the Ribbon
  3. Click Macro | Visual Basic
  4. Double Click on the “ThisProject (Global.MPT)” node just under the ProjectGlobal node
    image
  5. In the code window that opens up on the right paste in the code below
  6. Decide if you want to use only one set of weights or if you want each task to have its own set of weights
    If you want one set leave the code as it is. If you want separate weights then change this: “UseOneSetofWeights = True” to this:
    ”UseOneSetofWeights = False”
  7. Close the Visual Basic Editor
  8. Click on the “Customize Quick Access Toolbar” item on the ribbon
    image
  9. Click on “More Commands”
  10. In the “Choose commands from” list box pick “Macros”
  11. Select “PERT” in the left hand box and then click the Add button
    image
  12. Click OK

 

Now the code is ready to be used. All that is left is to insert the fields in the table above into a Gantt Chart view, enter your estimates and your weights (Remember that the weights must add up to 6!!) and then run the macro using the Quick Launch button you just added.

 

Feedback Wanted!!

This is just a first pass at a sample for replacing the PERT functionality. Please email me (brian.kennemer@microsoft.com) with your feedback.

Some things to think about:

  • Should there be the ability to specify which tasks should have their Durations estimated when the tool is run?
  • Do you prefer a form for setting the weights?
  • What other options would you like to see?

 

One last thing: This is just sample code and should be thoroughly tested before you use it on a ‘production’ project.

 

_____________________________________________________________________________________________________________

 

Sub PERT()
Dim tskT As Task
Dim tskFirst As Task
Dim FoundBadWeights As Boolean
Dim UseOneSetofWeights As Boolean

UseOneSetofWeights = True
FoundBadWeights = False

CustomFieldRename FieldID:=pjCustomTaskDuration1, NewName:="Optimistic Duration"
CustomFieldRename FieldID:=pjCustomTaskDuration2, NewName:="Most Likely Duration"
CustomFieldRename FieldID:=pjCustomTaskDuration3, NewName:="Pessimistic Duration"
CustomFieldRename FieldID:=pjCustomTaskNumber1, NewName:="Optimistic Weight"
CustomFieldRename FieldID:=pjCustomTaskNumber2, NewName:="Most Likely Weight"
CustomFieldRename FieldID:=pjCustomTaskNumber3, NewName:="Pessimistic Weight"
CustomFieldRename FieldID:=pjCustomTaskText30, NewName:="PERT State"

If UseOneSetofWeights = True Then
    Set tskFirst = ActiveProject.Tasks(1)
    For Each tskT In ActiveProject.Tasks
      If Not (tskT Is Nothing) Then
        If tskT.PercentComplete = 0 And tskT.PercentWorkComplete = 0 Then
          If (tskFirst.Number1 + tskFirst.Number2 + tskFirst.Number3) = 6 Then
            tskT.Duration = ((((tskT.Duration1) * tskFirst.Number1) _
            + ((tskT.Duration2) * tskFirst.Number2) _
            + ((tskT.Duration3) * tskFirst.Number3)) / 6)
            tskT.Text30 = "Duration Calc'd: " & Now()
          Else
            tskT.Text30 = "Not Calc'd: Weights <> 6"
            FoundBadWeights = True
          End If
        Else
          tskT.Text30 = "Not Calc'd: Task In Progress or Complete"
        End If
      End If
    Next tskT
Else
    For Each tskT In ActiveProject.Tasks
      If Not (tskT Is Nothing) Then
        If tskT.PercentComplete = 0 And tskT.PercentWorkComplete = 0 Then
          If (tskT.Number1 + tskT.Number2 + tskT.Number3) = 6 Then
            tskT.Duration = ((((tskT.Duration1) * tskT.Number1) _
            + ((tskT.Duration2) * tskT.Number2) _
            + ((tskT.Duration3) * tskT.Number3)) / 6)
            tskT.Text30 = "Duration Calc'd: " & Now()
          Else
            tskT.Text30 = "Not Calc'd: Weights <> 6"
            FoundBadWeights = True
          End If
        Else
          tskT.Text30 = "Not Calc'd: Task In Progress or Complete"
        End If
      End If
    Next tskT
End If
If FoundBadWeights = True Then
    MsgBox Prompt:="Some Tasks Weight Values were found to be incorrect." & _
    Chr(13) & "Check the Text30 fields for details.", Buttons:=vbCritical, _
    Title:="WorkPERT Weights Error"
End If
End Sub