Finding duplicate text in a single column containing multiple words in each cell

helpmeob1wan

New Member
Joined
Aug 27, 2018
Messages
1
I have a spreadsheet with authors of articles in one column. Many of the authors have several entries, and there are 100 rows total.

For example

[ Author t, Author u, Author v]
[ Author x, Author Y, Author z]
[ Author A, Author b, author x]

I have to find out how many times the authors are repeated i.e. how many authors wrote more than one article in the list. One way to do it is to manually go through each name 'CTRL + F' it and see how many other times it appears in the sheet.

Is there any automated way I can do this that will save me time?

Thanks for any help in advance.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi helpmeob1wan,

Welcome to the MrExcel board.

See if this comes close to doing what you want. This is assuming that you are showing the brackets [] strictly to represent that those values appear in a single cell and are not part of the actual data. Also the code is assuming that your data is starting on row 1.

Code:
Sub AuthorCt()


    Dim Lines As Variant, uLines As Variant
    Dim lRow As Long, x As Long, i As Long, ct As Double
    Dim alls As String, str As String
    
    lRow = Cells(Rows.Count, 1).End(xlUp).Row
    For i = 1 To lRow
        alls = alls & "," & Range("A" & i) & ", "
    Next
    alls = Mid(alls, 2)
    alls = Replace(alls, ", ,", ", ")
    Lines = Split(alls, ", ")
    
    With CreateObject("Scripting.Dictionary")
    For x = LBound(Lines) To UBound(Lines) - 1
        If Not IsMissing(Lines(x)) Then .Item(Lines(x)) = 1
    Next
    uLines = .Keys
    End With
    
    For i = LBound(uLines) To UBound(uLines)
        For x = LBound(Lines) To UBound(Lines)
            If uLines(i) = Lines(x) Then
                ct = ct + 1
            End If
        Next
        str = str & vbNewLine & uLines(i) & " was found " & ct & " times."
        ct = 0
    Next
    str = Mid(str, 2)
    MsgBox str
    
End Sub
 
Upvote 0
Hi,

You can do Text to Columns to separate the Text string using the , (comma) as delimiter, then build a list with All Authors, then use COUNTIF.

Or, without Text to Columns, build a list with All Authors and use COUNTIF with Wildcards.
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,785
Members
449,095
Latest member
m_smith_solihull

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