How to count same words in different cells?

wonderlust

New Member
Joined
Feb 15, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I have the following problem:
+1300 rows of different names of series
+each cell contains a couple of names (e.g. A1: "Breaking Bad, Transformers, Harry Potter")
+some of the names are the same, but some are different (e.g. A2:"Harry Potter, LOTR, The Simpsons")

How can I count the number of repetative names? (e.g. "in the 1300 rows there are 200 mentions of "Harry Potter")?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
if you can split the movies using text to columns this will work
----------------------------------
Book1
ABCDEF
1movies 1movie 2movie 3moviescount
2harry potter LOTR The Simpsonsharry potter4
3harry potter breaking bad transformers LOTR2
4 The Simpsons LOTR breaking bad The Simpsons3
5 breaking bada team transformers breaking bad3
6a teamharry pottergi joe transformers2
7harry potter The Simpsonsa teama team3
8gi joe1
Sheet1
Cell Formulas
RangeFormula
E2:E8E2=INDIRECT(TEXT(MIN(IF(($A$2:$C$7<>"")*(COUNTIF($E$1:E1,$A$2:$C$7)=0),ROW($2:$7)*100+COLUMN($A:$C),7^8)),"R0C00"),)&""
F2:F8F2=IF(E2="","",COUNTIF(A:C,E2))
 
Upvote 0
Another alternative:

VBA Code:
Sub CountTitles()

    Dim i As Long, ct As Long, N As Long, a As Long, r As Long
    Dim arr, Nams, arr2
    Dim resp As String
    
    N = 1
    arr = Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
    For i = 1 To UBound(arr)
        Nams = Split(arr(i, 1), ",")
        ct = ct + UBound(Nams) + 1
    Next
    ReDim arr2(1 To ct, 1 To 1)
    i = 1
    For i = 1 To UBound(arr)
        Nams = Split(arr(i, 1), ",")
        For a = 0 To UBound(Nams)
            arr2(N, 1) = Trim(Nams(a))
            N = N + 1
        Next
    Next
    resp = InputBox("Please Enter the Title You Would Like to Count:")
    For i = LBound(arr2) To UBound(arr2)
        If Trim(UCase(arr2(i, 1))) = Trim(UCase(resp)) Then r = r + 1
    Next
    MsgBox "There are " & r & " instances of " & resp
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top