michal95nh
New Member
- Joined
- Apr 1, 2019
- Messages
- 3
Hello, I need help.
I found on this forum an amazing macro.
https://www.mrexcel.com/forum/excel-questions/873686-find-keyword-density-rows-columns.html
but I don't know how to change for show me per row A results in column B .
A2 -> B2
A3 -> B3
etc.
I found on this forum an amazing macro.
https://www.mrexcel.com/forum/excel-questions/873686-find-keyword-density-rows-columns.html
HTML:
Sub MG11Aug55Dim Rng As Range, Dn As Range, n As Long, sp As Variant, omax As Long, R As Variant
Dim K As Variant, Str As String, Lg, NoStr As String
NoStr = "#cat#dog#the#" ' Alter/Add words not to include here !!!!
Set Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
sp = Split(Dn.Value, " ")
For Each R In sp
If Not R = vbNullString And InStr(NoStr, "#" & R & "#") = 0 Then
If Not .Exists(R) Then
.Add R, 1
Else
.Item(R) = .Item(R) + 1
End If
End If
Next R
Next Dn
Lg = Application.Large(.items, 1) ' Change the "1" to 2,3-- for second and third largest
For Each K In .keys
If .Item(K) = Lg Then
Str = Str & K & ", "
End If
Next K
End With
Range("B1") = Left(Str, Len(Str) - 2)
Range("C1") = "Count= " & Lg End Sub
A2 -> B2
A3 -> B3
etc.