none
I have a large plan with embedded subplans, how to find out how many tasks the project contains? RRS feed

  • Question

  • Hi all, I have a large plan made up of subplans within subplans, and I need to know how many tasks there are total. Short of counting them by hand, how else can I find the total? Ideally, I need to count only true tasks, and not the rollups. Is this possible? thx!


    Planning for a better Nepal

    Tuesday, August 13, 2013 11:28 PM

Answers

  • Hi,

    No VBA code needed for this and the count will update if you add new tasks.

    Display the Gantt Chart view with the default Entry table applied.

    Go to the "Add New Column" column to the right side and click in the heading.

    Start to type Number to filter the list and select one of the number fields (Number1 for example).

    That will insert the field into the table.

    Right click on the inserted column heading and select "Customize Field".

    In the "Calculation for group or summary rows" select "Count non-summaries."

    Julie


    Wednesday, August 14, 2013 1:33 PM
    Moderator

All replies

  • planningcig --

    There is no default method to accomplish this.  If it were me, I would write a short macro in the VBA programming language to count tasks, but not include summary tasks.  Hope this helps.


    Dale A. Howard [MVP]

    Wednesday, August 14, 2013 11:23 AM
    Moderator
  • Put the following code into a module in your IPS, and then when you run the  macro named "ShowTaskCount" it will count all the non-summary tasks in the project (including any subprojects), and give you the result in a dialogue box.

    Option Explicit

    Sub ShowTaskCount() MsgBox CountTasksinIPS(activeProject) & " non-summary tasks counted in this master schedule." End Sub

     

    Private Function CountTasksinIPS(pj As Project) As Long Dim result As Long Dim spj As Subproject result = CountTasksinProject(activeProject) For Each spj In activeProject.Subprojects If spj.SourceProject.Subprojects.count > 0 Then result = result + CountTasksinIPS(spj.SourceProject) Else result = result + CountTasksinProject(spj.SourceProject) End If Next spj CountTasksinIPS = result End Function

     

    Private Function CountTasksinProject(pj As Project) As Long Dim t As task Dim result As Long For Each t In pj.Tasks If t Is Nothing Then GoTo NextTask If t.ExternalTask Then GoTo NextTask If t.Summary Then GoTo NextTask result = result + 1 NextTask: Next t CountTasksinProject = result End Function


    Good luck,
    Andrew

    Wednesday, August 14, 2013 11:54 AM
  • You can work with one of the custom number fields and a small bit of manipulation if the idea of writing a macro doesn't appeal.

    Insert one of the custom Number fields in the table. Right click on the field and select Customize field from the shortcut menu. Select "Count non-summaries".  You should now see the number of non-summary tasks at the inserted project line for each subproject.

    I hope this helps.

    Julie

    Wednesday, August 14, 2013 11:56 AM
    Moderator
  • thx dale, I've got to learn how to write VBA macros, but at this point I only know how to spell V-B-A and have a vague notion of what that means. I see a script has been posted already!

    Planning for a better Nepal

    Wednesday, August 14, 2013 1:11 PM
  • Andrew, unfortunately I have not learned VBA yet, that's next on the list :) I don't even know what an IPS is. But I will learn. I am really good on a mac with applescripts and whatnot, so I should be able to figure it out. 

    Planning for a better Nepal

    Wednesday, August 14, 2013 1:13 PM
  • Julie, I like the idea of this, as I have not learned about VBAs yet and need to do this right now. When you say insert "one of the custom Number fields in the table" I have to ask which custom Number fields and in which table? For example, I did not know I had a custom Number field - ha! But I want to try! thx.


    Planning for a better Nepal

    Wednesday, August 14, 2013 1:16 PM
  • I'm sure you'll get to grips with VBa quite quickly.

    IPS means Integrated Programme Schedule, which in the context I've used it here, just means the master project with sub-projects inserted within it. So run this code against the master project.

    Thanks,

    Andrew

    Wednesday, August 14, 2013 1:16 PM
  • Hi,

    No VBA code needed for this and the count will update if you add new tasks.

    Display the Gantt Chart view with the default Entry table applied.

    Go to the "Add New Column" column to the right side and click in the heading.

    Start to type Number to filter the list and select one of the number fields (Number1 for example).

    That will insert the field into the table.

    Right click on the inserted column heading and select "Customize Field".

    In the "Calculation for group or summary rows" select "Count non-summaries."

    Julie


    Wednesday, August 14, 2013 1:33 PM
    Moderator
  • Julie,

    Nice simple solution. I didn't realize that rollup option even existed. The only problem I found is that some users like to insert blank lines in their plan to separate various sections. The rollup counter will count those blank lines as tasks along with the real tasks.

    John

    Wednesday, August 14, 2013 3:31 PM
  • Thanks John.  Yes, blank lines will cause the count to be incorrect.  But blank lines in a project have always been on my "Don't" List :-)
    Wednesday, August 14, 2013 3:57 PM
    Moderator
  • No blank lines for me either. I have actually written a macro to remove them. Not sure which version of Project, probably 2003 or earlier; but we ran into a situation when collapsing part of the schedule, some of the end dates changed. It turned out to be a symptom of having blank lines in the schedule. Maybe it's no longer a problem, but based on the pain of troubleshooting that instance, one of the first things I do if troubleshooting someone else's schedule is to delete all blank lines before even looking elsewhere.

    Mike

    Wednesday, August 14, 2013 4:39 PM