Finding most common words in column WITHOUT specifying what words

echrist

New Member
Joined
Mar 5, 2013
Messages
4
Hey everyone. We're doing some restructuring of our programs at my organization, and I'm trying to make a list of what is considered most important to our clients based on their feedback. We enter their questionnaire responses into Excel regularly, but there are thousands of responses. I'm trying to make a list of what words appear most frequently without going through one by one and making a list of keywords.
Without keywords, I haven't been able to find anything on the subject. As an additional hurdle, the responses are written in sentence form (there will be ~10-15 words in each response).
For example:

I want to eat more pizza.
Make your program longer.
I wish we could eat more meals.

Obviously these are made up, but the hope is that "I," "eat," etc. are returned at the top of a list of most used words.
Is this possible?
Thanks in advance!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
to answer your question simply - yes it's possible. Whether the amount of time needed to put into it is worthwhile or affordable for your situation are different conversations.

Directionally how I would do it is to parse out each cell onto a new worksheet - put each word into a new cell, then you can do a pivot table to give you counts of the words, then sort the pivot table. There may be other ways to do it, that is just one that pops into my head up front.
 
Upvote 0
Hello, I tried using the spreadsheet Andrew posted and am running into a problem. I receive an error message when I try to run it that says "Run-time error '1004': 'MethodCreatePivotTable' of object 'PivotCache' failed". If I hit "end" or "debug" I get the same response--a new sheet appears with all of the words spread out (no more punctuation) in individual cells, but there isn't anything showing how many times each appears. I then need to go to the "run" tab and hit "continue" in order to try it again. The result is, however, always the same. Is there an update to this, or can anyone help? I'm running it on a Mac excel v 14.5.1.

A little more info in case it's helpful: this spreadsheet has multiple words in each cell, and I'd like to have a list of the words with how many times each occurs, in order of occurrence.

Thank you!
 
Upvote 0
Hi, this is awesome! I am wondering if there is a way to do this, and ADD a few words found on BOTH SIDES of the the words found... would that be possible somehow? (My guess is yes, but... how?)

I hope someone sees this. THIS combined with the earlier solution posted here, would be magic! Thank you -- Mr Excel experts never fail ! :)
 
Upvote 0
That site no longer exists, so there is no uptodate link
 
Upvote 0
Hi, the link is not opening. Can you please share a latest reference for this one, please? Thanks much! :)

I had the same question. But since the site no longer exists (as Fluff stated), is there anything current that we can use for this kind of problem (similar to what was in the referenced link)?
 
Upvote 0
I had the same question. But since the site no longer exists (as Fluff stated), is there anything current that we can use for this kind of problem (similar to what was in the referenced link)?

Here's a code to get words frequency.
Put the data in col A, run the code, the result is in col D:E.

Note: You need to add the reference “Microsoft Forms 2.0 Object Library” (to work with clipboard)
And this is how:
1. Open your VBA editor.
2. Click Tools > References.
3. Check the box next to “Microsoft Forms 2.0 Object Library.”

Code:
[FONT=Lucida Console][COLOR=Royalblue]Sub[/COLOR] regexWordFrequency1()
[I][COLOR=Dimgray]'word frequency[/COLOR][/I]
[I][COLOR=Dimgray]'Put the data in col A, run the code, the result is in col D:E.[/COLOR][/I]

[COLOR=Royalblue]Dim[/COLOR] regEx [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Object[/COLOR], matches [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Object[/COLOR], x [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Object[/COLOR], d [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]Object[/COLOR]
[COLOR=Royalblue]Dim[/COLOR] obj [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]New[/COLOR] DataObject
[COLOR=Royalblue]Dim[/COLOR] tx [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]String[/COLOR], z [COLOR=Royalblue]As[/COLOR] [COLOR=Royalblue]String[/COLOR]


Range([COLOR=Darkcyan]"A1"[/COLOR], Cells(Rows.count, [COLOR=Darkcyan]"A"[/COLOR]).[COLOR=Royalblue]End[/COLOR](xlUp)).Copy
obj.GetFromClipboard
tx = obj.GetText
Application.CutCopyMode = False
tx = Replace(tx, [COLOR=Darkcyan]"'"[/COLOR], [COLOR=Darkcyan]"___"[/COLOR])
    
        [COLOR=Royalblue]Set[/COLOR] regEx = CreateObject([COLOR=Darkcyan]"VBScript.RegExp"[/COLOR])
        [COLOR=Royalblue]With[/COLOR] regEx
            .[COLOR=Royalblue]Global[/COLOR] = True
            .MultiLine = True
            .IgnoreCase = True
            .pattern = [COLOR=Darkcyan]"\w+"[/COLOR]
        [COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]With[/COLOR]

    [COLOR=Royalblue]Set[/COLOR] d = CreateObject([COLOR=Darkcyan]"scripting.dictionary"[/COLOR])
    d.CompareMode = vbTextCompare
        
            [COLOR=Royalblue]Set[/COLOR] matches = regEx.Execute(tx)
            
            [COLOR=Royalblue]For[/COLOR] [COLOR=Royalblue]Each[/COLOR] x In matches
                z = [COLOR=Royalblue]CStr[/COLOR](x)
                [COLOR=Royalblue]If[/COLOR] [COLOR=Royalblue]Not[/COLOR] d.Exists(z) [COLOR=Royalblue]Then[/COLOR]
                    d(z) = [COLOR=Brown]1[/COLOR]
                [COLOR=Royalblue]Else[/COLOR]
                    d(z) = d(z) + [COLOR=Brown]1[/COLOR]
                [COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]If[/COLOR]
            [COLOR=Royalblue]Next[/COLOR]
                
[COLOR=Royalblue]If[/COLOR] d.count = [COLOR=Brown]0[/COLOR] [COLOR=Royalblue]Then[/COLOR] MsgBox [COLOR=Darkcyan]"[COLOR=Royalblue]Nothing[/COLOR] found"[/COLOR]: [COLOR=Royalblue]Exit[/COLOR] [COLOR=Royalblue]Sub[/COLOR]
Range([COLOR=Darkcyan]"D:E"[/COLOR]).ClearContents

[I][COLOR=Dimgray]'put the result in col D:E[/COLOR][/I]
    [COLOR=Royalblue]With[/COLOR] Range([COLOR=Darkcyan]"D1"[/COLOR]).Resize(d.count, [COLOR=Brown]2[/COLOR])
    .Cells = Application.Transpose(Array(d.Keys, d.items))
    .Replace What:=[COLOR=Darkcyan]"___"[/COLOR], Replacement:=[COLOR=Darkcyan]"'"[/COLOR], LookAt:=xlPart, SearchFormat:=False, ReplaceFormat:=False
    [COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]With[/COLOR]

[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]Sub[/COLOR][/FONT]

Example:

Excel 2013 32 bit
A
B
C
D
E
1
You and I, why?You
2​
2
I understand, but why you?and
1​
3
I don't understand what you're sayingI
3​
4
why
2​
5
understand
2​
6
but
1​
7
don't
1​
8
what
1​
9
you're
1​
10
saying
1​

<tbody>
</tbody>
Sheet: Sheet4

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,478
Members
448,967
Latest member
visheshkotha

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