A moving average (rolling average) replaces each value with the average of the last few values, such as the last 7 days. It smooths out day-to-day noise so the trend is easier to see.
7-day moving average on day t = Average of days t − 6 to t
On the 30-day sample below: 36.57.
When to use it
Daily figures jump around with weekdays, weather and one-off events. A 7-day average removes the weekly pattern and makes a real change in level visible.
Worked example
The figure here is the 7-day average on day 30 (days 24 to 30). A moving average lags behind turning points: it is late by about half its window.
=AVERAGE(C25:C31)| Day | Website orders |
|---|---|
| 1 | 24 |
| 2 | 27 |
| 3 | 22 |
| 4 | 30 |
| 5 | 28 |
| 6 | 25 |
| 7 | 31 |
| 8 | 29 |
| 9 | 26 |
| 10 | 33 |
| 11 | 30 |
| 12 | 28 |
| 13 | 35 |
| 14 | 32 |
| 15 | 29 |
| 16 | 34 |
| 17 | 61 |
| 18 | 31 |
| 19 | 36 |
| 20 | 33 |
| 21 | 30 |
| 22 | 37 |
| 23 | 35 |
| 24 | 32 |
| 25 | 38 |
| 26 | 36 |
| 27 | 34 |
| 28 | 40 |
| 29 | 37 |
| 30 | 39 |
Common mistakes
- The first window − 1 days have no full average. Leave them blank rather than averaging fewer days.
- One extreme day sits inside the average for the whole window, so day 17 lifts days 17 to 23.
- Use a window that matches the cycle you want to remove: 7 for weekdays, 12 for months in a year.
Calculate it yourself
Related methods
See all statistics methods or the business metrics they are used on.
Guides that use it
- How to find out what changed in your sales data — 2 min read
- How to forecast next quarter’s numbers without fooling yourself — 2 min read
- Data visualization techniques: which chart for which question — 2 min read
- Data analysis methods and techniques, and when to use each — 3 min read
- Data analysis examples: 6 worked from one dataset — 3 min read
Further reading
Questions people ask
- What is moving average?
- A moving average (rolling average) replaces each value with the average of the last few values, such as the last 7 days. It smooths out day-to-day noise so the trend is easier to see.
- What is the formula for moving average?
- 7-day moving average on day t = Average of days t − 6 to t. On the 30-day sample data the result is 36.57.
- How do you calculate moving average in Excel?
- Use =AVERAGE(C25:C31) with the data in rows 2 to 31. The same formula works in Google Sheets.
About the data on this page
The figures come from a small made-up dataset, printed above in full so you can check every number by hand. Download it as daily.csv. The results are computed from those rows when the page is built, and the Excel formulas, SQL and Python on these pages are run against the same rows before publishing, so the code and the answers agree.
To get these numbers from your own data without writing formulas, try AnalyzeIt: ask in plain words and it shows the working behind every figure.
Legal entity
Devansh Yadav
Moradabad, Uttar Pradesh
Governing law: Courts at Moradabad, Uttar Pradesh
Phone: +91 8433475698
Legal: legal@analyzeit.in