Microsoft Project Grouping and Conditional Formatting Example and Sample Files

Grouping and Conditional Formatting

Grouping is one of the most powerful of Microsoft Project features. It was introduced in Project 2000 and has continued through Project 2002 and Project 2003. It is remarkably similar to the way Primavera Project Planner (P3) works with "activity codes". Grouping allows you to view the tasks in your project grouped in a number of different ways while still having the option to return to the original outline structure.

To illustrate this let's take a look at a small project. There are two teams working on a project with three phases. Within each phase is a three task iteration (Design, Develop, Test). If we enter the data and organize by the two teams and in sequential order we end up with a project which looks like this:

Project Grouping And Conditional Formatting
For the time being ignore the coloring of activities. I'll show you how to achieve that next. The important thing is to look at the columns to the right of the task name. These are just text fields which have been renamed and filled in with the appropriate information. You can use text fields, outline codes, number fields or any other custom or user-defined fields you like. <

First right click on the column header to bring up the customize fields dialog:

Customize Fields

Then click on "Rename Field" and change the name to something memorable and useful

Rename Fields

You can see that this example is using text fields for "Worktype", "Phase" and "Team" Once the fields have been filled in with the appropriate values the next step is to apply the grouping. The first time through will take a couple of clicks, but after that is it amazingly simple to apply.
Go to the "Project" menu and select "Group by", the "More Groups"

Group By, More Groups

Click on the "New" button and the Group Definition dialog box comes up. Here enter the name of the group and choose the field that the group is based on. I always put an underscore _ in front of the group names I create. This puts them at the top of the list and helps me distinguish them from the built-in groups.

Define Groups

When this is done you are all set to apply that grouping. The end result should look something like this:

Group By Phase

You can define similar groups for Worktype or team. Grouping allows you several levels of hierarchy so you can group by team and then by phase etc...
To return to your original state simple choose "Group by", "no group".

Conditional Formatting

You will note that in the previous example the tasks are color coded by phase. It is possible to do this by formatting them individually, but that method is slow and does not follow any changes you have made to the task (ie: if you change it from Phase 1 to Phase 2 you need to manually reformat. Fortunately there is an easier way. We already have the first part because we have used the Text2 field to indicate which Phase each task is in. The next thing is to use a formula in a flag field to let project know how to format it. We do this because the formatting can use flags to determine how to format a specific task bar. Here is how we set the flag field to be set to "Yes" if the task is in Phase 1". First Right Click on the column header until it brings up the customize field dialog, Choose the Flag1 field and then click on the "Formula" button. This brings up the "Formula" dialog box. Enter the appropriate formula. Here we use an IIF statement. If the condition [Text2]="Phase 1"is true, then the first value "Yes"is returned. If false it returns the second value "No".

IIF formula Syntax

Click OK to exit and then it is time to format the barstyle. This is pretty simple. Go to the "Format" menu, Select "Barstyles". Insert a row at the bottom and call it whatever you like. Then set it to draw based on "Flag1" just as shown here:

Format Barstyles

Set up other barstyles using other flag fields until you have one for every phase or for every category you are interested in. You can see that this file has three custom barstyles. One thing to be wary of. Bars are drawn in the order they are listed in. So a wide bar at the end of the list might be drawn over a bar which is defined earlier in the list. You should define the basic barstyles at the beginning and things like baselines further down the list.

Download the Microsoft Project File (Project 2002 format) that was used for this example

Can't find it here?

Send me mail at:

Return To Example Page

Return To Project Page