How do I get a word count in Excel XP

  • Thread starter Thread starter Guest
  • Start date Start date
Excel doesn't have a built-in word counter. You'd have to loop
through each cell, determine how many words in each cell, and sum
these. For example,

Sub AAA()
Dim WordCount As Long
Dim Rng As Range
Dim S As String
Dim N As Long
For Each Rng In ActiveSheet.UsedRange.Cells
S = Rng.Text
N = 0
If S <> "" Then
N = Len(S) - Len(Replace(S, " ", "")) + 1
End If
WordCount = WordCount + N
Next Rng
MsgBox WordCount
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Chip,

This is very cool! Is there a way to set this up for "active cell" only? I
am doing an Request for Proposal response with a 100 word per answer limit. I
suspect our customer is using Excel to align question responses in columns
form multiple vendors. I want to make sure none of my responses exceed the
limit but would rather not count by hand or cut and paste each question (78)
into word.

Thanks in advance.

Paul
 
You could use a worksheet formula in a cell right next to your input cell to see
the results for that cell:

Something like:

=IF(A1="",0,LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1)

====
But you could change one line in Chip's routine to work against the activecell:

For Each Rng In ActiveSheet.UsedRange.Cells
becomes
For Each Rng In ActiveCell.Cells
 
hi nadine
(is it nadine F? you a Greek translator? maybe i know you!)

as another poster said, indeed, excel is set up for numbers, not words. yet
in the translation business, people use it for questionnaires and other
applications that need summary results/responses tabulated.

the easiest way i have come up with for an excel wordcount by selected
columns (not by the entire spreadsheet) is this:

1. open a new word document.
2. go back to the excel sheet you're working with.
3. select entire target column by clicking its top header (A, B, C ,...).
column turns gray and the dotted frame starts blinking.
3. copy it (Ctl+C).
4. return to word document and paste the target column (Ctl+V) there.
5. switch back to excel and do the same with the rest of the
tabs/spreadsheets listed at bottom of page, copying and pasting your target
columns back into word document.
6. when done, click on MS Word's wordcount feature (Tools>Wordcount) to get
the total wordcount.

good luck
Mike
 
Back
Top