hi, how can I do wordcount in Excel?

  • Thread starter Thread starter Marketa
  • Start date Start date
M

Marketa

hi,doers anyone know how to do wordcount in Excel? I appreciate your help,
Manz thanks, Marketa
 
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
 
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
 
Back
Top