Skip to content

Gantt Chart Bar Colour Coding

James ArundellMember for 19 years 7 months
Created
6
6
0
Hi,

I’m currently trying to put together a Gantt chart in MS Project.

I would like to be able to group together similar tasks ie. Tasks representing a certain business area are listed first followed by tasks representing a different business area underneath. I would also like their corresponding bar on the gantt chart to be a particular colour dependent upon what group that task is in.

I’m fairly new to Project and the only way I can think to achieve this so far is to create a column called "Group name" with ’field name’ set to "Text1". The cell contents will then be the name of the group eg "Retail","Supply Chain" etc. I would then look to create a macro that would search the "Group name" column and then change the colour of the bar dependent upon the value in the cell eg red for "retail", blue for "supply chain" etc.

Is this possible? Am I overly complicating an easy task?

Apologies if there is a simpler way round this, however my knowledge is fairly limited! Any help would be greatly appreciated.

Thank you in advance.

6 replies

Oldest first
  1. 0
    James Griffiths ·
    Hi James,

    You probably could write a macro or some sort of VB code to do as you require, but I think that you’re over-complicating things a bit (but I’m not particularly versed in the art of VB writing anyway)

    I get the impression that you’ll be using the "Group By..." function in order to get the groupings that you desire. Once you have done this, then the easiest way is just to apply a filter (an Autofilter will work perfectly well), in Text1, to extract "retail" or "supply chain" values. You then just highlight all the activities, click Format>Bar>Bar Shape, and then change the colour.

    HTH.

    James.
  2. 0
    James Arundell ·
    Thanks for the help, does exactly what I need!
  3. 0
    Alexandre Faulx-Briole ·
    James(s),
    Add a text column in the Gantt Chart table and enter the "group" name for each task, as James describes
    Go to Tools, Customize, Fields, and create a formula that says "if ’group’ = ’supply’ then indactor1 = ’yes’" and so on for the other goup names
    Go to Format, Bar Styles, and create new bars that represent "norma, critical, indicator1" and so on
    This way, as soon as you select a particular group name for a task, the bar color will change accordingly.
    Good work,
    Alexandre
  4. 0
    Glen Mettler ·
    I use the flags, a text field I call Acro, and a cust task sheet view. The Acro field (short for Acronym) contains a short word that describes the task (ie "Conduct Thermal Test" would be "Therm Test" in Acro). I use the flag fields to indicate the type of symbol and where I want the label (left, right, top, bottom). I create a cust task sheet view to show in lower pane that displays the task, acro, dates, and flag fields (renamed as appropriate). In Bar Styles I create bars and indicators that correspond to the flags. I can then select the task and then select the flag in the task entry pane and the bar or symbol will display as appropriate and put the label either left, right, up, or down as approriate.

    If you want, I can send you a project file and then we can talk on the phone. Two minutes of phone talk is much better than a couple of pages of written explanation.

    Regards,

    Glen
  5. 0
    Trevor Rabey ·
    James,
    Have a look at some of the formatting in some of the built in Views for clues about how to set bar styles colours for Tasks that meet certain criteria. Some of the criteria can be combinations, eg "Summary,Critical". This one makes Summary bars which have zero Total Slack go whatever colour you like. Another good one is "Milestone, Critical", which can be used to make zero total slack Milestones go red. You have to get the syntax right with the comma etc.
    If you use one of the custom fields such as Flag1 you could use a combination criteria such as "Normal, Flag1".
    You could use this to make all normal tasks which also have Flag1 set to "Yes" take on whatever style you choose.
    You could set Flag1 by data input or you could make it a calculated result with a formula.

    when you make or contemplate serious formatting changes like this it is best to make it part of a new View rather than messing up the built in View.

    Once you get the hang of using the spare custom fields you can also sort, filter and group on them, so they become really important.

    My VBA is pretty hopeless but I find that so much can be achieved without it that I never need it.

    Exhaust the possible simple solutions before over-reaching to the complicated ones.
  6. 0
    James Arundell ·
    Thank you all for your help, I think I’m more or less there now. Fingers crossed!

Log in or join to reply

ProjectControls.com is free to join. Members can post questions, reply, vote and follow discussions.

Existing members: your original username and password still work. Forgot password?