Excel Formula to Find Agents Scheduled for Full Two-Hour Shifts
Question details
The user needs an automated way to identify agents who are scheduled for consecutive 30-minute intervals that completely fill a specific two-hour block.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Managing an employee schedule containing 30-minute interval data and attempting to extract or highlight agents working complete two-hour shifts like 7:00-9:00 AM.
- Observed behavior
- The goal is to successfully filter the data to display only the agents who appear in all four required 30-minute intervals for the designated date and time period.
Ensure your schedule data is organized in clear columns (e.g., Date, Time, Agent) and that all time values are properly formatted as 'Time' rather than standard text.
Use Helper Columns and COUNTIFS
By categorizing individual time intervals into two-hour blocks using an IF formula, you can use COUNTIFS to count if an agent fulfills all four 30-minute slots.
This method is highly recommended because it breaks the logic down into manageable steps. First, you classify each 30-minute slot into a broader two-hour shift group. Then, you simply count how many times an agent appears in that specific group.
Create a new column next to your time data. Assuming your time intervals are in column B starting at row 3, enter the formula: =IF(B3<TIME(9,0,0),"7-9 AM",IF(B3<TIME(11,0,0),"9-11 AM","Other")).
Drag the fill handle down to apply this helper formula to the rest of the rows in your schedule, categorizing every time slot.
In a separate summary table, use the COUNTIFS function to count occurrences for each agent in a specific shift. Use a formula like: =COUNTIFS(DateColumn, TargetDate, ShiftColumn, "7-9 AM", AgentColumn, TargetAgent).
Review the COUNTIFS results. Since a two-hour shift consists of four 30-minute intervals, any agent with a result of '4' has worked the full shift.

Use SUMPRODUCT for Array Counting Without Helper Columns
If you want to keep your spreadsheet clean without adding extra columns, you can use SUMPRODUCT to evaluate multiple conditions dynamically.
Easily Track Agent Shifts with WPS Spreadsheet
WPS Spreadsheet provides powerful built-in calculation capabilities, including full support for complex logical functions like IF, COUNTIFS, and SUMPRODUCT, making it incredibly easy to manage comprehensive employee schedules.
- 1. Open Your Schedule: Launch WPS Spreadsheet and open your existing scheduling workbook.
- 2. Insert the Helper Formula: Use the IF and TIME functions in an adjacent column to categorize the 30-minute shifts.
- 3. Count the Shifts: Apply the COUNTIFS formula to accurately detect which agents meet the 4-interval requirement.

Frequently Asked Questions
Why does the TIME function return an error in my formula?
This usually happens if your underlying cell formatting is set to text instead of time, or if the arguments inside TIME(hour, minute, second) exceed their standard limits. Ensure your time data is properly formatted as Time.
Can I use Pivot Tables to find agents working full shifts instead of formulas?
Yes. Once you add the helper column to classify the two-hour blocks, you can insert a Pivot Table. Place the Agent names in the Rows area and the Helper Column in the Columns area. Apply a value count, and simply filter for agents showing a count of 4.
How do I adjust the formula for 15-minute scheduling intervals?
If you are using 15-minute intervals instead of 30-minute intervals, a full two-hour shift will consist of 8 intervals. You will need to check for a COUNTIFS or SUMPRODUCT result of 8 instead of 4.




