Find Earliest Start and Latest End Times by Agent and Date in Excel
Question details
Find the earliest start time and latest end time for each agent on each date.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains agent names, start dates, start times, and end times that need to be summarized by agent and date.
- Observed behavior
- The desired result is one earliest start time and one latest end time for each agent and start-date combination.
Check that each column has a header and that dates and times are stored as Excel date and time values, not text. The Start Date column should contain dates without time components so records from the same day group together.
Summarize start and end times with an Excel PivotTable
Use a PivotTable to summarize all agents and dates at once.
Select a cell in the source data, then choose Insert > PivotTable. Confirm the data range and choose where to place the PivotTable.
In the PivotTable Fields pane, drag Agent and Start Date to the Rows area.
Drag Start Time and End Time to the Values area. For Start Time, open Value Field Settings and select Min; for End Time, select Max.
Open Value Field Settings for each time field, select Number Format, and choose a time format. Refresh the PivotTable when the source data changes.

Calculate the times with MINIFS and MAXIFS
Use formulas when you want results for agent and date combinations listed in worksheet cells.
Find earliest and latest times with a WPS PivotTable
Use a PivotTable in WPS Spreadsheets to group records by agent and start date, then summarize the time fields with Min and Max.
- 1. Open the workbook: Open WPS Spreadsheets and use Open to select the workbook containing the agent, date, and time columns.
- 2. Insert a PivotTable: Select a cell in the data and choose Insert > PivotTable. Confirm the source range and destination.
- 3. Arrange the fields: Drag Agent and Start Date to Rows, then drag Start Time and End Time to Values.
- 4. Set the summaries: Open the value field settings for Start Time and select Min. Set End Time to Max, then format the results as times.

Frequently Asked Questions
Why does my PivotTable show a count instead of a time?
The source time values may be stored as text. Convert them to numeric Excel times, refresh the PivotTable, and choose Min or Max in Value Field Settings.
How do I update the results after adding records?
Right-click the PivotTable and choose Refresh. If the new records are outside its source range, update the data source to include them first.
Can I use these methods for shifts that end after midnight?
Yes, if the end values include both the date and time. A time-only value cannot distinguish an end after midnight from an earlier end on the start date.
Why do MINIFS and MAXIFS return zero?
They return zero when no cells match the criteria. Check the agent name, date value, and formula ranges; a date containing a hidden time component may not match a date-only criterion.




