+ Reply to Thread
Results 1 to 7 of 7

Counting words in multiple sentences

  1. #1
    Forum Contributor
    Join Date
    05-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    145

    Counting words in multiple sentences

    Hi all,
    Please look at the 2 files attached - "lice" and "lice_desired_results".
    "lice" has a single column with sentences (simple text).
    I need a macro that will count each and every word in all sentences and write in columns B and C the total amount of times that each word appear in all sentences (please see the file "lice_desired_results" to see what I mean.)

    Please note:
    1. I need a macro based solution, NOT A FORMULA.
    2. the solution should not be case sensitive, Lice=lice and so on....

    Thanks,
    Sami
    Attached Files Attached Files
    Last edited by sami770; 11-16-2014 at 09:34 AM.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Counting words in multiple sentences

    Try this for results in columns "B" & " C".
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Forum Contributor
    Join Date
    05-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    145

    Re: Counting words in multiple sentences

    Thanks for the nice macro, Mick.
    It does the job!
    When I looked at the results I realized that it will be a lot more useful if:

    1. The macro will filter out the question mark sign (?)
    at the moment LICE and LICE? are counted as two different words, I need to remove the ? sign from the calculations and count the total amount of instances of each word into a single result.
    2. there are 29 words that needs to be excluded from the results, see text file attached.

    Thanks again,
    Sami


    Quote Originally Posted by MickG View Post
    Try this for results in columns "B" & " C".
    Please Login or Register  to view this content.
    Regards Mick
    Attached Files Attached Files

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Counting words in multiple sentences

    Try this:-
    Nb:- Add to "Excluded" words list as required.
    Please Login or Register  to view this content.
    Regards Mick
    Last edited by MickG; 11-16-2014 at 11:33 AM.

  5. #5
    Forum Contributor
    Join Date
    05-10-2011
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    145

    Re: Counting words in multiple sentences

    BINGO!
    Thanks a lot, Mick!
    Sami

    Quote Originally Posted by MickG View Post
    Try this:-
    Nb:- Add to "Excluded" words list as required.
    Please Login or Register  to view this content.
    Regards Mick

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Counting words in multiple sentences

    You're welcome

  7. #7
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Counting words in multiple sentences

    Try this modified code , I'm afraid it was my Fault again another typo in last line.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Search box in Excel to search key words in sentences in multiple worksheets
    By fernandoii676 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-05-2012, 01:42 PM
  2. Replies: 2
    Last Post: 10-19-2012, 11:11 AM
  3. List out words from sentences
    By ap_naveen in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-21-2010, 06:58 AM
  4. Split sentences into words
    By sparx in forum Excel General
    Replies: 5
    Last Post: 02-22-2006, 03:51 PM
  5. counting specific words:unique sentences
    By jen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-24-2005, 08:05 PM

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