Count number of words in a string....

AndyD

Active Member
Joined
Nov 14, 2002
Messages
449
hi
if can help with this would be appreciated

need to be able to count the number of words in a string

eg
if cell A1 = "Hello there"..returns 2
if cell A1 = "Hello there my friend"..returns 4

etc
thanks
A
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
AndyD said:
hi
if can help with this would be appreciated

need to be able to count the number of words in a string

eg
if cell A1 = "Hello there"..returns 2
if cell A1 = "Hello there my friend"..returns 4

etc
thanks
A

Using Morefunc Add-in,

=WORDCOUNT(A1)
Book1
ABCD
1Hellothere2
2Hellotheremyfriend4
Sheet1
 
Upvote 0
also need to able to abbreviate words in a string

for example i need to abbreviate

London South East as "London SE"

London South West as "London SW"

London South as "London S" etc

Thanks
A
 
Upvote 0
AndyD said:
also need to able to abbreviate words in a string

for example i need to abbreviate

London South East as "London SE"

London South West as "London SW"

London South as "London S" etc

Thanks
A

Since Brian has already goaded you to invoke a function from the morefunc add-in, we might continue using it for the above query as well...
Book9
ABCD
1
2LondonSouthEastLondonSESouthEast
3LondonSouthWestLondonSWSouthWest
4LondonSouthLondonSSouth 
Sheet1


Formulas...

B2:

=WMID($A2,COLUMN()-COLUMN($B$2)+1,1)&" "&UPPER(LEFT(C2)&LEFT(D2))

C2, which must be copied across:

=WMID($A2,COLUMN()-COLUMN($B$2)+1,1)

Select B2:D2 and copy down.

Note that the formula in B2 assumes a string of 3 words at most, but, if needed, the formula generalized for longer input strings.
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,846
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top