Well I've been sitting down at my desk for the past 2 hours and I bet the answer is probably easy, but I am trying to work on a formula to tell exactly how many levels are needed to get to the next level on a game I play, Runescape, this is within the rules of the game so I know it shouldn't be a problem. Below is the formula to get the characters combat level. So now I am trying to figure out a formula to see how many levels are needed to get to the next level. I was trying as hard as I could, but I couldn't even get past Melee levels.


Code:
Public Function CalcCombat(Attack As Integer, Defence As Integer, Strength As Integer, HP As Integer, Prayer As Integer, Ranged As Integer, Magic As Integer) As Double
On Error Resume Next
Dim Base As Double, Melee As Double, Mage As Double, Range As Double

Base = ((Defence + HP + Int(Prayer / 2)) * 0.25)
Melee = (Attack + Strength) * 0.325
Range = Int(Ranged * 1.5) * 0.325
Mage = Int(Magic * 1.5) * 0.325

If Melee > Range And Melee > Mage Then
    CalcCombat = Int(Melee + Base)
    strClass = "Knight"
ElseIf Range > Melee And Range > Mage Then
    CalcCombat = Int(Range + Base)
    strClass = "Archer"
Else
    CalcCombat = Int(Mage + Base)
    strClass = "Mage"
End If
End Function