Article ID: 209115 - View products that this article applies to.
This article was previously published under Q209115
Expand all | Collapse all

Summary

Microsoft Project does not calculate the Schedule Performance Index (SPI) or the Cost Performance Index (CPI). This article contains a sample macro that calculates SPI and CPI for each task in a project.

NOTE: SPI is the ratio of work performed to work scheduled (BCWP/BCWS). CPI is the ratio of budgeted costs to actual costs (BCWP/ACWP).

More information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
The following macro calculates the Schedule Performance Index (SPI) and the Cost Performance Index (CPI) for each task and places the results into Numeric fields. The SPI for each task is equal to BCWP/BCWS. The CPI for each task is equal to BCWP/ACWP.

To create this macro, follow these steps:
  1. On the Tools menu, point to Macro, and then click Macros. For Project 2010, go to the View tab and click the Macros button.
  2. In the Macro name box, type CalcSPI_CPI, and then click Create to open the Visual Basic Editor.
  3. Create the macro by typing the following subroutine.
    Sub CalcSPI_CPI()
    Dim t As Task
    For Each t In ActiveProject.Tasks
      If Not t Is Nothing Then
        If t.BCWS <> 0 Then
            t.Number10 = t.BCWP / t.BCWS 'this calculates SPI
        End If
        If t.ACWP <> 0 Then
            t.Number11 = t.BCWP / t.ACWP 'this calculates CPI
        End If
      End If
    Next t
    End Sub
    						

    NOTE: This example uses the Number10 and Number11 fields. You can use any of the other numeric and alphanumeric fields available. You may also want to use the Format function to format your results.
  4. In the Visual Basic Editor, on the File menu, click Close And Return To Microsoft Project.
  5. In Microsoft Project, on the Tools menu, point to Macro, and then click Macros. For Project 2010, go to the View tab and click the Macros button.
  6. In the list of macros, click CalcSPI_CPI. Click Run.
To view the results of the macro, insert the Number10 and Number11 field in a task table. To do this, follow these steps:

  1. On the Insert menu, click Column. For Project 2010, go to the Format tab and click the Insert Column button.
  2. In the Field name list, click Number10.
  3. Click OK.
  4. Repeat steps 1-3 for the Number11 field.

Properties

Article ID: 209115 - Last Review: March 26, 2013 - Revision: 5.0
Applies to
  • Microsoft Project 98 Standard Edition
  • Microsoft Project 2000 Standard Edition
Keywords: 
kbhowto KB209115

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com