# How to calculate a moving average in Excel

Average the last few rows with a relative range and fill down: `=AVERAGE(B2:B4)` in the third row gives a 3-month moving average.

**Excel:** `=AVERAGE(B2:B4)` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C |
| --- | --- | --- |
| Month | Sales | 3-month average |
| Jan | 42100 |  |
| Feb | 45800 |  |
| Mar | 39650 |  |
| Apr | 48200 |  |
| May | 51300 |  |
| Jun | 47900 |  |
| Jul | 53600 |  |
| Aug | 55100 |  |

Formula in C4, filled to C9: `=AVERAGE(B2:B4)`

Result: $42,517; $44,550; $46,383; $49,133; $50,933; $52,200

## How it works

Neither end of `B2:B4` is locked, so the window slides down one row at a time: April averages February to April, May averages March to May. The first two months have no full window, which is why the formula starts in March. The moving average smooths out single-month spikes.

## Other ways

- `=SUM(B2:B4)/3`: The same average spelled out; change the 3 together with the range for other window sizes.

## Common mistakes

- Locking the start (`$B$2:B4`) turns it into a growing average of everything so far, not a moving one.
- Blank months shrink the window, because AVERAGE skips blanks. Fill gaps with 0 only if the month really had no sales.

## Questions

**How do I make a 7-day moving average?**

Start in the seventh row with `=AVERAGE(B2:B8)` and fill down.

**How do I weight recent months more?**

Use SUMPRODUCT with weights that add to 1: `=SUMPRODUCT(B2:B4,{0.2;0.3;0.5})`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/moving-average
