Calculate and Chart a Seven-Day Rolling Average in Excel
Question details
Calculate and chart seven-day rolling averages for daily COVID-19 positivity rates.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user has daily positivity rates and wants a line chart showing the average for each seven-day period.
- Observed behavior
- Excel's Moving Average tool reports that the input range must contain at least one data point.
Arrange dates in consecutive daily order in column A and numeric positivity percentages in column B, starting in row 2. Check that percentages are stored as numbers rather than text and that missing dates are represented by rows.
Use a formula to calculate and chart the rolling average
Use this method to calculate a complete seven-day average without relying on the Moving Average tool.
Place dates in A2 downward and the corresponding daily positivity percentages in B2 downward. Add a heading such as Seven-Day Average in C1.
Select C8 and enter =IF(COUNT(B2:B8)=7,AVERAGE(B2:B8),NA()). This averages the current day and previous six days only when all seven cells contain numbers.
Drag the fill handle from C8 down through the remaining data rows. Select column C and choose Home > Percent Style.
Select the dates in column A and the rolling averages in column C, including their headings, then choose Insert > Line Chart. Set the chart title to “Knox County, Ohio Positivity Rates: 7-Day Rolling Averages,” or use a title appropriate to your data.

Check the Moving Average tool's input range
Use the Analysis ToolPak when you prefer Excel's Moving Average tool and want to resolve the input-range error.
Create a Seven-Day Rolling Average in WPS Spreadsheets
Use the same seven-day formula in WPS Spreadsheets, then chart the results alongside your dates.
- 1. Open your data: Open your workbook in WPS Spreadsheets and arrange dates in column A and daily percentages in column B, starting in row 2.
- 2. Enter the formula: Select C8 and enter =IF(COUNT(B2:B8)=7,AVERAGE(B2:B8),NA()).
- 3. Fill and format: Drag the fill handle down column C, then select the results and choose the percentage format from the Home tab.
- 4. Insert a chart: Select the dates and rolling-average values, choose Insert > Chart, and select a line chart.

Frequently Asked Questions
Why does the first seven-day average appear in row 8?
If the first daily value is in B2, B2:B8 contains the first seven values. Enter the formula in C8 to align the average with the seventh day.
Why does the formula return #N/A?
The formula returns #N/A when COUNT finds fewer than seven numeric values in the window. Check the corresponding cells in column B for blanks, text-formatted percentages, or other nonnumeric entries.
Why does Excel say the Moving Average input range has no data points?
The selected range may be empty or contain percentages stored as text. Check the values in column B, then reopen Data > Data Analysis > Moving Average and select the numeric data range.
Is the average of daily positivity rates the same as the combined seven-day positivity rate?
Not necessarily. The formula averages the seven daily percentages equally. For a combined rate, divide the total positive tests over the seven days by the total tests over those days.




