How to Calculate Monthly Average Durations Between Excel Dates
Question details
The user needs to calculate the average duration of tests or tasks by month, based on start and end dates, and visualize the results using an Excel PivotTable and PivotChart.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Analyzing test or project completion times over a period to determine monthly performance averages.
- Observed behavior
- The goal is to calculate date differences, group these differences by the month of the start date, and display the monthly averages dynamically using Pivot tools.
Ensure that your start and end date columns contain properly formatted Excel date values and that there are no blank cells in the date range, as this can prevent the PivotTable from grouping dates correctly.
Use a Helper Column and Standard PivotTable
This is the most straightforward method, utilizing a simple subtraction formula alongside Excel's built-in PivotTable grouping and aggregation features.
By calculating the exact duration in a new column first, you can easily summarize that numerical data within a PivotTable. This method works perfectly for standard datasets and allows seamless integration with a PivotChart.
Insert a new column next to your data named 'Duration'. In the first data row, enter the formula to subtract the start date from the end date (e.g., =B2-A2). Drag the fill handle down to apply this formula to all rows.
Select your entire data range, including headers. Go to the 'Insert' tab on the ribbon and click 'PivotTable'. Choose to place it on a new worksheet and click 'OK'.
In the PivotTable Fields pane, drag the 'Start Date' field to the 'Rows' area. Right-click any date in the PivotTable, select 'Group', ensure 'Months' is highlighted, and click 'OK'.
Drag the 'Duration' field to the 'Values' area. By default, it may show 'Sum of Duration'. Click the dropdown arrow on this field in the Values area, select 'Value Field Settings', choose 'Average', and click 'OK'.
Click anywhere inside your newly configured PivotTable, navigate to the 'Insert' tab, and click 'PivotChart'. Select a column or line chart to visually display your monthly averages.

Use Power Pivot and DAX Formulas
Best for large datasets or complex data models where adding helper columns to the source data is impractical or slows down the workbook.
Calculate Averages and Group Dates Easily in WPS Spreadsheet
WPS Spreadsheet provides powerful data analysis tools that make creating helper columns, inserting PivotTables, and grouping dates by month incredibly smooth. It is highly compatible with Excel files, allowing you to perform advanced data tasks seamlessly.
- 1. Open your dataset: Launch WPS Spreadsheet and open the file containing your test start and end dates.
- 2. Add a duration formula: Create a new column called 'Duration' and subtract your start date from the end date.
- 3. Insert the PivotTable: Navigate to the Insert tab, click 'PivotTable', and select your data range.
- 4. Configure rows and values: Drag the Start Date to Rows and Duration to Values. Right-click the start dates to 'Group' by Month.
- 5. Set summarization to Average: Double-click the Duration item in the Values pane and change the summary function to 'Average'.

Frequently Asked Questions
Why won't my PivotTable group dates by month?
Date grouping typically fails if there are blank cells within your date column, or if some dates are formatted as text rather than valid Excel date values. Ensure all entries in the date column are standardized.
How do I fix the average duration showing as a date instead of a number?
Excel sometimes inherits the date format from the source columns. Right-click the average values in your PivotTable, select 'Number Format' or 'Value Field Settings', and change the format to 'General' or 'Number'.
Can I calculate the duration excluding weekends and holidays?
Yes. Instead of simple subtraction, use the NETWORKDAYS function in your helper column (e.g., =NETWORKDAYS(Start_Date, End_Date, [Holidays])). This will return the number of working days between the two dates, which you can then average in your PivotTable.
Is it possible to display the average duration in hours instead of days?
Yes. When subtracting the dates in your helper column, multiply the result by 24 (e.g., =(B2-A2)*24). Ensure your start and end dates include timestamps, and format the resulting column as a standard Number.




