+ Reply to Thread
Results 1 to 7 of 7

sum the occurence of specified words (stored in array) in a string

  1. #1
    Registered User
    Join Date
    05-22-2019
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    9

    sum the occurence of specified words (stored in array) in a string

    Dear Forum,

    I have the following issue: I would like to sum or count the occurences of specific words in a string (no case sensitive). In the example below column A contains the words that need to be found in cell B1. Here, the result would be 2 since the strings "Hello" and "Rum" are in the string "Hello_ExcelForum"; the string "Ghost" is not within B1 and the empy cell (A4) should neither not be counted. I tried the formula IF(SUMPRODUCT(--ISNUMBER(SEARCH(A1;B1)))>0=TRUE;1;0), which only works for the first cell in column A, however I cannot extend it to the whole Array A1:A4.

    I really appreciate your halp and many thanks for your Support with this!

    All the best,
    mag2


    A B
    1 Hello Hello_ExcelForum
    2 Rum
    3 Ghost
    4
    Last edited by Mag2; 06-02-2019 at 11:58 AM.

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: sum the occurence of specified words (stored in array) in a string

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: sum the occurence of specified words (stored in array) in a string

    What would happen with B1 being "Hello Yellow" and the search word is "ello"? What should the answer be?
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    05-22-2019
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    9

    Re: sum the occurence of specified words (stored in array) in a string

    Hello,
    thanks for your reply!

    Fluff13: Yes, the Problem is when I remove one item from Column A (and don't adjust the length of the Array) it will count the empy cells as well (I have adjusted my question accordingly now)

    MarvinP: The formula should count the word only once, i.e. if the search words were only Hello and ello within "hello Yellow", it should return 1. But I think I will acoount for that in the Input/Column A, so no need to worry about that for now

    Best

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: sum the occurence of specified words (stored in array) in a string

    In that case how about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-22-2019
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    9

    Re: sum the occurence of specified words (stored in array) in a string

    Hello,

    yes, that did the trick. Thank you very much for your time and effort!

    Best regards,

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: sum the occurence of specified words (stored in array) in a string

    You're welcome & thanks for the feedback

+ 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] Formula - Find if any part of string matches an array of words
    By benoj2005 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-28-2018, 07:51 AM
  2. [SOLVED] VBA to count stored array string in range
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-25-2017, 09:16 AM
  3. Search/Find for multiple words stored in an array for a worksheet
    By freshie1001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2016, 06:00 AM
  4. match string in column with array of words
    By bkdimri in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-16-2013, 04:28 AM
  5. How to delete block of elements from stored VBA array string
    By nuttyengineer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2013, 07:06 PM
  6. Replies: 5
    Last Post: 12-22-2011, 11:29 PM
  7. Remove word(s) from string beginning with words from this array
    By agf12555 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-22-2011, 12:28 PM

Tags for this Thread

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