How to Use Conditional Formatting for Next-Day Times After a PM Schedule
Question details
Set up conditional formatting rules to accurately identify late times when an event scheduled for the evening (PM) is completed the following morning (AM).

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Tracking schedules, such as overnight shifts or late-night processes, where events scheduled before midnight are completed after midnight on the next day.
- Observed behavior
- Standard conditional formatting fails because morning times (AM) appear mathematically smaller than evening times (PM), causing the spreadsheet to misinterpret actual times as being early rather than occurring on the following day.
Ensure that your schedule data is strictly formatted using the 'Time' format in your spreadsheet so that the underlying numerical values can be accurately calculated by the formatting rules.
Apply a 12-Hour Adjustment Formula in Conditional Formatting
Use a custom formula that dynamically adds 24 hours to the actual time if the difference between the scheduled time and actual time indicates a midnight crossover.
Time values in spreadsheets are stored as fractions of a 24-hour day. When an event scheduled at 11:00 PM (23:00) occurs at 1:00 AM (01:00), the actual time is mathematically smaller. To fix this, we apply an adjustment formula, assuming the delay is never more than 12 hours.
Highlight the cells containing the actual times you want to evaluate (for example, Column E, assuming Column D contains the scheduled times).
Navigate to the Home tab on the ribbon, click on 'Conditional Formatting', and select 'New Rule' from the dropdown menu.
Select 'Use a formula to determine which cells to format'. Enter the following formula: =E2+(D2-E2>12/24)<=D2 (Adjust E2 and D2 to match your starting cells).
Create another new rule using the formula option, and enter: =E2+(D2-E2>12/24)>D2 to identify actual times that occurred later than the scheduled time.
Click the 'Format' button to choose your desired highlight colors (e.g., Red for late and Green for on time). Click 'OK' to apply the rules to your selected range.

Use WPS Spreadsheet to Manage Overnight Schedules
WPS Spreadsheet fully supports complex conditional formatting and time-based formulas. You can seamlessly manage shift schedules, calculate time differences across days, and visually flag late entries with a highly familiar interface.
- 1. Open your schedule: Launch WPS Spreadsheet and open your tracker containing the scheduled and actual times.
- 2. Select your data: Highlight the entire column or range of actual times you need to evaluate for tardiness.
- 3. Access conditional rules: Click 'Conditional Formatting' under the Home tab and choose 'New Rule'.
- 4. Apply formula: Input the time adjustment formulas and customize your alert colors to instantly visualize late entries.

Frequently Asked Questions
Why does my spreadsheet consider 1:00 AM to be earlier than 11:00 PM?
Spreadsheets store times as fractions of a single 24-hour day, where 1:00 AM is 1/24 (approx. 0.04) and 11:00 PM is 23/24 (approx. 0.95). Without a specific date attached, the software evaluates the fraction and determines 1:00 AM is numerically smaller, failing to recognize it belongs to the next day.
How does the '>12/24' part of the conditional formatting formula work?
The expression 'D2-E2>12/24' checks if the scheduled time is more than 12 hours greater than the actual time. If this is true, it evaluates to 1 (which equals one full day in spreadsheet mathematics). This effectively adds 24 hours to the actual time, pushing it to the next day for an accurate comparison.
Can I use this formula if a delay or shift length exceeds 24 hours?
No, this specific formula assumes the delay or shift duration is never more than 12 hours. If shifts or delays can exceed 24 hours, you must input the full date along with the time in the cell (e.g., '10/25/2023 11:00 PM') rather than relying solely on time values.
Will these conditional formatting rules transfer if I send my file to an Excel user?
Yes. WPS Spreadsheet and Microsoft Excel utilize the exact same mathematical logic and syntax for date, time, and conditional formatting. Your rules and highlighted cells will appear perfectly when opened in Excel.




