Moving Average in Excel — Formula, Weighted & Exponential (2026)

To calculate a moving average in Excel, put your values in time order in column B and enter =AVERAGE(B2:B4) in the third row (C4), then fill down: each cell averages the latest three values and the window slides one row at a time. Change the size of the range for a different window, add a chart’s Moving Average trendline for a visual-only line, or use SUMPRODUCT for a weighted moving average.

Try it on your own file → · Updated 5 October 2026

Raw data is noisy — sales jump on payday, traffic dips at weekends, prices wobble daily. A moving average strips out that noise so you can see the trend underneath. In 35 minutes you’ll learn every way to calculate a moving average in Excel: the simple moving average with AVERAGE, a one-click chart trendline, weighted and exponential moving averages, and how to turn any of them into a next-period forecast. Works in Excel 2010 through Microsoft 365.

The DataHub Pro Team The DataHub Pro Team · Analytics for SMEs
· About
⬇ Free Excel templates: grab ready-made, formula-driven Excel templates — project tracker, KPI dashboard, P&L, forecasting and more — free with an account.

TL;DR

For a 3-period simple moving average, enter =AVERAGE(B2:B4) in the third row and fill down — the window slides automatically. Add a smoothed line to a chart with right-click → Add Trendline → Moving Average. Weight recent periods with =SUMPRODUCT(values,weights)/SUM(weights). For an exponential moving average use =α×current+(1−α)×prevEMA with α=2/(N+1). Forecast next period as the average of the last N actuals.

Contents

  1. What is a Moving Average?
  2. The Formula — Worked Example
  3. Before You Start
  4. Step 1 — Arrange Your Data
  5. Step 2 — Simple Moving Average
  6. Step 3 — Handle the Start
  7. Step 4 — Chart Trendline
  8. Step 5 — Trailing vs Centered
  9. Step 6 — Weighted Moving Average
  10. Step 7 — Exponential Moving Average
  11. Step 8 — Forecasting
  12. Try It: Live Smoothing Chart
  13. Advanced Tips
  14. Common Errors & Fixes
  15. FAQ

What is a Moving Average?

A moving average replaces each data point with the average of itself and a fixed number of neighbouring points, then “moves” that window one step at a time across the whole series. The result is a smoother line that follows the underlying direction of the data while filtering out short-term noise. It is the most widely used smoothing technique in business analytics precisely because it is intuitive: an average of recent values is something everyone understands.

Imagine daily sales that bounce between 80 and 120 units with no obvious pattern. Each day’s number tells you almost nothing — was today good, or just a normal wobble? A 7-day moving average answers that by collapsing each week of noise into a single representative value. Suddenly a gentle upward drift, invisible in the raw figures, becomes obvious. That is the entire point of a moving average: separate signal (the trend) from noise (the random day-to-day variation).

There are three flavours you will meet. The simple moving average (SMA) treats every period in the window equally. The weighted moving average (WMA) gives more recent periods a bigger say. The exponential moving average (EMA) goes further, letting influence decay smoothly so the newest data matters most but nothing is ever fully forgotten. They share the same goal and differ only in how quickly they react to change — a trade-off this guide will make concrete.

Moving averages also have a second job: forecasting. Because the average of the last few periods is often a decent estimate of the next, a moving average doubles as a simple prediction. It has a known weakness — it lags, so it always under-shoots a rising series and over-shoots a falling one — but as a transparent baseline it is hard to beat, and it is the foundation that more advanced methods like exponential smoothing build upon.

The Moving Average Formula in Excel — Worked Example

Here is every moving average formula in Excel on one small sheet, so you can check your own numbers against it. Six months of sales sit in B2:B7 with month names in column A. Column C is a 3-month simple moving average, column D a 3-month weighted moving average (weights 1, 2, 3), and column E an exponential moving average with α in cell H1 set to =2/(3+1), which is 0.5.

RowA: MonthB: SalesC: 3-month SMAD: 3-month WMAE: EMA (α=0.5)
2Jan120——120.0
3Feb135——127.5
4Mar128127.7129.0127.8
5Apr150137.7140.2138.9
6May162146.7152.3150.4
7Jun155155.7156.5152.7

Simple moving average — in C4, then fill down to C7:

=AVERAGE(B2:B4)

Weighted moving average — in D4, then fill down. The newest month gets weight 3 and the divisor is the sum of the weights, 6:

