I wrote this Rank formula to rank the numbers in column D by the values associated with them in Column E. I wanted the formula to resolve ties randomly, e.g. if there was a tie for first place, it would just randomly choose one of the accounts to be first and the other to be second. The way that I've incorporated randomness into this formula is hurting me though and I don't know how to fix it. Basically if there's a tie, its randomly choosing a number between 1 and 2 for both of the objects that are ranked #1, which means that there's a 50% chance that both will be the same number, and the tie won't be resolved. Can anyone help me sort this out?
=IF(COUNTIF($E:$E,$E2)=1,RANK($E2,$E:$E,0),INDEX(RANK($E2,$E:$E,0)+(RANDARRAY(1,COUNTIF($E:$E,$E2),0,1)<0.5),COUNTIF($E:$E,$E2)))