Latest posts by techwriter (see all)
- Should Technical Writing be Boring? And if Yes, Why? - November 15, 2017
- How to Create a Custom-Designed Header in MS Word that Would be Available to All Other Word Documents - November 13, 2017
- What is the Difference Between Expository Writing and Technical Writing? - November 8, 2017
By BJ Johnston
Calculating moving averages can be a really useful way to look at trends in your data, and we can easily set up a formula in Excel to always look at the last 3 or 6 or any numbers of months in your data.
They are one of the most used and popular indicators. The best place to start is by understanding the most basic type of trend the simple moving average (SMA). No matter how long or short of a moving average you are looking to plot and track, the basic calculations remain the same time and time again.
Let’s take a look at an example. I want to know the last 3 months average sales of my Beanie Hats… always the last three months even when my new monthly sales data is added into my spreadsheet.
I have entered the number of months I want to use for the moving average in cell G6. (In this way I can easily change the number of months I want to look at in my formula- I may at some point want to look at 6 months or 9 months). The formula in G5 ( where I want my formula result to display) reads –
My Dates are in Column B and my values are in Column C and begin in row 7.
Let’s break this down and work out what Excel is doing.
First of all, the OFFSET function returns a range in Excel, and we want this to always be the last 3 (or however many specified in our G6 cell). OFFSET takes the following arguments –
So, we will tell the OFFSET function to create a new range with the starting cell being 7 cells below C4 (the first volume cell), and continuing for 3 cells down. How does it know to start 7 cells down?
By entering COUNT(C:C)-G6 as the reference, COUNT(C:C) returns the amount of cells containing numbers in the column C.. in this case 10. Subtract 3 as we want just the last 3.
Wrap it all in the AVERAGE function. We now have a moving average calculated automatically by Excel, we can change the number of months easily by changing the value of Cell G6.
BJ Johnston has been an advanced Excel user for 15 years and is the creator of http://www.howtoexcelatexcel.com a site that shares Excel tips and tricks with it’s enthusiastic members.