XL 2010 compter masculin feminin

jean123

XLDnaute Occasionnel
bonjour à tous, j'ai un tableau de 50 000 lignes environ et qui grossie au fur et à mesure

dans ce tableau j'ai des dates colonne A et une colonne (D) sexe "m" et "f"

j'aimerais si possible en vba pouvoir compter le nombre de "m" pour chaque date et le nombre de "f" pour chaque date

un grand merci pour votre aide
 

Pièces jointes

  • mf.JPG
    mf.JPG
    96.9 KB · Affichages: 40

jean123

XLDnaute Occasionnel
j'ai essayé un truc
Code:
Sub TEST()

Set mondico = CreateObject("Scripting.Dictionary")
tb1 = Sheets("Feuil1").Range("A2:C" & Range("A" & Rows.Count).End(xlUp).Row)
tb2 = Sheets("Feuil2").Range("A2:C" & Sheets("Feuil2").Range("A" & Rows.Count).End(xlUp).Row)
For n = LBound(tb1, 1) To UBound(tb1, 1)
If tb1(n, 1) And tb1(n, 3) = tb2(n, 1) And tb2(n, 5) Then
mondico = mondico
End If
Next
b = mondico.items
Sheets("Feuil2").Range("L1").Resize(UBound(b) + 1) = Application.Transpose(b)

End Sub

bon ça marche pas !! je pense que j'ai encore beaucoup a apprendre :eek:
 

jean123

XLDnaute Occasionnel
j'ai essayé de comprendre comment tu as procédé et j'ai réussit a faire ça

Code:
Sub report()

tablo = Sheets("Feuil1").Range("A2:E" & Sheets("Feuil1").Range("A" & Rows.Count).End(xlUp).Row)
Set dico = CreateObject("Scripting.dictionary")
For n = LBound(tablo, 1) To UBound(tablo, 1)
  x = CDbl(CDate(tablo(n, 1)))
  If tablo(n, 4) = "A" Then
     dico(x) = dico(x) + tablo(n, 5)
  Else
     dico(x) = dico(x)
  End If
Next
a = dico.keys
b = dico.items
Range("I2").Resize(UBound(a) + 1) = Application.Transpose(a)
Range("J2").Resize(UBound(b) + 1) = Application.Transpose(b)
End Sub

Sub report2()

tablo = Sheets("Feuil1").Range("A2:E" & Sheets("Feuil1").Range("A" & Rows.Count).End(xlUp).Row)
Set dico = CreateObject("Scripting.dictionary")
For n = LBound(tablo, 1) To UBound(tablo, 1)
  x = CDbl(CDate(tablo(n, 1)))
  If tablo(n, 4) = "B" Then
     dico(x) = dico(x) + tablo(n, 5)
  Else
     dico(x) = dico(x)
  End If
Next
a = dico.keys
b = dico.items
Range("I2").Resize(UBound(a) + 1) = Application.Transpose(a)
Range("K2").Resize(UBound(b) + 1) = Application.Transpose(b)
End Sub

ça fonctionne je pense pas avoir fait de connerie (si tu peut jeter un œil)

il reste le copier coller en macro mais là je coince
 

Discussions similaires

Statistiques des forums

Discussions
312 305
Messages
2 087 084
Membres
103 461
dernier inscrit
dams94