=SUMPRODUCT(B2:B4,{1;2;3})/6

Exponential moving average — seed E2 with =B2, then in E3 enter the formula below and fill down. It blends each new value with the previous EMA:

=$H$1*B3+(1-$H$1)*E2

The same EMA in one formula (Microsoft 365) — enter in E2 with E3:E7 empty and it spills down the column. SCAN starts from B2, so the first result equals the first value, exactly like the seed above:

=SCAN(B2,B2:B7,LAMBDA(prev,x,$H$1*x+(1-$H$1)*prev))

Next-month forecast — the 3-month moving average of the last three actuals, placed in the July row (155.7 here):

=AVERAGE(B5:B7)

Notice how the three methods disagree in June: sales dipped from 162 to 155, the weighted average (156.5) still leans on May’s high, the simple average (155.7) treats all three months alike, and the EMA (152.7) carries the whole history, including the low start. Which one is “right” depends on how much you want recent months to dominate — Steps 6 and 7 below explain the trade-off.

Three ways to do a moving average using Excel

MethodWhat you getUpdates when data changes?Best for
AVERAGE formula (Step 2)Moving-average values in cellsYesDashboards, forecasts, anything you calculate on
Chart trendline (Step 4)A smoothed line on the chart onlyYesA quick visual of the trend
Analysis ToolPak (FAQ below)A static column of values, optional chartNo — re-run itA one-off analysis

Before You Start

A moving average has only two requirements, but both matter.

Data must be in time order

Each row must represent one period — one day, week, or month — sorted oldest to newest. A moving average is meaningless on unsorted data, because the “window” would mix unrelated periods. Sort by your date column ascending before you begin.

No gaps in the series

Missing periods distort the window. If a day has no sales, record a zero rather than leaving the row out — otherwise your 7-period window silently spans more than 7 calendar days. For genuinely missing data, decide deliberately whether to interpolate, carry forward, or treat as zero; do not let blanks slip in by accident.

Pick a window that matches your rhythm

The window size is the single most important choice. The rule of thumb: match the window to the cycle you want to remove. Daily data with a weekly rhythm → window of 7. Monthly data with annual seasonality → window of 12. There is no universally “correct” window — it is a deliberate trade-off between a smooth line and a responsive one, which the interactive chart below lets you feel directly.

💡 Pro tip: Always keep your raw data in its own column and put the moving average in a new column beside it. Never overwrite the original numbers — you will want to compare raw versus smoothed, and you may want to try several window sizes.
1
2
3
4
5
6
7
8

1.Step 1 — Arrange Your Data

Put your period labels (dates) in column A and your values in column B, starting in row 2 with headers in row 1. Sort ascending by date. That is all the setup a moving average needs — one column of periods, one column of values, no gaps.

For the examples below, assume your values live in B2:B100. Add a header in C1 like “3-Period MA” for the column you are about to build.

💡 Pro tip: Convert your range to an Excel Table with Ctrl+T. Structured references and auto-fill make multi-column smoothing far tidier, and any chart you build will extend automatically as new periods are added.

2.Step 2 — The Simple Moving Average

The simple moving average is just AVERAGE over a sliding window. For a 3-period SMA, go to cell C4 (the third data row — the first row that has three values behind it) and enter:

=AVERAGE(B2:B4)

Then grab the fill handle and drag down. Because the references are relative, C5 becomes =AVERAGE(B3:B5), C6 becomes =AVERAGE(B4:B6), and so on — the window slides down one row at a time exactly as it should. That is the entire mechanism of a moving average in one formula.

Changing the window size

The window size is simply how many cells the AVERAGE spans. For a 7-period moving average, start in C8 with =AVERAGE(B2:B8); for a 12-period, start in C13 with =AVERAGE(B2:B13). Larger windows give smoother, slower lines; smaller windows track the data more closely.

A window you can change without rewriting formulas

Put the window size in a cell (say $F$1) and use OFFSET so you can change the period in one place:

=AVERAGE(OFFSET(B4,0,0,-$F$1,1))

This averages the $F$1 cells ending at the current row. Type 5 in F1 and the whole column becomes a 5-period MA; type 10 and it instantly becomes a 10-period MA. OFFSET is volatile (it recalculates often), so prefer the plain AVERAGE approach on very large sheets.

3.Step 3 — Handle the Start of the Series

