Weighted Moving Average Formula in Excel

Formulas & functions · Updated November 23, 2026

The formula for a weighted moving average (WMA) in Excel is =SUMPRODUCT(values_range, weights_range)/SUM(weights_range), where you assign higher weights to more recent data points. For a 3-period WMA with weights 0.5, 0.3, and 0.2 (most recent first), the formula becomes =SUMPRODUCT(B3:B5, {0.5;0.3;0.2})/SUM(0.5,0.3,0.2).

What Is a Weighted Moving Average?

A weighted moving average (WMA) is a forecasting and smoothing technique that gives different importance (weights) to data points in a rolling window. Unlike a simple moving average (SMA) that treats all values equally, a WMA assigns larger weights to recent observations, making it more responsive to recent changes. This is useful for sales forecasting, inventory planning, stock price analysis, and any time-series data where recent trends matter more than older ones.

In Excel, you can calculate a WMA manually using formulas or by using the built-in Data Analysis tool (which only offers SMA, not WMA). The manual approach is straightforward and gives you full control over weights.

How to Calculate WMA in Excel (Step-by-Step)

Assume your data is in column A (A2:A100) with the most recent value at the bottom. You want a 5-period WMA with weights 0.4, 0.3, 0.2, 0.07, 0.03 (most recent first). Here’s how:

  1. In a cell (e.g., B6), enter the formula: =SUMPRODUCT(A2:A6, {0.4;0.3;0.2;0.07;0.03})/SUM(0.4,0.3,0.2,0.07,0.03)
  2. Press Enter. The result is the weighted average for the last 5 periods.
  3. Copy the formula down to get WMAs for earlier windows (adjust the range accordingly).

For example, with values 10, 12, 11, 13, 14 in A2:A6, the WMA = (14*0.4 + 13*0.3 + 11*0.2 + 12*0.07 + 10*0.03) / 1.0 = (5.6 + 3.9 + 2.2 + 0.84 + 0.3) = 12.84. The result is 12.84.

If your weights are in a separate range (e.g., C2:C6), use =SUMPRODUCT(A2:A6, C2:C6)/SUM(C2:C6).

Why Use Weights? The Logic Behind WMA

The main reason to weight recent data more heavily is that in many real-world scenarios, the latest observations are more indicative of the near future. For instance, if you’re forecasting next month’s sales, last month’s sales are usually a better predictor than sales from six months ago. A WMA lets you tune how much influence each period has.

Weights can be any positive numbers; they don’t need to sum to 1 because the formula divides by the sum. Common weighting schemes:

  • Linear: weights decrease linearly (e.g., 3,2,1 for 3 periods).
  • Exponential: weights decrease exponentially (e.g., 0.5, 0.25, 0.125).
  • Custom: based on domain knowledge (e.g., seasonal adjustments).

The choice of weights dramatically affects the forecast. Higher weights on the most recent period make the average more volatile; lower weights smooth it more.

How to Choose the Right Weights and Window Size

There’s no universal rule, but here are practical guidelines:

  • Window length (n): Longer windows smooth out noise but lag behind trends. Shorter windows react faster but may overreact to random fluctuations. For monthly data, 3–6 periods is common; for daily data, 5–20 periods.
  • Weight distribution: If you want a balanced forecast, use linear weights (e.g., 3,2,1). If you want extreme responsiveness, use exponential weights (e.g., 0.6, 0.3, 0.1).
  • Optimization: You can test different weight sets by comparing forecast errors (e.g., Mean Absolute Error) over historical data. Excel’s Solver add-in can find optimal weights by minimizing error, but that requires a separate setup.

Remember: the sum of weights doesn’t matter, but the relative proportions do. A weight set of (0.5,0.3,0.2) is identical to (5,3,2) after normalization.

Common Mistakes and How to Avoid Them

Several pitfalls trip up Excel users:

  • Reversing the order: Ensure your weights align with your data range. If your data is in chronological order (oldest at top), and you want the most recent to have the highest weight, the last cell in the range must pair with the first weight. Use the INDEX function or sort data accordingly.
  • Using AVERAGE instead of SUMPRODUCT: AVERAGE gives equal weights, not weighted.
  • Not adjusting ranges when copying: Use absolute references (e.g., $A$2:$A$6) for fixed windows, or relative references for rolling ones.
  • Forgetting to divide by the sum of weights: If you omit the denominator, your result is a weighted sum, not an average, and may be wildly off.

WMA vs. Simple Moving Average vs. Exponential Smoothing

Here’s a quick comparison:

  • Simple Moving Average (SMA): All periods get equal weight. Smoothest but slowest to react.
  • Weighted Moving Average (WMA): Custom weights, typically favoring recent data. More responsive than SMA, but still has a fixed window.
  • Exponential Smoothing (ES): A special case of WMA where weights decay exponentially and all past data is included (no fixed window). In Excel, you can use the FORECAST.ETS function for exponential smoothing.

For example, with data 10, 12, 11, 13, 14, a 3-period SMA gives (13+14)/2? Actually, SMA for last 3: (11+13+14)/3 = 12.67. A WMA with weights 0.5,0.3,0.2 gives (14*0.5 + 13*0.3 + 11*0.2)/1 = 7+3.9+2.2 = 13.1. Exponential smoothing with alpha=0.5 would give a different value that considers all previous data.

Using Excel’s Built-in Tools for Moving Averages

Excel has a Data Analysis add-in that includes Moving Average, but it only computes SMA, not WMA. To use it:

  1. Go to Data tab > Analysis group > Data Analysis.
  2. Select Moving Average, input range, interval, and output range.
  3. It produces SMA values. For WMA, you must use formulas.

Alternatively, you can use the FORECAST.ETS function (available in Excel 2016 and later) for exponential smoothing, which is a type of weighted average. Syntax: =FORECAST.ETS(target_date, values, timeline). This function automatically optimizes weights.

Frequently Asked Questions

Can I use the AVERAGE function for a weighted moving average?

No, AVERAGE treats all numbers equally. You need SUMPRODUCT to multiply each value by its weight, then divide by the sum of weights.

How do I make the weights update automatically?

Put your weights in a separate range (e.g., C1:C5) and reference that range in the formula: =SUMPRODUCT(A2:A6, C1:C5)/SUM(C1:C5). Then changing the weights updates the WMA instantly.

What if my data has missing values or blanks?

Missing values can cause errors. Use IFERROR to handle them, or fill gaps with interpolation. Alternatively, use SUMPRODUCT with ISNUMBER to ignore blanks: =SUMPRODUCT((A2:A6)*(C1:C5))/SUM(C1:C5) but this will still count blanks as zero.

Is there a keyboard shortcut to enter the formula faster?

No specific shortcut, but you can press Ctrl+Shift+Enter if you’re using an array formula (though SUMPRODUCT doesn’t require it). On Mac, it’s Command+Shift+Enter.

Does Excel have a built-in WMA function?

No. Excel does not have a dedicated WMA function. You must use SUMPRODUCT or write a custom VBA macro.

How do I calculate a weighted moving average for a large dataset efficiently?

Use the formula in a helper column and drag down. For very large datasets, consider using a dynamic array formula like =SUMPRODUCT(OFFSET(...)) or a LET function to avoid recalculating weights. However, for most cases, simple SUMPRODUCT is fast enough.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.