Formatting Issues

How to Apply Conditional Formatting to a Gantt Chart Based on Another Cell

John WilsonJohn Wilson Nov 10, 2026 868 views

Question details

The user wants to change the color of a Gantt chart bar (e.g., from blue to red) based on the value of a specific cell in another column, such as marking a row as a 'Milestone'.

How to Apply Conditional Formatting to a Gantt Chart Based on Another Cell
Product
Spreadsheet
Device & OS
not provided
Scenario
Customizing a spreadsheet-based Gantt chart to visually highlight specific tasks or milestones using conditional formatting.
Observed behavior
The user needs a conditional formatting rule applied across the timeline range that dynamically references the 'Lead' column for each row to trigger a color change.
Before you start

Ensure your Gantt chart timeline range is clearly defined and identify the exact column letter (e.g., Column B) that contains the trigger values like 'Milestone'.

Solution 1Recommended

Use a Formula-Based Conditional Formatting Rule

Apply a custom formula to the entire timeline range to check the value of the target column and change the cell color accordingly.

By utilizing a formula in your conditional formatting, you can lock the column reference while allowing the row reference to change dynamically. This ensures that every cell in your Gantt timeline checks the correct 'Lead' cell for its specific row.

1
Select the Timeline Range

Highlight the entire grid area of your Gantt chart where the bars are displayed (for example, D2:Z100).

2
Open Conditional Formatting

Go to the 'Home' tab on the ribbon, click on 'Conditional Formatting', and select 'New Rule'.

3
Enter the Custom Formula

Choose 'Use a formula to determine which cells to format'. Enter a formula like =$B2="Milestone" (assuming Column B is your Lead column and row 2 is the first row of your selection). The dollar sign ($) is crucial as it locks the column reference.

4
Set the Formatting Style

Click the 'Format' button, navigate to the 'Fill' tab, and choose the color red. Click 'OK' to confirm.

5
Adjust Rule Priority

If you have existing formatting rules (like standard blue bars), go to 'Conditional Formatting' > 'Manage Rules'. Ensure your new milestone rule is placed above the standard rule, and check 'Stop If True' if necessary.

Use a Formula-Based Conditional Formatting Rule
Absolute vs. Relative References: Using $B2 ensures that every cell in the row looks at Column B, but the row number changes dynamically as the rule applies down the grid. If you select D5 as your starting cell, ensure your formula uses $B5.
Manage Projects Efficiently

Create Dynamic Gantt Charts Easily with WPS Spreadsheet

WPS Spreadsheet offers robust conditional formatting tools, making it easy to build and customize professional Gantt charts for project management.

  1. 1. Open your Project File: Launch WPS Spreadsheet and open your project tracker or Gantt chart document.
  2. 2. Apply Conditional Formatting: Navigate to Home > Conditional Formatting > New Rule to set up your milestone highlights using formula references.
  3. 3. Use Free Templates: Alternatively, click 'New' and search for 'Gantt' in the template library to use pre-built, beautifully formatted project trackers without manually setting up formulas.
Advanced conditional formatting with formula support for dynamic Gantt charts.Fully compatible with Microsoft Excel (.xlsx) formulas and formatting rules.Built-in project management templates available for quick starts.Lightweight and free to use with an intuitive, tabbed interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my conditional formatting applying to the wrong rows?

This usually happens if the row reference in your formula doesn't match the top row of your selected range. For example, if you highlighted D5:Z100, your conditional formatting formula must reference =$B5, not =$B2.

Can I use multiple colors for different task statuses in my Gantt chart?

Yes. You can create multiple formatting rules using the same method. Just add another new rule for a different status, like =$B2="In Progress", and set its format fill color to yellow or green.

How do I remove the conditional formatting if I make a mistake?

Go to the 'Home' tab, click 'Conditional Formatting', select 'Clear Rules', and choose either 'Clear Rules from Selected Cells' or 'Clear Rules from Entire Sheet'.