+ Reply to Thread
Results 1 to 18 of 18

how to count specific words in a cell range

  1. #1
    Registered User
    Join Date
    06-12-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2010
    Posts
    68

    how to count specific words in a cell range

    I don't know if this is a 'count' formula or not, but i want to count the number of times a specific word is displayed in a cell range.

    for example the cell range is A4:C10 and the word is 'hello'

    cheers,
    1.zer0
    Last edited by 1.zer0; 06-17-2009 at 06:35 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Help with 'count'??

    =COUNTIF(A4:C10,"hello")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    06-12-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: Help with 'count'??

    Quote Originally Posted by DonkeyOte View Post
    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    ie try to avoid using Help in your title - TIA
    apologies Donkey, i have changed the title so can you now allow the solution you blocked to be shown?

    thanks


    *beat me to it lol

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: how to count specific words in a cell range

    Yes, already done - thanks.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Help with 'count'??

    deleted prob solved

  6. #6
    Registered User
    Join Date
    06-12-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: how to count specific words in a cell range

    Thanks for your help martin

  7. #7
    Registered User
    Join Date
    06-12-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: how to count specific words in a cell range

    ok i have tried to alter it slightly to make less work in the long run but it doesn't work.

    this is my formula - =COUNTIF(HOME,B62)

    with HOME being the cell range C35:C59 and K35:K59 and cell B62 being the 'criteria' of the specific word i want to count.

    any help would be great,
    thanks

  8. #8
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    523

    Re: how to count specific words in a cell range

    This should do it:

    Please Login or Register  to view this content.
    Excel 365 user. To unblock a downloaded macro-enabled workbook, go to your "Downloads" folder > right click on the workbook name > click 'Properties' > check the 'Unblock' checkbox. You can now open the workbook.

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: how to count specific words in a cell range

    The = will make no difference I'm afraid dd.

    What is the output of your formula - an error or simply 0 ?

    If 0, is the word of interest embedded within longer strings in range HOME - ie assume word of interest remains hello, is hello listed on it's own in range HOME or is it embedded ie, "hello, what is your name?" ... if so you will need to think of using wildcards (not 100% watertight but may suffice here)

  10. #10
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    523

    Re: how to count specific words in a cell range

    Sorry- I didn't spot that it's a non-contiguous range.....

    If you want to count the occurrence of a word (not a word embedded in a string as in "hello, there") contained in non-contiguous ranges, you could name each non-contiguous range separately and then use a variation of my suggested formula as follows:

    Please Login or Register  to view this content.
    where home 1 & home2 refer to your ranges and b62 contains the word you are counting.

    As DonkeyOte pointed out, howeve, it only works if the word is 'standalone' rather than part of a sentence.
    Last edited by deadlyduck; 06-17-2009 at 07:09 AM. Reason: Update formula for non-contiguous ranges

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: how to count specific words in a cell range

    nor did I for that matter which means COUNTIF won't work anyway, my point was that the = isn't required in the COUNTIF... you only need to use the operator for <,<=,>=,> type tests.

  12. #12
    Registered User
    Join Date
    06-12-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: how to count specific words in a cell range

    the cell i refer to B62 is only the word 'hello' and no it isnt in the range.

    yes it "error's" rather than 0.

  13. #13
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: how to count specific words in a cell range

    OK, we need to go back a bit given the non-contiguous range... could the criteria value appear within the range D35:J59 ? If not just use C35:K59 as the range in the COUNTIF... if it could then you need to adopt a different approach, eg:

    =SUMPRODUCT((MOD(COLUMN(C35:K59)-3,8)=0)*(C35:K59=B62))

    EDIT: or as Martin points out just add 2 COUNTIFs together!
    (time to get some lunch obviously!)
    Last edited by DonkeyOte; 06-17-2009 at 07:17 AM.

  14. #14
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: how to count specific words in a cell range

    AS dk says countif wont work with non contiguos named ranges
    it tries to do =countif(C35:C59,K35:K59,c1) which is invalid
    try =countif(C35:C59,c1)+countif(K35:K59,c1)

  15. #15
    Registered User
    Join Date
    06-12-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: how to count specific words in a cell range

    Ok i will try to break this down because i dont really know how to give you the info you need:

    cell B62 contains the word 'hello'

    in the cell range C35:C59 AND K35:59 (which i have named range1) i want to see how many cells have the word 'hello'.

    It is like a list so all cells are basically one word. for example the list is hello, goodbye, greetings, goodbye, goodbye, hello, greetings etc. in the cell range C35:C59 AND K35:K59.

    so underneath this i want to know how many times the cell B62 (hello) occurs in that list.

    hope this is simpler to understand?!?! im confusing myself now!! lol

  16. #16
    Registered User
    Join Date
    06-12-2009
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: how to count specific words in a cell range

    Quote Originally Posted by martindwilson View Post
    AS dk says countif wont work with non contiguos named ranges
    it tries to do =countif(C35:C59,K35:K59,c1) which is invalid
    try =countif(C35:C59,c1)+countif(K35:K59,c1)
    After that huge post i just made i think this works. thanks again martin

  17. #17
    Registered User
    Join Date
    12-16-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: how to count specific words in a cell range

    The original formula mentioned in this thread only works if the word is the only one in the cell. For example, if you're counting the amount of times "apple" appears in your spreadsheet, with one word in each cell, it will find all appearances of "apple". However, if "apple" is not the first word in a cell, it won't count it. How do I count the word that way?

    Here's what I mean:

    A B C
    apple apple apple
    apple the apple apple

    In the above example, the countif(A1:C2,"apple") will result in "5". I want it to count the total of appearances ("6") regardless of where the word is in the cell.

  18. #18
    Registered User
    Join Date
    10-08-2015
    Location
    Dallas
    MS-Off Ver
    2013
    Posts
    1

    Re: how to count specific words in a cell range

    Not sure if this is still needed, but you can try:

    =Countif(A1:C2,"*Apple*")

    If you want to count multiple ranges, you can try:

    =Countif(A1:C2,"*Apple*")+Countif(A3:C3,"*Apple*")

    Hope this is still helpful.

+ 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