In this blog post, I’m going to show you how to automatically format the color of Gantt bars in Microsoft Project using custom Flag fields and the Bar Styles dialog. If you have ever wasted time manually coloring individual Gantt bars one by one for a specific vendor, department, or high-risk task category, you already know how tedious it is to maintain as your schedule grows.
Companion Articles in This Views, Tables, Filters & Formatting Series: Explore these connected tutorials in the same topic area to build your skills step by step:
- Current Article (You Are Here): How to Automatically Color Gantt Bars in Microsoft Project Using Flag Fields
- Companion Tutorial: Remove Resource Names from Gantt Chart in Microsoft Project
- Companion Tutorial: How to Hide Summary Tasks and Outline Numbers in Microsoft Project
- Companion Tutorial: How to Add and Remove Columns in Microsoft Project
- Full Topic Hub: Browse All Views, Tables & Formatting Tutorials →
At a Glance: Automatic Gantt Bar Colors in Microsoft Project:
- Applies to: Microsoft Project Standard and Professional (2016, 2019, 2021, 2024, and Project Online Desktop Client).
- Step 1: Open Project -> Custom Fields, switch Type to Flag, and rename
Flag1to match your category (for example,Vendor TaskorHigh Risk). - Step 2: Insert your custom
Flag1column into the Gantt Chart task table and set the target tasks toYes. - Step 3: Open Gantt Chart Format -> Format -> Bar Styles, scroll to the very bottom row, create a new rule with
Normal,Flag1in the Show For…Tasks column, and pick your custom bar color.
Need hands-on help with your schedule? Explore my $399 Microsoft Project Desktop Course, Project Server Training, or book 1-on-1 Private Training & Consulting.
Why Should You Use Bar Styles Instead of Formatting Individual Gantt Bars?
Microsoft Project gives you two ways to format Gantt bars:
- Format -> Bar (Manual Formatting): Changes the color of only the currently selected task bars. If you add 20 more vendor tasks next month, you have to remember to format every single one of them manually.
- Format -> Bar Styles (Automatic Rule-Based Formatting): Applies formatting rules across the entire view based on task conditions (such as
Critical,Milestone, or customFlagfieldsFlag1throughFlag20). Whenever a task’s Flag field changes toYes, its Gantt bar color changes automatically!
Just like highlighting task rows automatically in the task table, pairing a Custom Flag field with a Bar Style rule is the cleanest way to color-code your Gantt Chart screen.
Step 1: How Do I Create and Rename a Custom Flag Field?
First, let’s customize one of Microsoft Project’s 20 built-in task Flag fields (Flag1 through Flag20):
- Click the Project ribbon tab and click the Custom Fields button in the Properties section of the ribbon.
- In the Custom Fields dialog:
- Leave the Task option selected in the upper-left corner.
- Click the Type pick list button in the upper-right corner and select Flag.
- Select
Flag1in the field list and click the Rename… button. - Type a descriptive name for the tasks you want to color (for example,
Vendor TaskorHigh Priority) and click OK. - (Optional) If you want Microsoft Project to set this Flag to
Yesautomatically using a formula (such as checking whetherResource Namescontains a specific vendor), click the Formula… button, enter your formula, and click OK. - Click OK to close the Custom Fields dialog.
Step 2: How Do I Flag the Target Tasks in the Gantt Chart Table?
Next, let’s add your new Flag column to the task table and flag the tasks you want to color-code:
- In the Gantt Chart screen, right-click the Resource Names column header (or any column header) and click the Insert Column item on the shortcut menu.
- Start typing the name of your custom field (for example,
Vendor Task) and press Enter. - For each detail task that belongs to that category, click inside the
Vendor Task(Flag1) column, click the pick list button, and change the value fromNotoYes.
(Note: Only change the Flag value to Yes on detail tasks, not on Summary Tasks or Milestones.)
Step 3: How Do I Configure the Bar Styles Dialog to Color Flagged Tasks Automatically?
Now comes the magic step! Let’s tell Microsoft Project to automatically paint any normal task bar where Flag1 = Yes in a bright custom color:
- Click the Gantt Chart Format ribbon tab.
- In the Bar Styles section, click the Format pick list button and choose Bar Styles on the menu.
- In the Bar Styles dialog:
- Scroll all the way to the very bottom of the Bar Styles table and click in the first blank row under the Name column. (Why the bottom row? Because Microsoft Project evaluates Bar Styles from top to bottom, meaning rules at the bottom of the list override the default
Taskbar style near the top!) - In the Name column on that blank row, type the name of your rule (such as
Vendor Task). - Click in the Show For…Tasks column on that same row and type
Normal,Flag1(or selectNormalfrom the pick list, type a comma,, and selectFlag1). IncludingNormalensures the bar style applies only to regular detail tasks and does not overwrite Summary Tasks or Milestones. - Look at the Bars tab in the lower half of the Bar Styles dialog, and under the Middle section:
- Click the Shape pick list button and select the full rectangular bar shape (the second item down from the top).
- Click the Pattern pick list button and select the Solid pattern (the second item down).
- Click the Color pick list button and select a distinct color (such as Orange, Purple, or Bright Green).
- Click OK to close the Bar Styles dialog.
- Scroll all the way to the very bottom of the Bar Styles table and click in the first blank row under the Name column. (Why the bottom row? Because Microsoft Project evaluates Bar Styles from top to bottom, meaning rules at the bottom of the list override the default
Look, Ma, no hands! Every task with Vendor Task (Flag1) set to Yes immediately switches to your new Gantt bar color. Better yet, if you change a task’s Flag column back to No, its Gantt bar instantly reverts to the standard blue bar!
Frequently Asked Questions
Why didn’t my Gantt bar color change after adding the Flag1 rule in Bar Styles?
The two most common reasons are row order and Critical Path highlighting. First, make sure your new Normal,Flag1 row is placed below both the standard Task row and the Critical row at the very bottom of the Bar Styles dialog (since lower rows override higher rows). Second, double-check that you selected Flag1 (and not “Not Flag1“) in the Show For…Tasks column.
Why must I include “Normal” before “Flag1” in the Show For…Tasks column?
If you enter only Flag1 in the Show For…Tasks column without Normal,, and you accidentally set Flag1 to Yes on a Summary Task or a Milestone, Microsoft Project will draw a colored task bar right over the top of your black Summary bar or Milestone diamond! Entering Normal,Flag1 restricts the rule strictly to regular detail tasks.
Can I create multiple automatic Gantt bar colors for different departments?
Yes! Microsoft Project provides 20 task Flag fields (Flag1 through Flag20). You can rename Flag1 for Engineering, Flag2 for Procurement, and Flag3 for Construction, then add three separate rows (Normal,Flag1, Normal,Flag2, and Normal,Flag3) at the bottom of the Bar Styles dialog with three different bar colors.
Does a custom Bar Style travel with the .mpp file when I send it to someone else?
Yes! Bar Styles are saved inside the specific View (such as the Gantt Chart view) within your .mpp project file. Anyone who opens your .mpp file in Microsoft Project Desktop will see the exact same automatic Gantt bar colors.
Ready to master Microsoft Project? If you found this article helpful, check out my free tutorials on my YouTube channel, download my Free Microsoft Project Quality Filters, or explore my structured, expert-led training courses and 1-on-1 coaching at dalehowardmvp.com.





Leave a Reply