Highlight Gantt Bars by Resource Assignment Tutorial
Occasionally, a delegate on a training course will ask how they can get the bars of their Gantt chart to change colour when a particular resource is assigned to the task. When the request has happened twice in one week I decided that it was time to write a tutorial.
From time to time I see Gantt charts that are very colourful and after a few moments of confusion I realise that the person who has put the plan together has used colour to highlight resource allocations rather than the more usual stuff like the critical path or tracking information. On close inspection of the chart, without fail, I find that the formatting has been applied on a task bar-by-task bar basis by double-clicking on the bar and then selecting a different colour for the bar.
This is a far from satisfactory way of doing things and what my delegates want is for a bar to change colour automatically when a particular resource is assigned to it. This tutorial will teach you how.
We begin with a bit of Project Customisation.
Customizing Project
To achieve our goal we need to do several things. To begin we will do the technical bit which checks to see if a task has a particular resource assigned to it.
Custom Fields
The process begins with Custom Fields. Each task in MS Project has over 200 fields associated with it, you should be familiar with fields such as “name”, “Duration” and “Start” but you may not have come across many of the obscure fields like “Confirmed” or “UniqueID”. The majority of these fields have a predefined purpose which the program requires to function. However there are a large group of fields that don't have a defined purpose, they are called Custom Fields. These custom fields have been created so users can customize MS Project to perform functions that it has not been programmed to do.
There are several different types of custom fields that have been designed for different purposes, some hold dates, some numbers others text or flags. We are going to use a flag field. A flag is limited to two values “yes” or “no” (the flag is either raised or lowered). MS Project has 20 custom flag fields: flag1, flag2, flag3 etc. up to flag20. What we need to do is customize a flag field so it changes from “no” to “yes” when a particular resource is assigned to a task, we will then be able to use this flag to change to the colour of a bar.

Open MS Project and immediately save the project as "Resource Highlight.mpp". Next switch to the Resource Sheet view. Create a Resource called “Project Engineer”. Return to the Gantt Chart and create several tasks, assign the Project Engineer to some of these tasks.
Stay in the Gantt Chart view and select the Tools menu and then Customize and then Fields. The Customize Fields window will appear. Use the “Type:” and select Flag. Now click on “Flag1”. At this point you could rename the flag to “Resource Project Engineer” but there isn't a great deal of point. In the “Custom Attributes” section click on the Formula button. This allows you to assign a Formula to Flag1 which will determine the flag's state.
Click on the “Field” button. On the menu that appears select “Text” and then on the pop-out menu click on “Resource Names”. You will now have [Resource Names] in the “Flag1 =” input box, with the cursor flashing after it. Now type =“Project Engineer” (that's equals, double quotes, Project Engineer, double quotes). Next click the OK button. A message box will appear warning you that any data stored in the Flag1 field will be removed and replaced by the calculation you've just created—This is what we want so click on OK. Next click on the OK button of Custom Fields.

To make this less specific to a particular project the flags could be set up for resources by number rather than by name. Flag1 would then equal [ResourceID]="1" with Flag2 set to [ResourceID]="2".
With the calculations bit sorted we now have to set up the bars to change colour as specified by the flag. The next section will consider the formatting of bars.
Formatting Bars

Stay in the Gantt chart and use the Format menu to display Bar Styles. Bar Styles controls the appearance of the task bars in the Gantt chart, you will find the definition of all the different types of tasks, milestones summaries, splits etc that appear in the Gantt chart.
We need to create a new definition for a bar style to make it appear in a different colour on the chart. Scroll down the list and on the first blank row type “Project Engineer” in the “Name” column. Now move to the lower half of the window and change the bar colour to yellow, (make sure you do this in the “middle” section). Back in the table, select the “Show For... Tasks” column for the Project Engineer, click the drop-down and select “Normal” (there are three types of task Normal, Summary and Milestone) then type a comma and once again click the drop-down this time select “Flag1”. The Show For... Tasks box should now contain “Normal,Flag1” without the quotes, if it doesn't have another go at using the drop-down and trying comma or simply type in the the text. Leave the Row, From and To as they are (i.e. 1, Start and Finish)

You have set up your formatting so click on OK and, as if by magic, the Project Engineers task bars will turn yellow.
Finishing Off
You can repeat this process for up to 20 resources—you are limited to 20 flags.
To finish up this tutorial we'll look at how we can make the most of this New View.
A New View
Having gone to the trouble of creating your Gantt Chart that highlights resource assignments you will probably want to make it a permanent part of MS Project which you can use with all your plans. Once again this is a two-stage process, to begin with we will save your specially formatted Gantt chart (with a new name) and then we will make sure it displays correctly in all your plans.
To save your Gantt Chart open the View Menu and then select More Views. The More Views window displays a list of all the views available in MS Project and you use it to choose one of those views or to manage those views by editing, copying or creating new views. We already have the view we require so rather than clicking on the New button click on Copy. This will create a Copy of the Gantt Chart which includes all our custom formatting. In the name section of the View Definition window type Resource Gantt. If you will be using this view a lot then leave the Show in menu option checked, otherwise uncheck and in future you will have to use the more views window to display the view. Click on OK to close the view definition window and then double click on the Resource Gantt in the list to display your custom view.
Final Organisation
You don't want to have to go through this process for each of your project plans so our final step is to save our customisation into the Global.mpt, MS Projects Global template file.
Project uses the Global.mpt to store data on filters, tables, views and much more. It makes this information available to all your project plan, this makes it the ideal place to copy your customisations to. We gain access to the Gobal.mpt through the Organizer which can be opened through the Tools menu.
The information in Organizer is grouped by tabs, we will be using the Custom and Views tabs. Click on the Custom tab and on the right-hand-side (labeled Resource Highlight.mpp) and you will see the Flag1 and any other fields which you have customised. Click on flag1 and then on the Copy button which should now be pointing towards to left-hand-side (labeled Global.mpt), repeat this for any other flags you may have customised. Now click on the Views tab and in the window on the right-hand-side you will see a list of all the views you have used during this tutorial. Select the Resource Gantt and then click on the Copy button.
The Custom Flag and View are now part of Project's global template and they can be used in any of your project plans. Open one of your projects and change to the Resource Gantt, and assign a Project Engineer to a task.
