Smoothing a series with a moving average
A moving average replaces each value with the average of the values in a fixed window, softening short swings. Learn how to calculate one, pick its window and read the result fairly.
A moving average replaces each value, once enough values are available, with the average of that value and the ones before it. Short ups and downs fade, and the underlying direction becomes easier to see. It is one of the most common ways to smooth a noisy series, and it requires nothing more than addition and division.
Its usefulness depends on one decision above all: the window length. A longer window removes more random variation but reacts later to a real change, while a shorter window tracks the data closely and keeps more of the noise. Choosing the length deliberately, and remembering what the smoothing has removed, matters more than the arithmetic.
Calculating a simple moving average
A simple moving average takes a fixed number of consecutive values, adds them, divides by that number, and records the result against the latest period in the window. The window then slides forward one period and the calculation repeats. Suppose a shop records weekly unit sales of 12, 15, 11, 18, 14 and 16. With a three-week window, the first average can only be calculated once three values are available.
Scroll sideways to see the full table →
| Week | Units sold | Three-week moving average |
|---|---|---|
| 1 | 12 | |
| 2 | 15 | |
| 3 | 11 | 12.67 |
| 4 | 18 | 14.67 |
| 5 | 14 | 14.33 |
| 6 | 16 | 16.00 |
The week 3 average is 12 plus 15 plus 11, which is 38, divided by 3, or 12.67. The week 4 average drops the first week and adds the new one: 15 plus 11 plus 18 gives 44, divided by 3, or 14.67. Week 5 gives 43 divided by 3, or 14.33, and week 6 gives 48 divided by 3, or 16.00. The first two weeks have no average because a full window does not yet exist, a detail that matters when the series is short.
The same calculation takes one formula in a spreadsheet. If the first value sits in cell B2, the average for the third value goes in row 4 as =AVERAGE(B2:B4), and copying that formula down makes the range slide forward one row at a time. Typing a range by hand for every row is where errors creep in, because one slip shifts the window onto the wrong values. Check that every row averages the same number of values.
Choosing the window length
The window length controls the trade-off between smoothness and responsiveness. A longer window averages over more values, so random swings cancel out more completely, but the line reacts more slowly to real changes. A shorter window follows the data closely and keeps more of the noise. There is no single correct length. The right choice depends on how much noise you need to remove and how quickly you need to notice a change.
One rule is especially useful. If the series has a regular cycle, a window equal to one full cycle removes that cycle. Daily figures with a weekly rhythm are smoothed cleanly by a seven-day window, because each window contains every day of the week exactly once. Monthly figures with a yearly rhythm are treated the same way by a twelve-month window. A window that does not match the cycle can leave a wavy pattern in the line, which can then be mistaken for a trend.
Odd window lengths matter for centered averages, which place the result on the middle value of the window, so a three- or five-period window lands on one specific period. An even-length centered average, such as a twelve-month one, falls between two periods, so it is usually computed by averaging two neighboring twelve-month averages that are offset by one month, which places it on a specific month. A trailing average has no such issue, because its result sits on the latest period in the window, so a twelve-month trailing average is a common choice for monthly data. Whatever length and method you pick, keep them the same across every comparison you make.
What smoothing removes and what it keeps
Smoothing reduces short-term noise, but it does not add information. The smoothed line is a summary of the same data, and it cannot reveal anything the raw values did not contain. A trailing average lags behind a real turning point. With a window of n values, the result sits about (n minus 1) divided by 2 periods behind the latest value, so a three-week trailing average lags a turn by about one week. By the time the line bends, the turn has already happened in the data.
A centered average, which uses values on both sides of each point, follows turning points more closely. It cannot be calculated for the most recent values, however, because the later values it needs do not yet exist.
Smoothing can also hide a sharp, short-lived event. A single spike is spread across the window and looks like a modest bump. If the spike matters, the raw values are the place to see it. Smoothing works best alongside the raw series, not as a replacement for it.
Reading a smoothed line fairly
Always state the window length next to a chart or figure, because a line smoothed with three values and a line smoothed with twelve can look very different. Do not compare smoothed lines made with different windows as if they were the same measure. Keep the raw data visible, at least in a supporting table or a faint background line, so readers can see the spread around the smoothed trend.
Be cautious about the most recent end of a smoothed line. A trailing average may still reflect older values, and a centered average is not available at the end at all. A bend at the end of the line can therefore be an artifact of the calculation, so check it against the latest raw values before drawing a conclusion. Used with those checks, a moving average is a clear and honest way to see direction in a noisy series.