Sub Exemple_PIVOTER_PAR()
[A1:D1] = Array("ANNEE", "CATEGORIE", "PRODUITS", "VENTES")
[A2:A13].Formula = "=2020+MOD(ROW(),2)"
[B2:B13].FormulaR1C1 = "=""Catégorie_""&TEXT(MOD(ROW(),3)+1,""00"")"
[C2:C13].FormulaR1C1 = "=""Produit_""&MOD(ROW(),4)+1"
[D2:D13].FormulaR1C1 = "=RANDBETWEEN(100,1000)"
Range("A1:D13") = Range("A1:D13").Value
[F2].Formula2R1C1 = "=PIVOTBY(RC[-4]:R[11]C[-4],RC[-5]:R[11]C[-5],RC[-2]:R[11]C[-2],SUM)"
[K2].Formula2R1C1 = "=PIVOTBY(RC[-10]:R[11]C[-10],RC[-8]:R[11]C[-8],RC[-7]:R[11]C[-7],AVERAGE)"
End Sub