FormulaCraft

How to calculate a weighted moving average in Excel and Google Sheets

Topic:AVERAGE & central tendency
Excel & Google Sheets
=SUMPRODUCT(A2:A4,B2:B4)/SUM(B2:B4)

Verified example

Computed by a real spreadsheet engine on the sample data below.

ValueWeight
1201
1352
1423

=SUMPRODUCT(A2:A4,B2:B4)/SUM(B2:B4)136

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Put your time-series values in A2:A10, oldest first. Put the weights in B2:B4 — for a 3-period WMA with linear emphasis on recency, use 1, 2, 3 (weight 3 applies to the most recent value).
  2. 2In C4 (the first row with a full 3-period window) enter =SUMPRODUCT(A2:A4,B2:B4)/SUM(B2:B4). This computes (A2*1 + A3*2 + A4*3) / 6.
  3. 3For C5 shift the data window: =SUMPRODUCT(A3:A5,$B$2:$B$4)/SUM($B$2:$B$4). Lock the weight range absolutely so it stays fixed while the data range shifts one row.
  4. 4To make the formula self-adjusting, use OFFSET: =SUMPRODUCT(OFFSET(A4,-2,0,3,1),$B$2:$B$4)/SUM($B$2:$B$4) — copy this to any row without editing.
  5. 5Leave C2:C3 blank or as N/A, since there are not enough prior values to fill the window.

Tips

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

How is a weighted moving average different from an exponential moving average?

A WMA uses explicit fixed weights you define, making it transparent and simple. An EMA applies a smoothing factor recursively, incorporating all past data with exponentially decaying influence — useful for financial time series.

Can I use SUMPRODUCT with weights stored as an array literal instead of a range?

Yes — hardcode the weights as an array: =SUMPRODUCT(A2:A4,{1,2,3})/6. This works in both Excel and Sheets but is less flexible when you want to change weights later.

More on AVERAGE & central tendency

See all →

Formulas used

Related tasks

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: