A moving average smooths out short-term noise in a data series so you can see the underlying trend. In Excel you can build one in under a minute: put your values in a single column, then either use the Analysis ToolPak's Moving Average tool or a simple =AVERAGE() formula that slides down the rows. The formula route is the one to learn first, because it updates automatically and shows exactly what is being averaged. You need a column of numbers in chronological order (oldest at the top), an empty column beside it for the results, and a decision on how many periods to include.
What You'll Need
- Excel on Windows, macOS, or Excel for the web (the formula method works in all three; the Analysis ToolPak is desktop only)
- A single column of numeric data in date or time order, with no blank rows inside it
- A free column to the right of the data for the average values
- Your chosen window size, for example 3 for a 3-period average or 7 for a weekly average on daily figures
Step-by-Step
- Lay out the data. Put your values in one column starting at, say, A2, with a header in A1 such as Sales. If your data has dates in column A and numbers in column B, that is fine too; just keep the numeric series contiguous. Sort it oldest to newest first, because a moving average only means something when the order is correct.
- Pick your window size. A 3-period average is responsive and jagged; a 12-period average is smooth and slow to react. Write the size in a separate cell, for example in E1, and name it later if you like. Keeping it in a cell means you can change 3 to 7 with one edit instead of rebuilding every formula.
- Write the first average formula. In the result column, in the row where you have enough data to fill the window, enter
=AVERAGE(B2:B4)for a 3-period average on data in column B. The formula should end at the current row and start two rows above it. If your data starts in B1, your first result goes in C3. - Fill the formula down. Select the cell, grab the fill handle (the small square at the bottom-right corner of the selection), and drag down to the last row of data. Alternatively, double-click the fill handle and Excel will fill to the bottom of the adjacent data. Each row now averages the three rows ending at that row.
- Make the window size dynamic (optional but recommended). Replace the fixed range with
=AVERAGE(OFFSET(B3,0,0,-$E$1,1))or, more robustly,=AVERAGE(B3:INDEX(B:B,ROW()-($E$1-1))). Then changing E1 from 3 to 7 recalculates every row in one go. If you use OFFSET, keep in mind it is volatile and recalculates on every change, which matters in very large workbooks. - Leave the early rows blank. With a 3-period average, rows 1 and 2 have no valid result. Do not fill them with partial averages unless you deliberately want a weighted start; leaving them empty keeps the chart honest.
- Handle gaps deliberately. AVERAGE ignores empty cells and text, so a missing value quietly changes how many points are averaged. If you would rather treat a gap as zero, use
=SUM(B2:B4)/3instead. Decide which behaviour you want before you interpret the line. - Chart it. Select both the original series and the moving average column, then insert a line chart (Insert > Charts > Line). Format the moving average line thicker or in a contrasting colour so the trend reads clearly against the raw data.
- Or use the Analysis ToolPak. On desktop Excel, enable it via File > Options > Add-ins > Manage: Excel Add-ins > Go, tick Analysis ToolPak, then use Data > Data Analysis > Moving Average. Set the Input Range to your numbers, the Interval to your window size, and the Output Range to an empty cell. Tick Chart Output if you want the line drawn for you. The tool writes static values, not formulas, so it does not refresh when your data changes.
Common Mistakes
Starting the fill in the wrong row. If your first formula averages B2:B4 but sits in C2, every subsequent row is shifted by one and the line looks like it lags or leads the data. The formula's last cell must be the same row as the cell holding it.
Mixing up relative and absolute references. When you drag down, B2:B4 moves correctly because both ends are relative. But if someone accidentally anchors part of the range with dollar signs, every row averages the same first three values and the result is a flat line.
Including the header or totals row. A text header is ignored by AVERAGE, but a totals row at the bottom is a real number and skews the last few averages badly. Keep totals out of the source column.
Comparing windows of different lengths. A 3-period line and a 12-period line on the same chart are not directly comparable; the shorter one always moves first. Pick one window per chart.
Forgetting that a moving average lags. The value plotted is the average of past periods, so it always turns after the raw data does. Do not treat a crossover as a prediction.
Tips
Format the average column to two decimal places so small drifts are visible. Use a named range or a table (select the data, then Insert > Table) so formulas extend automatically when you add new rows. If you want a weighted version, SUMPRODUCT with a weight column gives you far more control than a plain average. For seasonal data, consider a centred moving average so the window straddles the current point instead of trailing it. And keep the raw series visible on the chart: a smoothed line alone hides sudden spikes you may need to know about.
Troubleshooting
The formula shows #DIV/0!. The window contains no numbers at all, usually because the rows are empty or the values are stored as text. Check with ISNUMBER; text that looks like a number is the most common culprit, and Data > Text to Columns or multiplying by 1 fixes it.
The results do not change when I edit the data. Calculation may be set to Manual. Go to Formulas > Calculation Options and choose Automatic, or press F9 to recalculate.
The line is flat or repeats one value. Your range references are anchored with dollar signs, so the window never slides. Rewrite the formula with relative references and fill down again.
The Analysis ToolPak button is missing. It is not available in Excel for the web, and on Mac it is enabled through Tools > Excel Add-ins rather than File > Options. Use the formula method instead; it does the same job and stays live.
The chart shows gaps. Blank early rows plot as breaks. Use the chart's Select Data options to start the series at the first valid average, or accept the gap as an honest picture of the warm-up period.
Frequently Asked Questions
What is a good window size?
It depends on the cycle you want to see. Odd numbers keep the average centred on a single point, and common choices are 3 for smoothing small noise and 7 or 12 for weekly or monthly patterns. Test two or three sizes on the same chart before committing.
Can I calculate a moving average without dragging?
Yes. Enter the first formula, then double-click the fill handle to copy it to the bottom of the adjacent data. You can also paste it into a selected range and press Ctrl+D on Windows or Cmd+D on Mac to fill down.
What is the difference between AVERAGE and the Moving Average tool?
AVERAGE in a sliding range is a live formula that recalculates when your data changes. The Analysis ToolPak writes fixed numbers and a chart, so it is a snapshot rather than a working model.
Should a moving average include the current period?
Usually yes; a trailing average ending at the current value is the standard. A centred average splits the window either side of the point and is better for spotting a seasonal trend, but it cannot be calculated for the most recent rows.
Why does my moving average start with empty cells?
Because you cannot average three points until you have three. Those blank rows are the warm-up period and are expected; the line simply begins later than the raw data.