Word counting in Excel

B

Bob Phillips

It's got spaces after a couple of the SUBSTITUTE functions. Try this

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

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
P

Peo Sjoblom

It can be shortened to

=LEN(TRIM(A1))-LEN(TRIM(SUBSTITUTE(SUBSTITUTE(A1,CHAR(10)," "),"
","")))+(A1<>"")


I don't see the first

LEN(TRIM(SUBSTITUTE(A1,CHAR(10)," ")))

as necessary, it is just to guard if someone puts a space and then a line
break
but who would do that?
 

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