google-sheets

Average a series of numbers which occur every 4 or 5 rows


I've created a spreadsheet which tracks my weekly mailing list details (recipients, opens, and clicks). One column contains a cell with a forumula which subtracts the recipients at the beginning of the month from the recipients at the end of the month; giving me growth for that month (see below). Now I'd like to average the last X values to determine what my average monthly growth is.

If I were to describe it in simple terms:

The problem is that the empty cells, and the fact that there might not be a value in the "last" cell in the column is throwing me off. Can anyone offer input into how I might go about this?

Here's a copy of my sheet for reference.

Spreadsheet example


Solution

  • To average the last X values in column G2:G, use chooserows(), tocol() and sequence(), like this:

    =let(
      X, 3, 
      data, chooserows(
        tocol(G2:G, 1),
        sequence(X, 1, -1, -1)
      ),
      average(data)
    )
    

    See let(), chooserows(), tocol() and sequence().