+ Reply to Thread
Results 1 to 7 of 7

counting words within cells

  1. #1
    Registered User
    Join Date
    09-01-2006
    Posts
    2

    counting words within cells

    hi,

    in excel i have a huge list of country names

    eg.

    A1: Austria, Italy, Sweden, France, Spain UK, Japan, USA
    A2: France, Spain, Austria, Italy, UK, Germany, Sweden, Norway, Netherlands
    ...
    A450

    Instead of the country names, I need to know how many countries are in each cell

    eg.

    A1: 8
    A2: 9

    Is there a formula for this?

    Thanks for the help

    Mel

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Thumbs up

    Quote Originally Posted by melanie-h
    hi,

    in excel i have a huge list of country names

    eg.

    A1: Austria, Italy, Sweden, France, Spain UK, Japan, USA
    A2: France, Spain, Austria, Italy, UK, Germany, Sweden, Norway, Netherlands
    ...
    A450

    Instead of the country names, I need to know how many countries are in each cell

    eg.

    A1: 8
    A2: 9

    Is there a formula for this?

    Thanks for the help

    Mel
    Hi melanie-h,

    Try this in A2, then copy down

    =FIND(", ",A1,1)+1

    this assumes that each one is separated by a "," and a space

    oldchippy

  3. #3
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Quote Originally Posted by oldchippy
    Hi melanie-h,

    Try this in A2, then copy down

    =FIND(", ",A1,1)+1

    this assumes that each one is separated by a "," and a space

    oldchippy
    oldchippy, FIND function will not count number of occurences of any character, it simply returns position of character.

  4. #4
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Quote Originally Posted by melanie-h
    hi,

    in excel i have a huge list of country names

    eg.

    A1: Austria, Italy, Sweden, France, Spain UK, Japan, USA
    A2: France, Spain, Austria, Italy, UK, Germany, Sweden, Norway, Netherlands
    ...
    A450

    Instead of the country names, I need to know how many countries are in each cell

    eg.

    A1: 8
    A2: 9

    Is there a formula for this?

    Thanks for the help

    Mel
    Hi melanie

    try this
    if your data is in cell A1 then
    =LEN(A1)-LEN(SUBSTITUTE(A1,",",""))-1
    this assumes that you have country name each seperated by a comma.

    hope this would serve your purpose.
    Regards

  5. #5
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    Melanie,

    You could download Laurent Longre's free Morefunc addin which includes the formula WORDCOUNT.

    =WORDCOUNT(A1,","&" ")

    Where A1 is your text and the ","&" " are your text separators. There are a lot of other very useful functions with the addin.


    HTH

    Steve
    http://www.rhdatasolutions.com/morefunc/

  6. #6
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    Melanie,

    If you don't want or can't download the Morefunc addin you could use this formula instead:

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

    This assumes that all words are separated by a space whether or not there is a comma.


    HTH

    Steve

  7. #7
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Quote Originally Posted by oldchippy
    Hi melanie-h,

    Try this in A2, then copy down

    =FIND(", ",A1,1)+1

    this assumes that each one is separated by a "," and a space

    oldchippy
    Your right, I'll go back to sleep now

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1