Question

I have a formatted table that contains information about areas, including sales for the month (and a heap of other columns containing other details). The table is the basis for graphs and pivot tables.

There is a row per month for each area, e.g.:

   A        B       C       D
1  Area     Month   Sales   TwoMonthAverage
2  North    1       400     Manually entered
3  West     1       500     Manually entered
4  South    1       200     Manually entered
5  North    2       200     <calculate??>
6  West     2       200     <calculate??>
7  South    2       200     <calculate??>
8  North    3       100     <calculate??>
9  West     3       900     <calculate??>
10 South    3       600     <calculate??>

Each month, I want to calculate the "2 month average" sales for an area (being the average of the current and previous months).

I need to know how to get the sales for the same area for the previous month. The table rows will not necessarily be in the same area or month order. Needs to work in Excel 2013 and 2010.

Thanks Blair

Was it helpful?

Solution

You could perhaps use SUMIFS to get the sum of the past 2 months sale:

=SUMIFS($C$2:C5, $A$2:A5, A5, $B$2:B5, ">="&B5-1)

This in D5 will give the sum of values that:

  • Have values in cells A above and including the current row, and
  • Have the month above or equal to the current month - 1.

You then only need to divide by 2 to get the 2 month average.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top