+ Reply to Thread
Results 1 to 12 of 12

count # of times word appears in dataset based also on another columns additional value

  1. #1
    Registered User
    Join Date
    03-20-2011
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2010
    Posts
    27

    count # of times word appears in dataset based also on another columns additional value

    Hi,

    I am trying to find a solution that will provide me with the number of times a certain word is present in a data set, "dog" for example, but only if another specific criteria is met. I also would like to be able to input the the word and additional criteria into cells that will be referenced by the formula to return the result. Example: if column B has data and I type into my reference cell D2 "dog" and the date 2/1/2016 into reference cell E2, and dog appears 6 times in column B, but column C only has two February dates, i want to return the number of times that dog appeared in February of 2016 only (example 3 times). I have used the formula below to find the total number but can not figure out a way to add the additional criteria. Any help would be greatly appreciated. Thanks,

    SUMPRODUCT((LEN(UPPER($B$2:$B$8))-LEN(SUBSTITUTE(UPPER($B$2:$B$8),UPPER($E2),"")))/LEN(UPPER($E2)))
    Attached Files Attached Files
    Last edited by IZAKK; 10-13-2016 at 12:48 PM.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: count # of times word appears in dataset based also on another columns additional valu

    Many members are unable to see images in the *.png format due to forum compatibility issues with some browsers.

    If you need to post an image post it in the *.jpg format.

    Even better than posting images... post a SMALL sample file. That way we can test solutions directly in the file with the relevant data.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    03-20-2011
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: count # of times word appears in dataset based also on another columns additional valu

    Thanks Tony! I have uploaded a small file as you suggested. I added it to my original post.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: count # of times word appears in dataset based also on another columns additional valu

    This array formula** seems to do what I think you're asking for...

    =SUM(IF(MONTH($A$2:$A$8)=MONTH($F2),(LEN(UPPER($B$2:$B$8))-LEN(SUBSTITUTE(UPPER($B$2:$B$8),UPPER($E2),"")))/LEN(UPPER($E2))))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  5. #5
    Registered User
    Join Date
    03-20-2011
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: count # of times word appears in dataset based also on another columns additional valu

    Thanks Tony! The formula did work but it does not eliminate entries with a different year (ex: 2015 vs 2106 data). This log will contain multi year data. Is there a way to also specify the year along with the month? Thanks Again!

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: count # of times word appears in dataset based also on another columns additional valu

    Like this...

    =SUM(IF(TEXT($A$2:$A$8,"mmmyyyy")=TEXT($F2,"mmmyyyy"),(LEN(UPPER($B$2:$B$8))-LEN(SUBSTITUTE(UPPER($B$2:$B$8),UPPER($E2),"")))/LEN(UPPER($E2))))

    Still array entered.

  7. #7
    Registered User
    Join Date
    03-20-2011
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: count # of times word appears in dataset based also on another columns additional valu

    Wow! Yes, that worked great! Thanks so much for all your help!

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: count # of times word appears in dataset based also on another columns additional valu

    You're welcome. Thanks for the feedback!

  9. #9
    Registered User
    Join Date
    03-20-2011
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: count # of times word appears in dataset based also on another columns additional valu

    Sorry, I have another question. When i tried to use the formula in my actual sheet I found that I needed it to work a bit differently. I need it to result for a word based on the Year and Quarter not really the date. I tried to change the formula with an AND statement myself but it is not working. Could you help me out with this? I have attached a small file again for reference. Thanks
    Attached Files Attached Files

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: count # of times word appears in dataset based also on another columns additional valu

    Like this...

    =SUM(IF($C$2:$C$8=$F2,IF($D$2:$D$8=$G2,(LEN(UPPER($B$2:$B$8))-LEN(SUBSTITUTE(UPPER($B$2:$B$8),UPPER($E2),"")))/LEN(UPPER($E2)))))

    Still array entered.

  11. #11
    Registered User
    Join Date
    03-20-2011
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: count # of times word appears in dataset based also on another columns additional valu

    Awesome! That is perfect! Thanks again Tony!

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: count # of times word appears in dataset based also on another columns additional valu

    You're welcome!

+ 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] count number of times a word appears
    By m_789 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-19-2013, 10:16 AM
  2. Replies: 3
    Last Post: 04-26-2013, 01:21 PM
  3. [SOLVED] formula to count how many times a word appears in a row for a date
    By Megatronixs in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-27-2012, 03:57 AM
  4. [SOLVED] Count how many times certain word appears in column
    By micko_escalade in forum Excel General
    Replies: 4
    Last Post: 08-16-2012, 07:55 PM
  5. [SOLVED] How to highlight (not count) a word that appears in an Excel Worksheet multiple times
    By rmason in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-01-2012, 08:43 AM
  6. Replies: 2
    Last Post: 12-09-2009, 06:36 AM
  7. count the number of times a specific word appears in a column
    By BAR in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2006, 12:10 PM
  8. Replies: 5
    Last Post: 04-16-2005, 11:07 AM

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