A
Archimed
Guest
Bonjour tout le Monde🙂🙂;
J'ai écris ce Code en VBA pour le calcul de la moyenne trim mais il me paraît qu'on peut faire mieux, voici le code:
Function Moytrim (a,b,c)
If a<>0 and b<>0 and c= 0 Then
Moytrim =(a+b)/2
Else
If a<>0 and b=0 and c<> 0 Then
Moytrim =(a+c) / 4
Else
If a<>0 and b=0 and c = 0 Then
Moytrim =a
Else
If a=0 and b<>0 and c <> 0 Then
Moytrim =(b+c) / 4
Else
If a=0 and b<>0 and c = 0 Then
Moytrim =b
Else
If a=0 and b =0 and c <> 0 Then
Moytrim =c /3
Else
If a=0 and b =0 and c = 0 Then
Moytrim =""
Else
Moytrim =(a+b+c)/5
End If
End If
End If
End If
End If
End If
End If
End If
End Function
Merci de vouloir me donner un coup de main.Archi
J'ai écris ce Code en VBA pour le calcul de la moyenne trim mais il me paraît qu'on peut faire mieux, voici le code:
Function Moytrim (a,b,c)
If a<>0 and b<>0 and c= 0 Then
Moytrim =(a+b)/2
Else
If a<>0 and b=0 and c<> 0 Then
Moytrim =(a+c) / 4
Else
If a<>0 and b=0 and c = 0 Then
Moytrim =a
Else
If a=0 and b<>0 and c <> 0 Then
Moytrim =(b+c) / 4
Else
If a=0 and b<>0 and c = 0 Then
Moytrim =b
Else
If a=0 and b =0 and c <> 0 Then
Moytrim =c /3
Else
If a=0 and b =0 and c = 0 Then
Moytrim =""
Else
Moytrim =(a+b+c)/5
End If
End If
End If
End If
End If
End If
End If
End If
End Function
Merci de vouloir me donner un coup de main.Archi