Well, the first problem is that "2r" isn't a number, which the TD will attempt to interpret it as. You need to insert a * (multiplication) in there, so all of your "2r" instances are "2 * r".

`switch(r, 1, n,`

2, n - 2*r,

3, if(n >= 6, n-2*r, 0),

4, if(n >= 8, n-2*r, 0),

5, if(n >= 10, n-2*r, 0),

6, if(n >= 12, n-2*r, 0),

7, if(n >= 14, n-2*r, 0),

8, if(n >= 16, n-2*r, 0),

9, if(n >= 18, n-2*r, 0),

10, if(n >= 20, n-2*r, 0))

(linefeeds added for legibility)

That gets it working. But you can also trim it down just a bit:

`max(switch(r, 1, n, n-r*2), 0)`

To average points over time, edit the Filter on the Stats tab:

- set the Tournament Score formula to "points"

- set the Overall Score formula to "average(score)"

When you run the stats (Refresh Tourneys), each player will then have an Overall Score that is the average number of points they earned per tournament.