Tabellab
Data, tech, science & health

How to calculate a moving average in Excel

A moving average is the average of the last k values, recalculated as the window slides forward one period at a time. In Excel, put =AVERAGE(B2:B4) next to the third month and fill it down: the relative references move with each row, so the next cell averages B3:B5, then B4:B6, and so on. For twelve months of unit sales, the 3-month moving average for December is (512 + 548 + 571) ÷ 3 = 543.7, which also serves as a simple forecast for January. A weighted version that counts the newest month three times gives 553.5, and exponential smoothing with α = 0.3 gives 529.0. The worked example below calculates all three and compares how well each would have predicted the past.

Updated 30 Oct 2026 6 min read By Tabellab team

The simple moving average (SMA)

A simple moving average weights every value in the window equally. The window length k is your choice: 3 months reacts quickly, 6 or 12 months smooths more. The first result appears only once a full window is available, so a 3-month average starts in the third row; leave the first two cells empty rather than averaging fewer values, otherwise the early points are not comparable.

With sales in B2:B13, type =AVERAGE(B2:B4) in C4 and drag down to C13. Do not use absolute references here: the whole point is that both ends of the range move. A trailing average like this one belongs to the last period of its window. A centred moving average, which places the 3-month average on the middle month, is better for describing a past trend but cannot be used for forecasting, because it needs one future value.

To make the window length adjustable, put k in a cell, say H1, and use =AVERAGE(OFFSET(B13,1-$H$1,0,$H$1,1)) for the latest average. OFFSET starts at the current row, goes k − 1 rows up and takes k rows. It is flexible but volatile, so for large models the plain fill-down AVERAGE is faster and easier to audit.

The weighted moving average (WMA)

A weighted moving average gives recent periods more influence. With weights 1, 2 and 3 for the oldest, middle and newest month, the formula in D4 is =(B2*1+B3*2+B4*3)/6, where 6 is the sum of the weights. For December this gives (512 × 1 + 548 × 2 + 571 × 3) ÷ 6 = 553.5, about ten units above the simple average, because the strong last month counts most.

With the weights in a separate range, for example H2:H4, the general form is =SUMPRODUCT(B2:B4,$H$2:$H$4)/SUM($H$2:$H$4). The weights can be any positive numbers; they do not have to add up to 1 because the formula divides by their sum. Make sure the order matches: the newest value must line up with the largest weight.

Exponential smoothing (EMA)

Exponential smoothing keeps all past values in the average, with weights that shrink by the factor (1 − α) each period. Each new smoothed value is α × the latest actual + (1 − α) × the previous smoothed value. In the example the first smoothed value is simply the first actual, =B2, and from E3 on the formula is =$E$16*B3+(1-$E$16)*E2, with α = 0.3 in E16. A high α (0.5 or more) follows the data closely; a low α (0.1 to 0.2) gives a very smooth line.

In finance the same idea is called an exponential moving average and often uses α = 2 ÷ (k + 1), so a "10-day EMA" has α ≈ 0.18. Note how the smoothed value for December, 529.0, is below both the simple and the weighted average. In a series with a steady upward trend, every averaging method lags behind, and a low α lags most.

Worked example: three moving averages of monthly unit sales

Twelve months of unit sales (yellow). Column C is the 3-month simple moving average, D the weighted version with weights 1-2-3, E exponential smoothing with the α in E16. The lower block turns each into a forecast for January and compares their past accuracy.

