How to Calculate a Rolling Three-Week Average using Excel AVERAGEIFS
Question details
The user needs to construct a dynamic AVERAGEIFS formula to calculate a rolling three-week average for a specific individual based on historical data.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Filtering raw weekly data by a specific person's name and dynamically calculating the average of the current week plus the two previous weeks.
- Observed behavior
- The user wants the correct syntax to evaluate a dynamic date/week range while successfully resolving a parse error caused by an extra comma in the original formula.
Ensure your raw data contains well-structured columns: one for the values to be averaged, one for the person's name (or criteria), and one for numerical week numbers.
Apply the AVERAGEIFS Formula for Dynamic Date Ranges
Use the AVERAGEIFS function to calculate the average of cells that meet multiple criteria, including a dynamic three-week rolling timeframe.
The AVERAGEIFS function evaluates multiple conditions at once. By combining it with dynamic cell references and logical operators, you can create a rolling average that automatically updates as the current week progresses without requiring manual formula adjustments.
Click on the empty cell where you want the rolling three-week average result to be displayed.
Type the formula: =AVERAGEIFS(Sheet1!G:G, Sheet1!E:E, B2, Sheet1!A:A, "<="&X2, Sheet1!A:A, ">="&X2-2) into the formula bar.
Ensure that Sheet1!G:G is your numerical value column, Sheet1!E:E contains the names, B2 contains the target person's name, Sheet1!A:A contains the week numbers, and X2 represents the current week.
Make sure there are no extra commas at the end of the formula or between the arguments. Press Enter to calculate the result.

Calculate Complex Rolling Averages Effortlessly in WPS Spreadsheet
WPS Spreadsheet fully supports advanced logical formulas like AVERAGEIFS, making it incredibly easy to track rolling averages, filter multi-criteria data, and build dynamic dashboards.
- 1. Open your data file: Launch WPS Spreadsheet and open your workbook containing the raw weekly data.
- 2. Insert the formula: Select the target cell, navigate to the Formulas tab, and insert the AVERAGEIFS function.
- 3. Apply the criteria: Define your sum range, person criteria, and week number boundaries using the intuitive function arguments dialog.
- 4. Drag to fill: Use the fill handle at the bottom right of the cell to drag and apply the rolling average formula to other rows.

Frequently Asked Questions
Why does my AVERAGEIFS formula return a syntax error?
This commonly happens if there is an extra comma at the end of your criteria arguments, or if you forgot to use the ampersand (&) to concatenate logical operators (like "<=") with cell references.
How can I change the formula to calculate a rolling four-week average?
To expand the timeframe to four weeks, update the final argument in the formula from ">="&X2-2 to ">="&X2-3. This includes the current week and the three previous weeks.
Can AVERAGEIFS handle blank cells in the sum range?
Yes, the AVERAGEIFS function automatically ignores empty cells or cells containing text within the sum range, so they will not skew your rolling average.
Why am I getting a #DIV/0! error with AVERAGEIFS?
The #DIV/0! error occurs when no cells meet all the specified criteria (meaning it tries to divide by zero). Check if the person's name matches exactly and that the week numbers fall within the specified boundaries.




