Just one more thing... I've attempted to adapt the code slightly so that if teams are level on points and goal difference they are then ranked by the number of times they've scored. However, in the example below, teams C and E are both given a postion of 2 (rather than C being 2 and E being 3)...