How to Calculate Average Task Duration in Excel Without Formula Errors
Question details
The user wants to calculate the average task duration in Excel but is facing errors when attempting to average a duration formula that combines days, hours, and minutes into text.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Averaging project or task duration data when the displayed duration is formatted as a concatenated text string rather than a numerical value.
- Observed behavior
- Attempting to directly average the text-based duration cells results in a formula error. The average must instead be calculated using the original numerical start and end date/time values.
Ensure that your source data columns for start and end times contain valid Excel date/time values rather than plain text, as mathematical operations require numerical data to function properly.
Calculate Average Using Original Date and Time Values
Bypass the text-based duration column and calculate the average directly from the original start and end times using an array formula.
When a duration is displayed as text (e.g., '2 days 4 hours'), Excel cannot perform mathematical averages on it. Instead, you should subtract the start time from the end time within an AVERAGE and IF function.
Click on an empty cell where you want the calculated average duration to be displayed.
Input the formula: =AVERAGE(IF(D2:D100<>"",D2:D100-C2:C100)). Replace Column D with your End Time column and Column C with your Start Time column.
Press Enter. If you are using an older version of Excel that does not support dynamic arrays, you may need to press Ctrl+Shift+Enter.
Right-click the result cell, select 'Format Cells', go to the 'Custom' category, and enter [h]:mm:ss to properly display the elapsed duration.

Calculate Average Duration for a Specific Task
Use a nested IF function to calculate the average duration only for specific tasks matching a criteria identifier.
Calculate and Analyze Task Durations Easily with WPS Spreadsheet
WPS Spreadsheet provides powerful formula calculation, comprehensive array formula support, and seamless compatibility with Excel, allowing you to manage project timelines and calculate complex durations effortlessly.
- 1. Open your data file: Launch WPS Spreadsheet and open the document containing your project task data.
- 2. Input the average formula: Select a blank cell and enter =AVERAGE(IF(D2:D50<>"",D2:D50-C2:C50)) to calculate the time difference directly.
- 3. Format the duration: Right-click the cell, click 'Format Cells', choose 'Custom', and input [h]:mm:ss to display the exact average duration.

Frequently Asked Questions
Why do I get a #DIV/0! or #VALUE! error when averaging my duration column?
If your duration column combines days, hours, and minutes into a text string (e.g., '2 days 4 hours'), the spreadsheet cannot perform mathematical operations on it. You must calculate the average using the underlying numerical start and end date/time values instead.
How do I format the average result to show total hours exceeding a day?
Right-click the result cell, select 'Format Cells', go to the 'Custom' category, and enter [h]:mm:ss. The square brackets around the 'h' instruct the software to display total accumulated hours rather than rolling over to a new day after 24 hours.
Can I use AVERAGEIFS for calculating time differences instead of an array formula?
AVERAGEIFS requires a fixed average range and cannot process a dynamic calculation (like End Time minus Start Time) as its primary argument. Therefore, to average the difference between two columns, you must use an AVERAGE(IF(...)) array formula.




