Function evolution(Imput As Range) As Double
Dim Bonneref As Range
Dim numcol As Double
Dim parcourt As Double
numcol = Imput.Column
If (Len(Cells(1, numcol)) = 10) Then
parcourt = numcol
Do
parcourt = parcourt - 1
Loop While Len(Cells(1, (parcourt))) <> 10
Set Bonneref = Cells(Imput.Row, parcourt)
Else
If (Len(Cells(1, (numcol - 1))) = 10) Then
Set Bonneref = Cells(Imput.Row, (numcol - 2))
Else
Set Bonneref = Cells(Imput.Row, (numcol - 1))
End If
End If
Dim maxi As Double
Dim mini As Double
maxi = Application.WorksheetFunction.Max(Imput, Bonneref)
mini = Application.WorksheetFunction.Min(Imput, Bonneref)
If (Imput > Bonneref) Then
evolution = (1 - (mini / maxi))
Else
evolution = ((mini / maxi) - 1)
End If
End Function