Fix Excel AGGREGATE #VALUE! Errors with DATEDIF Results
Question details
The user needs to average DATEDIF results while ignoring errors, without substantially restructuring an existing worksheet.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- An existing data layout includes dates and related harvest, weight, and weather information. The user wants to aggregate calculated date intervals or average dates for a selected variety.
- Observed behavior
- AGGREGATE can ignore errors stored in a contiguous range, but passing separate DATEDIF expressions directly can produce a #VALUE! error.
Identify the cells containing your start and end dates, and confirm that valid dates are stored as numeric Excel dates rather than text. Reserve adjacent helper cells if you want to keep the existing data layout unchanged.
Store DATEDIF results in helper cells before using AGGREGATE
Use this approach to average date intervals while ignoring errors and preserving the current worksheet layout.
AGGREGATE's error-ignoring option is not a general error handler for every expression passed as an argument. Evaluating separate DATEDIF expressions can produce an error before AGGREGATE has a usable range of values to process; helper cells give it a range containing both results and any errors.
Select V4 and enter a DATEDIF formula using your first pair of date cells, such as =DATEDIF(A4,B4,"d"). Enter the other interval calculations in W4 and X4, replacing A4 and B4 with the appropriate date references.
Select the result cell and enter =AGGREGATE(1,6,V4:X4). Function number 1 calculates an average, and option 6 ignores error values in the referenced range.
Inspect V4:X4 to confirm that valid intervals are numeric. If every helper cell contains an error or there are no numeric results, the average will return #DIV/0! rather than a usable value.

Calculate an average day-of-year date with a conditional array formula
Use this alternative when the goal is an average seasonal date for a selected variety, rather than an average DATEDIF interval.
Work with date-analysis spreadsheets in WPS Office
WPS Office is a free, lightweight alternative for opening and editing Excel workbooks. Its familiar spreadsheet interface and support for Excel formats make migration straightforward, but switching applications does not itself fix an invalid AGGREGATE argument structure. Verify advanced formula behavior before relying on the results.

Frequently Asked Questions
Why does option 6 not prevent every AGGREGATE error?
Option 6 tells AGGREGATE to ignore error values in the data it processes. It does not guarantee that separate expressions used as arguments will evaluate successfully. Store the DATEDIF calculations in V4:X4, then use =AGGREGATE(1,6,V4:X4).
Can I keep my existing rows and columns?
Yes. Add a helper row or adjacent helper cells without moving the original data. Reference those cells in a contiguous range, such as V4:X4, from your AGGREGATE formula.
What happens if every DATEDIF result is an error?
With =AGGREGATE(1,6,V4:X4), errors are excluded, leaving no numeric values to average. The result is #DIV/0!. Inspect the helper cells and check that the start and end dates are valid and in the correct order.
Does the array formula average dates or elapsed days?
It averages day-of-year positions for matching numeric dates and maps the result to the current year using DATE(YEAR(TODAY()),1,...). To average elapsed days between pairs of dates, use DATEDIF helper cells instead.
Why does the calculated date appear as a number?
Excel stores dates as serial numbers. Select the result cell, open Format Cells, and choose Date. Only apply date formatting to the seasonal-date formula; a DATEDIF average should remain formatted as Number or General.




