Consulting

Results 1 to 8 of 8

Thread: Solved: Count occurrence or particular keyword within Excel

  1. #1

    Solved: Count occurrence or particular keyword within Excel

    Hello,

    Wondering if someone would be kind to point me in the right direction and/or help me with:

    How to display exact count of particular keywords (words that I would like to specify) and search against the worksheet. Column that needs to be searched contains a lot of characters (words) per cell. (can be 100 plus words). Count result should display data next to its appropriate cell.



    how to display data how (result would be 2 if I specify search keyword "how")

    how to how data how how (result would be 4 if I specify search keyword "how")

    to search data for (result would be 0...)

    --------

    Thank a lot!

  2. #2

    Example attached!

    Example worksheet with what I would like to acomplish is attached!


  3. #3
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Hi daemonskin1,

    Welcome to VBAX!

    The difficulty with this is the definition of a word. Excel really isn't geared to text processing. Finding the character string "how" is easy enough but distinguishing it from, say, "show" or "howl" is quite a lot harder.

    If it helps, to find the count of strings (delimited anyhow) ..

    (in your example) add this formula to D2 and copy down:

    =(LEN(A2)-LEN(SUBSTITUTE(A2,D$1,"")))/LEN(D$1)

    Then in D1, enter your search term, e.g. how
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  4. #4
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Pretty nice Tony

    How could you make it to not be case-sensitive??




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  5. #5
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Hi Joseph,

    This should do it ...

    =(LEN(A2)-LEN(SUBSTITUTE(UPPER(A2),UPPER(D$1),"")))/LEN(D$1)
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  6. #6
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Awesome

    Nice Tony




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  7. #7
    Very nice Solution TonnyJolans! Thank you kindly for the quick response. : )

    Since I was previously looking at the "FindWord" solution (as posted on the kb) I would like as well to enhance that code to automate this feature as well.

    That is, to automatically populate column C (within FindWord tab) with the count of words occurrences as stated on "Search Criteria Input" form.

  8. #8
    In the meantime let me mark this thread solved!

Posting Permissions

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