An N-period moving average cannot exist for the first N−1 rows — there simply are not enough prior values. If you drag =AVERAGE(B2:B4) up into C2 and C3, Excel will happily average a partial window and show a misleading early figure. The clean fix is to suppress those cells:

=IF(COUNT(B2:B4)<3,"",AVERAGE(B2:B4))

This returns an empty string until a full window of three real numbers exists, leaving the first two rows blank. On a chart, blank cells create a gap, so your smoothed line correctly starts at period 3 rather than dangling from a fake early value.

✗ Partial windows
PeriodValue3-MA
1100100
2120110
390103
✓ Full windows only
PeriodValue3-MA
1100—
2120—
390103

4.Step 4 — Add a Moving Average Trendline to a Chart

If you only want the smoothed line on a chart — not the values in cells — Excel can do it without a single formula. Select your data and insert a Line or Scatter chart. Click the data series to select it, right-click, and choose Add Trendline. In the Format Trendline pane, pick Moving Average and set the Period to your window size.

Excel overlays a smoothed trendline on your raw data instantly, and you can change the period in the pane to experiment. This is the fastest way to see a trend.

⚠ Important: A chart trendline is purely visual — the smoothed numbers do not exist anywhere you can reference them. If you need the moving-average values for further calculation, a forecast, or a dashboard, you must build them in cells with the AVERAGE formula from Step 2.

5.Step 5 — Trailing vs Centered

There are two ways to align a moving average to its window, and they answer different questions.

A trailing moving average — the kind from Step 2 — places each average at the latest period in its window (=AVERAGE(B2:B4) sits in row 4). You can compute it the moment the newest value arrives, which makes it the right choice for forecasting, dashboards, and anything real-time. Its downside is that it lags: it is always a little behind the true trend.

A centered moving average places each average at the middle of its window. For a 3-period centered MA, =AVERAGE(B2:B4) sits in row 3, not row 4. Centering removes the lag and gives the truest picture of the underlying trend and seasonality — but it needs future values, so you can never compute it for the most recent periods. Use centered for historical analysis, trailing for prediction.

=AVERAGE(B3:B5) <- centered MA placed in row 4 (uses one period before and after)

For an even-numbered window, a true centered MA requires a “double” moving average (the 2×12 used in seasonal decomposition) because the centre falls between two periods.

6.Step 6 — The Weighted Moving Average (WMA)

A simple average treats a value from three days ago exactly like today’s — but in many series the most recent data is more relevant. A weighted moving average fixes this by multiplying each period by a weight and dividing by the total weight. With weights of 1, 2, 3 (oldest to newest) for a 3-period window:

=SUMPRODUCT(B2:B4,{1;2;3})/6

The newest value (B4) carries three times the influence of the oldest (B2), so the line reacts faster to recent changes while still smoothing noise. The divisor 6 is the sum of the weights (1+2+3). To make the weights editable, put them in cells and use =SUMPRODUCT(B2:B4,$G$2:$G$4)/SUM($G$2:$G$4).

💡 Pro tip: The vertical curly-brace array {1;2;3} uses semicolons because the data runs down rows. If your data runs across columns, use commas: {1,2,3}. Match the array orientation to your data orientation or SUMPRODUCT returns the wrong result.

7.Step 7 — The Exponential Moving Average (EMA)

The exponential moving average is the most responsive of the three. Instead of a fixed window, it blends each new value with the previous EMA using a smoothing factor α (alpha) between 0 and 1. Every past period still contributes, but its influence decays exponentially the further back it is.

First choose α. A common convention links it to an equivalent window N: α = 2/(N+1), so a “10-period” EMA uses α ≈ 0.18. Then seed the first EMA cell with the actual first value (or the SMA of the first few). From the second period on:

=$F$1*B3+(1-$F$1)*D2

Here $F$1 holds α, B3 is the current value, and D2 is the previous period’s EMA. Fill down and each cell builds on the one above it. A higher α tracks the data more tightly (less smoothing); a lower α produces a calmer line. EMAs are the workhorse of financial charts and demand sensing for exactly this reason — they react quickly without the abrupt “drop-off” that an SMA shows when an old spike leaves the window.

An EMA is the same calculation as single exponential smoothing. If your series also trends or repeats every season, the next step up is double or triple smoothing — see exponential smoothing in Excel for both, built cell by cell.

MethodReacts to changeBest for
Simple (SMA)SlowestClear, stable trends; easy explanation
Weighted (WMA)MediumWhen recent periods matter more
Exponential (EMA)FastestVolatile data; finance; demand sensing

