Hi. I am trying to get this code to work but when I run it to str1, I get Subscript out of range. I need this code to run very efficiently so I used a variant instead of looping through all cells. I have ~ 300k rows and this same operation was difficult for me to do in access.
The code essentially saves a column as variant, and calculates a proportion with 1 / (Number of times that string matches all others) in the next column's cell over. Hope you can see what I am trying to do. Also please disregard any error "cant divide by zero". Thanks in advance!
Dim compare As Variant
Dim i As Long
Dim count As Long
Dim str1, str2 As String
compare = Sheets("Raw Data Stacked").Range("data[[#data],[Column1]:[Column1]]").Value
For i = LBound(compare) To UBound(compare)
For j = LBound(compare) To UBound(compare)
str1 = Join(compare(i), "")
str2 = Join(compare(j), "")
If str1 = str2 Then
count = count + 1
End If
Next j
Cells(i + 1, 21) = 1 / count
count = 0
Next i
Bookmarks