How to Apply Conditional Formatting to a Gantt Chart Based on Another Cell
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'.

- 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.
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'.
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.
Highlight the entire grid area of your Gantt chart where the bars are displayed (for example, D2:Z100).
Go to the 'Home' tab on the ribbon, click on 'Conditional Formatting', and select 'New Rule'.
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.
Click the 'Format' button, navigate to the 'Fill' tab, and choose the color red. Click 'OK' to confirm.
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.

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. Open your Project File: Launch WPS Spreadsheet and open your project tracker or Gantt chart document.
- 2. Apply Conditional Formatting: Navigate to Home > Conditional Formatting > New Rule to set up your milestone highlights using formula references.
- 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.

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'.