8.Step 8 — Forecasting with a Moving Average

To forecast the next period, place the average of the last N actual values in the next (empty) row. If your data ends at B100, the period-101 forecast is:

=AVERAGE(B98:B100)

That is a 3-period moving-average forecast. It is transparent and surprisingly hard to beat on stable data, but be aware of its built-in limitation: a moving average always lags. On a rising series it forecasts low; on a falling series it forecasts high; and it cannot project a trend forward, only echo the recent level.

When your data has a genuine trend or seasonality, a moving average is the wrong forecasting tool. Reach instead for exponential smoothing with trend and seasonal components — the Holt-Winters method — or Excel’s built-in FORECAST.ETS. We cover that end to end in the Holt-Winters forecasting in Excel tutorial.

Try It: Live Smoothing Chart

This is the moving-average trade-off made visible. The faint line is 24 periods of noisy data; the bright line is its moving average. Drag the slider to change the window size and switch between Simple and Exponential to feel the difference: a small window hugs the noise, a large window glides smoothly but lags, and the EMA reacts faster than the SMA at the same setting — exactly what your Excel formulas produce.

Moving Average Visualiser

Adjust the window and method — the smoothed line redraws live, just like changing the range in =AVERAGE().

4 periods
Raw data 4-period simple moving average
—

Advanced Moving Average Tips

Date-range moving average with AVERAGEIFS

If your periods are real dates and you want a true rolling 30-day average (not a fixed row count), use =AVERAGEIFS(B:B,A:A,">"&A2-30,A:A,"<="&A2). This averages every value whose date falls in the 30 days up to the current row — robust even if some calendar days are missing.

Dynamic spilled MA in Microsoft 365

With dynamic arrays you can compute an entire moving-average column in one formula using SCAN or a BYROW/AVERAGE combination, so there is nothing to drag and nothing to break when data grows.

Compare two windows to judge momentum

Plotting a short MA and a long MA together is a classic technique: when the short crosses above the long, recent momentum is rising; when it crosses below, it is falling. It is the basis of the moving-average crossover used throughout finance and demand planning.

From smoothing to a live dashboard

Once your moving averages drive decisions, you will want them refreshed and shareable. Upload your spreadsheet to DataHub Pro and it builds an interactive, always-current chart with smoothing and forecasting built in — no formulas to maintain, a link to share instead of a screenshot.

Common Errors & Fixes

The moving average line is offset from the data

You have mixed trailing and centered alignment. Decide which you want and place the formula in the correct row consistently — trailing in the last row of the window, centered in the middle.

#DIV/0! in the moving average

The window contains only blank cells, or AVERAGE is pointed at text. Ensure the range holds numbers and use the Step 3 IF(COUNT(...)) guard for the start of the series.

The smoothed line looks identical to the raw line

Your window is too small (a 2-period MA barely smooths) or your data is not actually noisy. Increase the window and confirm you are charting the MA column, not the raw column twice.

EMA values look wrong from the first row

The seed is missing. The first EMA cell must be a plain actual value (or an SMA), not the recursive formula — the recursive formula has nothing to reference above it and will error or chain from a blank.

Smooth, Forecast & Share — Automatically

DataHub Pro turns your time-series spreadsheet into a live chart with built-in moving averages and forecasting in under 60 seconds. Upload your data, pick a method, and share a link that updates itself — no formulas to maintain.

Try DataHub Pro free →

Workbooks that use this method

Each page shows the sheet and its live formulas before you sign in.

Sales Forecast TemplateWeighted pipeline, run-rate and committed forecasts side by side.Holt-Winters Forecasting TemplateTriple exponential smoothing with trend and seasonality, plus 95% confidence bands.Rolling Z-Score & MAD Outlier DetectionA robust MAD score that finds the outliers an ordinary z-score hides inside its own…

Frequently Asked Questions

