How to Fix AVERAGEIF Date Criteria Returning #DIV/0! in Excel
Question details
The user needs to resolve a #DIV/0! error that occurs when using the AVERAGEIF function to calculate an average based on a date referenced from another cell.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating a conditional average using a specific date cell as the criteria in the AVERAGEIF formula.
- Observed behavior
- The formula returns a #DIV/0! error because wrapping the cell reference in quotation marks causes Excel to treat it as a literal text string instead of a valid date.
Verify that your data range contains numbers that can be averaged and ensure the date in your reference cell is formatted as a proper date serial number, not as text.
Reference the Date Cell Directly Without Quotation Marks
Remove the quotation marks around your cell reference to allow Excel to evaluate it as a date serial number instead of literal text.
When you wrap a cell reference like "=A29" inside quotation marks, Excel searches your criteria range for cells containing the exact text string '=A29', completely ignoring the actual date stored in cell A29. Since no records match this text string, the function finds zero matching values and divides the sum by zero, resulting in a #DIV/0! error.
Click on the cell containing your AVERAGEIF formula that is currently returning the #DIV/0! error.
Locate the criteria section of your AVERAGEIF formula, which likely looks like "=A29" or similar.
Delete the quotation marks and the equals sign so that you are only referencing the cell name. For example, change it to: =AVERAGEIF(Sheet2!$A$2:$A$25107, A29, Sheet2!$E$2:$E$25107).
Press Enter to save the formula. The correct average based on the date will now be calculated and displayed.

Use Concatenation with the TEXT Function
Format the date reference into a recognized text string that matches your system's date settings using the TEXT function.
Fix Formula Errors Seamlessly with WPS Office
WPS Spreadsheet provides powerful formula support with intelligent error highlighting, making it incredibly easy to calculate conditional averages and manage complex date criteria without syntax headaches.
- 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your workbook (.xlsx) containing the data.
- 2. Select the target cell: Click the cell where you want the conditional average to appear.
- 3. Enter the clean AVERAGEIF formula: Type =AVERAGEIF(range, A29, average_range), ensuring that the criteria cell reference is not wrapped in quotes.
- 4. Review your data: Press Enter to calculate the correct average instantly, eliminating the #DIV/0! error.

Frequently Asked Questions
Why does AVERAGEIF return a #DIV/0! error?
The #DIV/0! error in AVERAGEIF means that no cells in your specified range met the criteria. Since the function attempts to divide the total sum of matching cells by the count of matching cells (which is zero in this case), it results in a division by zero error.
How do I use logical operators like greater than (>) with a cell reference in AVERAGEIF?
To use a logical operator with a cell reference, you must enclose the operator in quotation marks and use an ampersand (&) to concatenate it with the cell. For example, to find averages for dates greater than the date in A29, use: ">"&A29 as your criteria.
Do WPS Spreadsheet and Microsoft Excel handle dates differently in formulas?
No, both WPS Spreadsheet and Microsoft Excel store dates identically as serial numbers. Formulas like AVERAGEIF function exactly the same in both applications, ensuring seamless compatibility when handling date criteria across files.




