How to Calculate Telephone Coverage Without Overlaps in Excel
Question details
The user needs to calculate the total unique time coverage provided by up to five employees between 08:00 and 18:30, ensuring overlapping shifts are not counted twice, and apply conditional formatting to the results.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Scheduling employee phone shifts and validating the total continuous coverage duration for a specific workday window.
- Observed behavior
- Standard sum functions double-count times when employee shifts overlap. A method is needed to merge overlapping intervals into a single time duration and color-code the final output (red if under 10.5 hours, green if adequate).
If you plan to use the VBA macro solution, ensure your workbook is saved as an Excel Macro-Enabled Workbook (.xlsm) so your code runs correctly.
Use a Custom VBA Macro to Merge Intervals
A custom VBA function is the most efficient way to merge overlapping start and end times, calculating the exact unique duration covered by all employees.
By writing a custom VBA User Defined Function (UDF), you can pass a range of start and end times to the function. The script will mathematically combine overlapping intervals and return the true covered duration between 08:00 and 18:30.
Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the top menu, click Insert > Module. Paste your custom interval-merging VBA code into the blank window.
Return to your worksheet. In column S, type your new custom function (e.g., =CalculateCoverage(A2:B6)) to calculate the exact coverage without double-counting.
Select the result cells in column S. Go to Home > Conditional Formatting > Highlight Cells Rules. Set a rule for 'Greater Than or Equal To' 10:30 (or its decimal equivalent) and format it with green. Set another rule for 'Less Than' 10:30 formatted with red.

Use a Helper-Cell Gantt Timeline Approach
If you prefer not to use VBA, you can break the workday down into small time increments and check coverage using formulas.
Calculate Distinct Time with Power Query
Power Query can expand shift durations into lists of individual minutes and remove duplicates to find the exact total coverage.
Manage Complex Schedules Effectively with WPS Spreadsheet
WPS Spreadsheet fully supports advanced VBA macros, Power Query alternatives, and robust conditional formatting, making it the perfect tool to calculate overlapping employee shifts and manage daily schedules.
- 1. Open Your Schedule: Launch WPS Spreadsheet and open your employee shift schedule.
- 2. Access the VBA Editor: Press Alt + F11 to open the built-in VBA Editor and paste your interval-merging macro.
- 3. Apply Formulas and Formatting: Use your new custom formula in your target cell, then navigate to Home > Conditional Formatting to set your red and green highlighting rules.

Frequently Asked Questions
Why are overlapping shifts double-counted when I use the SUM function?
The standard SUM function simply adds the total durations of each shift together. It does not possess spatial or timeline awareness, meaning if two employees work from 09:00 to 10:00, SUM will report 2 hours of work, even though only 1 chronological hour was covered.
How do I type a specific time into a conditional formatting rule?
When setting up conditional formatting for times, it is often best to use the TIME function, such as =TIME(10,30,0), or the decimal equivalent of the time (since Excel stores 24 hours as the value 1.0). For 10 and a half hours, you would calculate 10.5 / 24 = 0.4375.
Does WPS Office support Excel VBA macros for this solution?
Yes, WPS Spreadsheet has excellent support for VBA macros. You can open the VBA editor using Alt + F11, insert modules, and run custom User Defined Functions just like you would in Microsoft Excel.