Worked example: three moving averages of monthly unit sales
ABCDE
1MonthUnits sold3-month SMA3-month WMA (1-2-3)Exponential (α in E16)
2Jan412412.0
3Feb389405.1
4Mar455418.7425.8420.1
5Apr430424.7431.5423.0
6May478454.3458.2439.5
7Jun462456.7462.0446.3
8Jul501480.3484.2462.7
9Aug487483.3487.5470.0
10Sep530506.0510.8488.0
11Oct512509.7513.8495.2
12Nov548530.0533.0511.0
13Dec571543.7553.5529.0
14
15Forecast for January next yearValue
16Smoothing factor α (0 to 1)0.30
17SMA forecast = last 3-month average543.7
18WMA forecast = last weighted average553.5
19Exponential forecast = last smoothed value529.0
20Same SMA with a fixed window: AVERAGE(B11:B13)543.7
21Mean absolute error of the SMA as a forecast (Apr–Dec)28.4
22Mean absolute error of the WMA as a forecast (Apr–Dec)23.6
Key formulas
  • C4=AVERAGE(B2:B4)3-month simple moving average
  • D4=(B2*1+B3*2+B4*3)/6Weighted, newest month counts 3×
  • E2=B2Exponential smoothing starts at the first value
  • E3=$E$16*B3+(1-$E$16)*E2Exponential smoothing
  • E17=C13Next-month forecast from the SMA

Illustrative data. The error rows treat each moving average as the forecast for the month after its window.

Using a moving average as a forecast

The simplest forecast for next period is the latest moving average: 543.7 units for January with the SMA. To judge whether that is any good, look back. Treat each 3-month average as the forecast for the following month and measure the errors: the mean absolute error of the SMA from April to December is 28.4 units, the weighted version 23.6. On this rising series the weighted average is more accurate because it lags less.

That points to the limit of all moving averages: they forecast a flat line at the current level. When the data have a clear trend, a trendline forecast fits better, see the FORECAST.LINEAR guide. When the data are seasonal, a 12-month moving average removes the seasonal pattern, which makes it a good way to see the underlying trend but a poor forecast for a single month. Excel charts can also draw a moving average directly: add a trendline, choose Moving Average and set the period. That trendline is for viewing only; the cell formulas are what you need for forecasts and error checks.

Common mistakes

  • Locking the range with $. =AVERAGE($B$2:$B$4) does not move when filled down, so every row shows the same number. The references must stay relative.
  • Averaging incomplete windows. Putting =AVERAGE(B2:B2) and =AVERAGE(B2:B3) in the first rows mixes 1-, 2- and 3-period averages. Start where the first full window ends.
  • Aligning the average with the wrong period. A trailing 3-month average ending in March is a forecast for April, not for March. Comparing it with March sales flatters the accuracy.
  • Weights in the wrong order. In a weighted moving average the largest weight must go to the newest value. Reversed weights make the line lag even more.
  • Expecting a moving average to follow a trend. In rising or falling data every moving average lags behind. Use a trend method when the direction matters.
  • Gaps and zeros in the data. AVERAGE ignores empty cells but counts zeros, so a month recorded as 0 instead of left blank pulls three averages down.

Frequently asked questions

How do I calculate a 3-month moving average in Excel?

Put =AVERAGE(B2:B4) next to the third month and fill it down. Because the references are relative, each row averages its own month and the two before it.

What is the difference between a simple and an exponential moving average?

A simple moving average weights the last k values equally and ignores older ones. An exponential moving average uses all past values with weights that shrink by a constant factor each period, so it reacts faster to recent changes and has no fixed window.

How do I choose the moving average period?

Shorter windows such as 3 periods follow changes quickly but stay noisy. Longer windows such as 12 periods smooth more but lag more. Compare the mean absolute error of a few window lengths on past data and pick the one that predicts best.

Can Excel add a moving average to a chart?

Yes. Select the data series, add a trendline, choose Moving Average and set the period. The chart line is for display only; use cell formulas when you need the values for forecasts or error checks.

What alpha should I use for exponential smoothing?

Values between 0.1 and 0.3 are common for stable data, higher values for data that change quickly. A practical way is to test several values and keep the one with the lowest forecast error on past data.

Practise it in a lab

Related guides

Reading is step one. Doing is step two.

Every guide links to a lab where you build the same calculation in an online spreadsheet and get instant feedback.

Open the lab