Salut Edel, MFerrand,
Pour le plaisir, bien que ce fichier soit clairement une chasse gardée pour les formules, une version qui corrigeRAIT les 'trous' en début et en fin de données, histoire de rester cohérent dans les résultats.
Avec un petit bouton rouge en prime!
Private Sub cmdGO_Click()
'
Dim tTab, tMoy(100, 2)
'
Range("E2:F101").ClearContents
'
For x = 2 To 100
If Cells(x, 1) = 360 Or Cells(x, 1) = 0 Then
Range("A1:C1").Interior.Color = xlNone
Range("A2:C" & 102 - x).Insert shift:=xlDown
Range("A2:A" & 102 - x).Value = Range("A102:A" & 100 + (102 - x)).Value
Range("A1:C1").Interior.Color = RGB(240, 200, 0)
Exit For
End If
Next
'
iRow = Range("A" & Rows.Count).End(xlUp).Row
If (iRow - 1) Mod 100 > 0 Then
iLig = 100 - ((iRow - 1) Mod 100)
Range("A" & iRow + 1 & ":A" & iRow + iLig).Value = Range("A" & 102 - iLig & ":A" & 101).Value
End If
iRow = Range("A" & Rows.Count).End(xlUp).Row
'
tTab = Range("B2:C" & iRow)
For x = 0 To 99
For y = x + 1 To UBound(tTab, 1) Step 100
tMoy(x, 0) = tMoy(x, 0) + tTab(y, 1)
tMoy(x, 1) = tMoy(x, 1) + tTab(y, 2)
Next
tMoy(x, 0) = tMoy(x, 0) / (UBound(tTab, 1) / 100)
tMoy(x, 1) = tMoy(x, 1) / (UBound(tTab, 1) / 100)
Next
Range("E2:F101") = tMoy
'
End Sub
A+