Collecting Average Between 2 Ranges

Hi all!

I am trying to collect an average over the last 12 rows (including the current row). To do this, I created 2 additional helper columns (Line-ID and Row#), and trying enclosing the condition in an AND clause, however this seems to return unparseable. I think I am on the right path or way of thinking here, but that it may be a syntax error. If anyone could help out with the formula, it would be much appreciated!

Here is the formula I am working with right now:

=AVG(COLLECT([TIME]:[TIME], AND(([ROW#]:[ROW#], >[ROW#]@row - 13), ([ROW#]:[ROW#], <[ROW#]@row + 1))))

I am trying to return the avg of the last 12 weeks (each row is a week) of the column "TIME". This means (at least by my logic), I want to capture all the values where @Row-13 <@Row<@Row+1.

Best Answer

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!