Jetzt sollte ich eine Formel haben, mit der ich genau sagen kann, dass die Zahl 123 39 mal, die zahl 3456 123 mal vorkommt.
Aber wie nur ????
z.B.:
jetzt
123
123
123
245
245
350
350
usw.
nachher
123 3 mal
245 2 mal
350 2 mal
Jetzt sollte ich eine Formel haben, mit der ich genau sagen kann, dass die Zahl 123 39 mal, die zahl 3456 123 mal vorkommt.
Aber wie nur ????
z.B.:
jetzt
123
123
123
245
245
350
350
usw.
nachher
123 3 mal
245 2 mal
350 2 mal
Sub CountSomething()
Dim iRow1 As Integer
Dim iRow2 As Integer
Dim iColumn As Integer
Dim myInt As Integer
Dim iRowCount As Integer
iColumn = 1 ' Spalte in der die Zahlen stehen (daneben sollte frei sein, denn da schreiben wir die Anzahl hin
iRowCount = 30000 ' Anzahl der Zeilen
For iRow1 = 1 To iRowCount
If Cells(iRow1, iColumn).Value <> "" Then
myInt = Cells(iRow1, iColumn).Value
Cells(iRow1, iColumn + 1).Value = 1
For iRow2 = iRow1 + 1 To iRowCount
If Cells(iRow2, iColumn).Value <> "" Then
If Cells(iRow2, iColumn).Value = myInt Then
Cells(iRow1, iColumn + 1).Value = Cells(iRow1, iColumn + 1).Value + 1
Rows(iRow2).Select
Selection.Delete Shift:=xlUp
iRow2 = iRow2 - 1
End If
Else
iRow2 = iRowCount
End If
Next
Else
iRow2 = iRowCount
End If
Next
End Sub