Hi Miroslav,
pre-format the entire columns in Sheet2 as needed (this should be done only once) and try this code:
Sub ertert()
Dim x, y(), i&, j&, k&, n&, u&, v&
x = Sheets("Sheet1").Range("A2").CurrentRegion.Value
ReDim y(1 To UBound(x) * (UBound(x, 2) - 3), 1 To 2): k = 2: n = 1
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 2 To UBound(x)
If .Exists(x(i, 3)) Then
v = .Item(x(i, 3))
Else
k = k + 1: .Item(x(i, 3)) = k: v = k
If k > UBound(y, 2) Then ReDim Preserve y(1 To UBound(y), 1 To k)
y(1, v) = x(i, 3)
End If
For j = 4 To UBound(x, 2)
If IsNumeric(x(i, j)) Then
If Not .Exists(x(i, 1) & x(1, j)) Then
n = n + 1: .Item(x(i, 1) & x(1, j)) = n: u = n
y(u, 1) = Val(x(i, 1)): y(u, 2) = x(1, j)
Else
u = .Item(x(i, 1) & x(1, j))
End If
y(u, v) = x(i, j)
End If
Next j
Next i
End With
y(1, 1) = "Agent": y(1, 2) = "Date"
With Sheets("Sheet2").Range("A1")
.CurrentRegion.ClearContents: .Resize(n, k).Value = y()
End With
End Sub
You can add as many statistical indicators, as needed
PS you have an excellent Russian-English language
Bookmarks