How to Fix Excel Conditional Formatting for the First Calendar Week
Question details
The user needs a working conditional formatting formula to ensure the first calendar week is properly highlighted when an activity begins during that specific week.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Building a weekly project calendar, tracker, or Gantt chart using conditional formatting to highlight activity durations.
- Observed behavior
- The existing conditional formatting formula successfully fills cells for subsequent weeks but omits highlighting the first displayed week when the activity starts mid-week.
Verify your spreadsheet layout: ensure the activity start date is in column B (B2), the end date is in column C (C2), and the weekly date headers begin in column E (E1).
Use the Combined OR/AND Logical Formula
Apply a combined logical formula that evaluates multiple date boundaries to ensure the first week is captured regardless of the exact start day.
This solution uses a combination of OR and AND functions to check if the activity start date falls within the boundaries of the weekly headers. By comparing the start and end dates against the current, previous, and next week's headers, the spreadsheet will accurately trigger the formatting for the very first week.
Click and drag to select the range of calendar cells you want to format, starting from cell E2 downwards and across your timeline.
Go to the 'Home' tab on the ribbon, click on 'Conditional Formatting', and select 'New Rule' from the dropdown menu.
In the dialog box, select 'Use a formula to determine which cells to format'.
Paste the following formula into the input box: =OR(AND(D$1<=$B2,E$1>=$B2),AND(E$1<=$B2,F$1>=$B2),AND(E$1>=$B2,E$1<=$C2))
Click the 'Format' button, navigate to the 'Fill' tab, choose your desired highlight color, and click 'OK' twice to apply the rule.

Seamlessly Track Project Schedules with WPS Spreadsheet
WPS Spreadsheet fully supports advanced logical formulas and conditional formatting rules. You can easily build dynamic weekly calendars and Gantt charts to track your project timelines with zero formatting errors.
- 1. Open your project file: Launch WPS Spreadsheet and open the document containing your project calendar or Gantt chart.
- 2. Select the calendar grid: Highlight the cells under your weekly date headers where the visual timeline should appear.
- 3. Create a new formatting rule: Navigate to the 'Home' tab, click 'Conditional Formatting', and select 'New Rule'.
- 4. Apply the logic: Choose 'Use a formula to determine which cells to format', paste the =OR(AND(...)) formula, set your fill color, and click 'OK'.

Frequently Asked Questions
Why does my conditional formatting formula skip dates?
This usually happens when the logical conditions (like >, <, >=, <=) do not account for dates falling exactly between two specific header milestones, or if absolute and relative cell references (using the $ symbol) are applied incorrectly.
Can I use this formula for daily calendars instead of weekly?
Yes, but for daily calendars, a simpler formula like =AND(E$1>=$B2, E$1<=$C2) is often sufficient because the column headers increment by exactly one day, eliminating the need to check 'between-week' logic.
How do I apply this conditional formatting to other rows?
You can use the Format Painter tool. Select a cell with the correct conditional formatting applied, click the Format Painter icon on the Home tab, and then drag it across the new rows. Because the formula uses mixed references (like $B2), it will dynamically adapt to each new row.




