How to Color Excel Cells Containing X Using Conditional Formatting
Question details
Highlight specific cells containing the letter 'X' to mark days off in a shift work calendar.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Setting up a shift work calendar where different shift patterns and days off (marked with an X) need distinct background colors for visual clarity.
- Observed behavior
- The user needs to automatically fill color in specific cells indicating an 'X' to distinguish them from the rest of the shift schedule.
Ensure your calendar template is open and identify the exact cell ranges representing your schedule where the rules need to be applied.
Use Formula-Based Conditional Formatting
Create a custom formula rule to accurately identify and color cells containing exactly the letter 'X'.
This method gives you complete control over how the formatting is applied and is highly adaptable if you need to build more complex logical conditions later.
Highlight the entire grid of cells in your calendar where you track the shift patterns and days off.
Navigate to the 'Home' tab on the top ribbon, click on 'Conditional Formatting', and select 'New Rule'.
Select 'Use a formula to determine which cells to format'. In the formula box, type =A1="X" (replace A1 with the actual reference of the top-left cell in your highlighted range).
Click the 'Format' button, go to the 'Fill' tab, choose your desired background color (e.g., white or gray for days off), and click 'OK' to apply the rule.

Use 'Highlight Cells Rules' for Specific Text
A simpler built-in option to highlight cells containing specific text without typing a custom formula.
Easily Highlight Calendar Cells in WPS Spreadsheet
WPS Spreadsheet features robust, intuitive conditional formatting tools that are completely compatible with Microsoft Excel. You can quickly color-code schedules, shift patterns, and text-based entries with a few simple clicks.
- 1. Open the Calendar: Launch WPS Spreadsheet and open your shift schedule document.
- 2. Select the Schedule: Highlight the date cells that you want to apply the formatting to.
- 3. Apply Conditional Formatting: Navigate to Home > Conditional Formatting > Highlight Cells Rules > Text that Contains.
- 4. Set Text and Color: Enter 'X' into the criteria box, select your desired fill color, and click OK to instantly update your calendar.

Frequently Asked Questions
Can I apply different colors for the three different shift patterns?
Yes. You can layer multiple conditional formatting rules over the same range of cells. Simply repeat the 'New Rule' process, applying different formulas or specific text criteria for each shift pattern, and choose a unique fill color for each.
Do I need to create a separate rule for every single month?
Not necessarily. If your months are on the same worksheet, you can select all the monthly grids simultaneously by holding the Ctrl key, and then apply the rule once. Alternatively, use the 'Manage Rules' dialog to manually expand the 'Applies to' range to include all months.
Why is the color only applying to the first cell and not the rest of the calendar?
This usually happens if your formula uses absolute referencing. If you typed =$A$1="X", Excel locks the evaluation to that exact cell. Change it to =A1="X" so the rule dynamically checks every cell in the selected range.




