How to Fix AVERAGEIFS #CALC! Error for Month and Year Criteria in Excel
Question details
The user needs to calculate the average of a specific item for a given month and year using a formula, but their attempts are resulting in a #CALC! error.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating conditional averages based on a specific text item and a date range without using Pivot Tables, requiring precise multi-criteria evaluation.
- Observed behavior
- Using functions like AVERAGEIFS, SUMIFS, COUNTIFS, or FILTER by directly nesting MONTH and YEAR array calculations within the criteria ranges returns a #CALC! error.
Ensure your date column contains valid Excel serial dates rather than text strings, as date calculation functions like EOMONTH require proper date formatting to evaluate criteria correctly.
Use Date Boundaries with EOMONTH in AVERAGEIFS
The AVERAGEIFS function requires an actual range for its criteria, meaning you cannot nest array-generating functions like MONTH() or YEAR() directly into the criteria argument. Setting date boundaries (start of month and end of month) resolves this natively.
By setting a greater-than-or-equal-to (>=) boundary for the first day of the month, and a less-than-or-equal-to (<=) boundary for the last day, the AVERAGEIFS function processes the logical conditions perfectly without triggering array errors.
Click on the cell where you want the calculated average result to appear.
Type `=AVERAGEIFS(` followed by your values range (e.g., `D2:D15`), and then your item criteria range and condition (e.g., `B2:B15, G2`).
Add your date column range and the first-of-the-month boundary: `A2:A15, ">="&H2` (assuming cell H2 contains the date for the 1st of your target month).
Add your date column range again, followed by the end-of-the-month boundary using EOMONTH: `A2:A15, "<="&EOMONTH(H2,0)`.
Press Enter to calculate. The final formula will look similar to: `=AVERAGEIFS(D2:D15, B2:B15, G2, A2:A15, ">="&H2, A2:A15, "<="&EOMONTH(H2,0))`.

Alternative: Using SUMPRODUCT for Direct Array Calculations
If you prefer evaluating arrays with MONTH and YEAR functions directly without setting up separate date boundaries, you can use SUMPRODUCT instead of AVERAGEIFS to bypass array-handling limitations.
Calculate Complex Averages Seamlessly with WPS Office
You can effortlessly calculate conditional averages involving complex dates and multi-text criteria in WPS Spreadsheet. WPS Office provides native and full compatibility with standard Excel functions like AVERAGEIFS, SUMIFS, and EOMONTH, ensuring your data analysis works flawlessly.
- 1. Open your data file: Launch WPS Spreadsheet and open your workbook containing the data.
- 2. Start your formula: Select a blank cell and type `=AVERAGEIFS(`.
- 3. Follow the syntax helper: Use the smart tooltip prompts to select your average range, set your text criteria, and input your `>=` and `<=` date boundaries using `EOMONTH`.
- 4. Calculate results instantly: Press Enter to instantly view your calculated average with precise accuracy.

Frequently Asked Questions
Why does AVERAGEIFS return a #CALC! or #VALUE! error when using MONTH() or YEAR()?
The AVERAGEIFS function specifically requires an actual physical cell range for its criteria range arguments (like A2:A15). Nesting functions like MONTH(A2:A15) creates an in-memory array rather than passing a physical range, which violates the function's structural requirements and results in an error.
Can I use nested IF functions instead of AVERAGEIFS for date criteria?
Yes, you can use a nested array formula like `=AVERAGE(IF(MONTH(A2:A15)=3, IF(YEAR(A2:A15)=2020, IF(B2:B15="A", D2:D15))))`. However, depending on your software version, it must be entered as a legacy array formula using Ctrl+Shift+Enter, and it may calculate slower than the standard AVERAGEIFS date-boundary method.
How does the EOMONTH function work in the date boundary criteria?
EOMONTH(start_date, months) calculates the last day of the month that is a specified number of months before or after your start date. By using a 0 for the months argument, it returns the exact last day of the current referenced month, making it perfect for appending to a "<=" string to cap your AVERAGEIFS date range.
Why am I getting a DIV/0 error instead of a calculation with my AVERAGEIFS formula?
A #DIV/0! error in AVERAGEIFS means that no records matched all of your specified criteria, meaning the function tried to divide the sum by zero. Check your dataset to ensure that the item text perfectly matches your criteria without hidden trailing spaces, and that your target dates fall within the bounds specified.




