hi, how can I do wordcount in Excel?

M

Marketa

hi,doers anyone know how to do wordcount in Excel? I appreciate your help,
Manz thanks, Marketa
 
D

Dave Curtis

Hi,

Try this code from Chip Pearson's page.

Sub CountWords()
Dim WordCount As Long
Dim Rng As Range
Dim S As String
Dim N As Long
For Each Rng In ActiveSheet.UsedRange.Cells
S = Application.WorksheetFunction.Trim(Rng.Text)
N = 0
If S <> vbNullString Then
N = Len(S) - Len(Replace(S, " ", "")) + 1
End If
WordCount = WordCount + N
Next Rng
MsgBox "Words In ActiveSheet Sheet: " & Format(WordCount,"#,##0")
End Sub


Dave
 
D

Dave Curtis

Or you can use the following formula to count the words in a range:

=SUM(LEN(A1:F10))-SUM(LEN(SUBSTITUTE(A1:F10," ","")))+COUNTA(A1:F10)

entered as an array formula with Control-Shift-Enter.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top