Akuini

VBA Macro to create Word & Phrase Frequency

@CarolynV, welcome to MrExcel.
However, is there a way to limit it from running into the next cell in the column when counting occurences of phrases?
Run this following macro "Sub add_end_of_line".
VBA Code:
Sub add_end_of_line()
'this will add a dot at the end of every cell value.
Dim va
Dim i As Long
va = Range("A1", Cells(Rows.Count, "A").End(xlUp))
For i = 1 To UBound(va, 1)
    va(i, 1) = va(i, 1) & "."
Next
Range("A1").Resize(UBound(va, 1), 1) = va
End Sub
It will append a dot to the end of each cell value, thereby restricting a phrase to include only the value from a single cell.
After that, run "Sub Word_Phrase_Frequency_v1".
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
@CarolynV
Using your example, here's the result:
dhee - Macro to create Word & Phrase Frequency 1.xlsm
ABCDEFG
1faulty replacement required.3 WORDCOUNT4 WORDCOUNT
2replacement item ordered.faulty replacement required1item sent to customer1
3Loan item sent to customer.item sent to1Loan item sent to1
4Loan item sent1
5replacement item ordered1
6sent to customer1
Sheet1
 
@CarolynV
Using your example, here's the result:
dhee - Macro to create Word & Phrase Frequency 1.xlsm
ABCDEFG
1faulty replacement required.3 WORDCOUNT4 WORDCOUNT
2replacement item ordered.faulty replacement required1item sent to customer1
3Loan item sent to customer.item sent to1Loan item sent to1
4Loan item sent1
5replacement item ordered1
6sent to customer1
Sheet1
Absolutely amazing. Thank you so much.
 

Forum statistics

Threads
1,223,958
Messages
6,175,635
Members
452,661
Latest member
Nonhle

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