How do I calculate a moving average in Excel?
Put your values in time order in a column. For a 3-period simple moving average, go to the third data row and enter =AVERAGE(B2:B4), then drag the formula down. Each cell averages the current period and the previous two, and because the references are relative the window slides one row at a time as you fill down. Change the number of cells in the AVERAGE range to change the window size — =AVERAGE(B2:B8) is a 7-period moving average.
What is the formula for a moving average in Excel?
The simple moving average uses AVERAGE over a sliding window: =AVERAGE(B2:B4) for 3 periods. A weighted moving average uses =SUMPRODUCT(values,weights)/SUM(weights). An exponential moving average uses =alpha*currentValue+(1-alpha)*previousEMA, where alpha=2/(N+1). All three smooth a noisy series; they differ only in how much weight they give recent versus older periods.
How do I add a moving average trendline to an Excel chart?
Create a line or scatter chart of your data. Click the data series to select it, right-click, and choose Add Trendline. In the Format Trendline pane select Moving Average and set Period to your window size (for example 7). Excel overlays a smoothed line on top of your raw data without you writing any formula. Note that a chart trendline is visual only — to use the smoothed values elsewhere you still need the AVERAGE formula in cells.
What is the difference between simple, weighted, and exponential moving averages?
A simple moving average (SMA) gives every period in the window equal weight, so it reacts slowly and lags trends. A weighted moving average (WMA) assigns larger weights to more recent periods, so it responds faster. An exponential moving average (EMA) weights every past period with a smoothly decaying factor, never fully dropping old data but emphasising the latest — it reacts fastest and is popular in finance. Choose SMA for simplicity, WMA or EMA when recent changes matter most.
What window size should I use for a moving average?
It depends on the trade-off between smoothness and responsiveness. A short window (3–5 periods) follows the data closely but stays noisy; a long window (12 months, 50 days) is very smooth but lags real changes. For seasonal data, set the window equal to the season length — a 7-day moving average removes day-of-week effects, a 12-month moving average removes annual seasonality. Try a few windows and pick the one that reveals the pattern you care about.
What is the difference between a trailing and a centered moving average?
A trailing moving average aligns each average to the most recent period in its window, so it can be calculated as soon as the latest value arrives — this is what you use for forecasting and real-time dashboards. A centered moving average aligns each average to the middle of its window, which best reveals the underlying trend and seasonality but cannot be computed for the most recent periods because it needs future values. Use trailing to predict, centered to analyse.
How do I make a moving average ignore blank or partial windows?
The first N-1 rows of an N-period moving average do not have a full window. Either leave those cells blank manually, or wrap the formula: =IF(COUNT(B2:B4)<3,"",AVERAGE(B2:B4)) returns a blank until three real values exist. This stops a partial average (say, the first value averaged with two blanks) from showing a misleading early figure on your chart.
Can I use the Data Analysis ToolPak for moving averages in Excel?
Yes. Enable it via File → Options → Add-ins → Manage Excel Add-ins → tick Analysis ToolPak. Then go to Data → Data Analysis → Moving Average, set the Input Range, the Interval (window size), and an Output Range. It generates the SMA column and can plot a chart automatically. It is convenient for a one-off, but the values are static — they do not update if your data changes, so for a live dashboard the AVERAGE formula approach is better.
How do I forecast the next period with a moving average in Excel?
The simplest moving-average forecast is the average of the last N actual values placed in the next (empty) period row: =AVERAGE(B10:B12) (periods 9 to 11, with a header in row 1) forecasts period 12 as the mean of the last three actuals. Moving-average forecasts assume no strong trend — they always lag a rising or falling series. For data with a clear trend or seasonality, an exponential method like Holt-Winters usually forecasts more accurately than a plain moving average.
How do I calculate an exponential moving average in Excel?
Put the smoothing factor alpha in a cell, for example H1 = 2/(N+1), so 0.5 for a 3-period EMA. Seed the first EMA cell with the first value (E2 = B2), then in E3 enter =$H$1*B3+(1-$H$1)*E2 and fill down. In Microsoft 365 you can do it in one spilling formula: =SCAN(B2,B2:B7,LAMBDA(prev,x,$H$1*x+(1-$H$1)*prev)).
How do I calculate a weighted moving average in Excel?
Multiply each value in the window by a weight and divide by the sum of the weights. For a 3-period weighted moving average with weights 1, 2 and 3 (newest heaviest), enter =SUMPRODUCT(B2:B4,{1;2;3})/6 in the third row and fill down. To make the weights editable, put them in cells such as G2:G4 and use =SUMPRODUCT(B2:B4,$G$2:$G$4)/SUM($G$2:$G$4).

Related Tutorials

Keep reading

Try it on your own spreadsheet → Free, no sign-up.

Start from a ready-made template

Browse all 48 templates → Free, opens with sample data.