Check the "inLeague" variable. 1 means the player is in the league selected on the Game tab, 0 means the player is not.
By the way, in your formula, you are assigning a value to the "rank" variable. Just so you know, this variable already has a value (it is the same as "r"). This isn't a problem, really, because you're just overwriting the value it has.
If your formula is:
assign("rank", switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1))
rank*n
It could be rewritten as:
switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1) * n
And using the "inLeague" variable:
if(inLeague, switch(r, 1, 10, 2, 8, 3, 6, 4, 5, 5, 4, 6, 3, 7, 2, 8, 1) * n, 0)