Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Determining a Simple Moving Average.

Determining a Simple Moving Average

by Allen Wyatt
(last updated January 15, 2016)

4

Jeff needs to create a formula that will return a moving average for a range of cells. He adds data to the worksheet daily and he always want to have an average of the last ten days' information. This always corresponds to the last ten cells in a column.

There are a couple of easy ways you can approach this problem. The solution you choose depends on what you ultimately want to see in the way of an average. For instance, if you want to see how the average changes over time, the best approach is to add an additional column to your worksheet. If the data is in column A (starting in row 2), then you can enter the following formula in cell B11:

=IF(A11>"",AVERAGE(A2:A11),"")

Copy the formula down the column, and you will always have the average of the last ten days shown. As you add new data to column A, the updated moving average appears at the bottom of column B. The advantage is that you can see how the average changes from day to day.

If you don't want to add another column for each day's moving average, you can use a different formula to determine the current moving average. Assuming there are no blanks in column A and that there are more than ten pieces of data in the column, you could use the following formula:

=AVERAGE(OFFSET(A1,COUNTA(A:A)-1,0,-10,1))

The OFFSET function defines the range to average. It looks at the number of cells in column A and selects the last 10 as the desired range.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8347) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Determining a Simple Moving Average.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Deleting All Graphics

Graphics can really add pizzazz to a worksheet, but they can also present some drawbacks. If you want to get rid of all the ...

Discover More

Importing Multiple Files to a Single Workbook

If you use Excel to work with data exported from another program, you might be interested in a way to import a large number ...

Discover More

Calculating Expressions

Word can do some simple calculations for you, if you add a little-known tool to your toolbar. Here's how to add and use this ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Averaging a Non-Contiguous Range

Figuring out how to average data that is in a contiguous range of cells is easy. When the data is spread over a group of ...

Discover More

Averaging the Last Numbers in a Column

Need to calculate a running average for the last twelve values in a constantly changing range of values? The formula ...

Discover More

An Average that Excludes Zero Values

Excel allows you to use functions and formulas to analyze your data. One way you can analyze your data is to use the AVERAGE ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 0?

2016-02-03 09:43:40

L Klein

I changed the formula so that the average could handle negative numbers.
=IF(A11<>"",AVERAGE(A2:A11),"")


2016-01-16 14:05:46

J Iddings

@Michael (Micky) Avidan,
Thanks for corrective advice.
However, if I use the as stated formula:
=IF(A11>"",AVERAGE(A2:A11),"")
in cell B11, the result returns blank.

Using the following formula in cell B11:
=IF(A11>"","",AVERAGE(A2:A11))

Or the following formula in B11:
=IF(A11>0,AVERAGE(A2:A11),"")

Returns correct result.
Am I still missing something?


2016-01-15 13:01:12

Michael (Micky) Avidan

@J Iddings,
NO !
Place it in cell B11 and copy down to be adjacent of the last cell (that has value) in column "A".
--------------------------
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2016)
ISRAEL


2016-01-15 11:20:27

J Iddings

The formula: =IF(A11>"",AVERAGE(A2:A11),"")
doesn't work for me.

I modified the formula to:
=IF(A11>0,AVERAGE(A2:A11),"")
and placed it in cell B1, not cell B11.

Did I do it correctly?


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.