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: Averaging the Last Numbers in a Column.
by Allen Wyatt
(last updated August 3, 2015)
Emma has a list of numbers in a worksheet (let's say in column A) that are added to on a weekly basis. She needs to calculate the average of the last 12 numbers in the column. She wonders how she can do this and have the average always reflect the last 12 numbers, even when she keeps adding numbers each week.
Assuming that there are no gaps in your range of numbers, you can calculate the average of the last 12 numbers with this formula:
This formula should, of course, be placed in some cell that is not in column A. It uses the COUNTA function to figure out how many cells contain something in column A. If there are 100 cells in use in column A, this means that you end up with a formula being evaluated in this way:
Of course, 100 minus 12 is 88, and this number is used as an offset from the starting cell (A2) to say that the range to be averaged should start at A89 and extend down 12 cells. That means that the average ends up being for the range A89:A100. As more numbers are added at the bottom of column A, the formula always reflects the last 12 numbers.
The formula will return an error if column A has fewer than 12 rows worth of data in it. To accommodate that possibility, you may want to alter the formula just a bit:
Instead of using a hard-and-fast value of 12 rows, the MIN function (in two places) returns the minimum of either the actual number of rows or 12. So, if your worksheet only has numbers in cells A1:A5, the MIN function would ensure that the formula only averaged those 5 values.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10278) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Averaging the Last Numbers in a Column.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
A moving average can be a great way to analyze a series of data points that you've collected over time. Setting up a ...Discover More
Excel allows you to use functions and formulas to analyze your data. One way you can analyze your data is to use the ...Discover More
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
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.