So, if your worksheet only has numbers in cells A1:A5, the MIN function would ensure that the formula only averaged those 5 values.
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. SUMIF (B2:B9, TODAY (), C2:C9) Sum values corresponding to a prior date, i.e. To accommodate that possibility, you may want to alter the formula just a bit: In case you want to sum values based on a current date, then you have to use Excel SUMIF in combination with the TODAY () function as demonstrated below: Criteria. The formula will return an error if column A has fewer than 12 rows worth of data in it. As more numbers are added at the bottom of column A, the formula always reflects the last 12 numbers. That means that the average ends up being for the range A89:A100. 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. If there are 100 cells in use in column A, this means that you end up with a formula being evaluated in this way:
It uses the COUNTA function to figure out how many cells contain something in column A. This formula should, of course, be placed in some cell that is not in column A. 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.Īssuming that there are no gaps in your range of numbers, you can calculate the average of the last 12 numbers with this formula: She needs to calculate the average of the last 12 numbers in the column. Emma has a list of numbers in a worksheet (let's say in column A) that are added to on a weekly basis.