The first column are the players, the second one are their values (sorted always from greatest to smallest), and the third one is the division between the player value and the value of the player below it. I want do distribute some points between these players following this logic: First, it evaluates the relation number. If it is lesser a given number (called cut-off), it sums 1 point to the first player and then it goes to the second. If equal or greater than the cut-off, it gives an extra point and then goes to the second player For the second player, it again evaluate the relation number.If it is lesser a given number (called cut-off), it sums 1 point to the first player and then it goes to the second. If equal or greater than the cut-off, it gives an extra point to the first player, than to the second, and just then it goes to the third one And beyond until it reaches the total number of points (if all players were given their points and the total isnt reached, than it returns to the beggining)
I'm really new at coding (actually I barely touch programming in my life), but i write a code on a non-existent syntax that I think it might give some notion of what I'm looking for:
Function longfield(tamanho) As Variant
pontos As Integer
índice As Double
corte As Double
i = 0
longfield(i) = 1
for i < pontos
a = 0
if índice < corte
longfield(i) = longfield(i) + 1
i +
Else
for a < i
longfield(a) = longfield(a) + 1
a+
longfield(i) = longfield(i) + 1
i +
End Function
So, what I want is to create, via VBA, an excel fuction that receives:
1. The number of items (players)
2. A cut-off
3. An amount of points
And than returns a array with the size equal of the number of players, an than distribute the total points between all players following the cut-off condition