ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   counting number of word in a cell (https://www.excelbanter.com/excel-discussion-misc-queries/258364-counting-number-word-cell.html)

kokhong

counting number of word in a cell
 
is there a function can count number of word in a cell

example:

A B
username count
kok, hong, Lee
chan, NG
Ti, Lee

after counting
A B
username count
kok, hong, Lee 3
chan, NG 2
Ti, Lee 2

T. Valko

counting number of word in a cell
 
You can count the number of spaces in the cell then add 1:

=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1

--
Biff
Microsoft Excel MVP


"kokhong" wrote in message
...
is there a function can count number of word in a cell

example:

A B
username count
kok, hong, Lee
chan, NG
Ti, Lee

after counting
A B
username count
kok, hong, Lee 3
chan, NG 2
Ti, Lee 2




kokhong

counting number of word in a cell
 
this problem i have settled..this can be found form MIscrosoft help..
the function is :
=IF(LEN(TRIM(A1))=0,0,LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1)

"kokhong" wrote:

is there a function can count number of word in a cell

example:

A B
username count
kok, hong, Lee
chan, NG
Ti, Lee

after counting
A B
username count
kok, hong, Lee 3
chan, NG 2
Ti, Lee 2


מיכאל (מיקי) אבידן

counting number of word in a cell
 
Using Trim is a very good idea because, accidently, there might have been
typed more than one space between two words.
Micky


"kokhong" wrote:

this problem i have settled..this can be found form MIscrosoft help..
the function is :
=IF(LEN(TRIM(A1))=0,0,LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1)

"kokhong" wrote:

is there a function can count number of word in a cell

example:

A B
username count
kok, hong, Lee
chan, NG
Ti, Lee

after counting
A B
username count
kok, hong, Lee 3
chan, NG 2
Ti, Lee 2


Dave Peterson

counting number of word in a cell
 
One more that will work ok if the cell is empty:

If the words are separated by spaces:
=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+(TRIM(A1)<"")

kokhong wrote:

is there a function can count number of word in a cell

example:

A B
username count
kok, hong, Lee
chan, NG
Ti, Lee

after counting
A B
username count
kok, hong, Lee 3
chan, NG 2
Ti, Lee 2


--

Dave Peterson


All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com