+ Reply to Thread
Results 1 to 6 of 6

Count occurences in each row.

  1. #1
    Registered User
    Join Date
    05-18-2014
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question Count occurences in each row.

    I'm trying to figure out a formula which will count the co-occurrence of 2 values in one row from multiple columns.

    I need to know for instance how often the name Fred and Wilma occur in the same row.

    http://i.imgur.com/N9k4iL7.png

    The image is just an example, in reality there are going to be 5 different columns and around 500 rows..
    The formula would need to check each row separately and if "Fred" or "Wilma" occurs add 1 to the total count..

    I have to admit I'm a newbie to this stuff and just really somebody to put this puzzle together. Any help would greatly be appreciated. I've tried asking on www.reddit.com/r/excel/ but I haven't gotten anywhere yet

    Please help me! lol
    Attached Images Attached Images

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: Count occurences in each row.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

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

    Re: Count occurences in each row.

    Try this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    2
    Bob
    Tom
    Lisa
    Tammy
    Wilma
    2
    3
    Fred
    Wilma
    Amy
    Ted
    Doofus
    4
    Carl
    Fred
    Tim
    Betty
    Cindy
    5
    Wilma
    Biff
    Jeff
    Don
    Fred


    This formula entered in G2:

    =SUMPRODUCT(--(MMULT((A2:E5="Fred")+(A2:E5="Wilma"),{1;1;1;1;1})=2))

    Assumes each name will not be duplicated on any row.

    The array {1;1;1;1;1} represents the number of columns you have.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    05-18-2014
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Count occurences in each row.

    Quote Originally Posted by Tony Valko View Post
    Try this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    2
    Bob
    Tom
    Lisa
    Tammy
    Wilma
    2
    3
    Fred
    Wilma
    Amy
    Ted
    Doofus
    4
    Carl
    Fred
    Tim
    Betty
    Cindy
    5
    Wilma
    Biff
    Jeff
    Don
    Fred


    This formula entered in G2:

    =SUMPRODUCT(--(MMULT((A2:E5="Fred")+(A2:E5="Wilma"),{1;1;1;1;1})=2))

    Assumes each name will not be duplicated on any row.

    The array {1;1;1;1;1} represents the number of columns you have.
    Thanks man, that done the trick entirely!

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

    Re: Count occurences in each row.

    You're welcome. Thanks for the feedback!


    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

  6. #6
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Count occurences in each row.

    FORUM MODERATOR'S REQUEST:

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as "SOLVED".
    For the meantime I'll do it for you.

    How?
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    Note:
    You can also thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given.
    By doing so you can add to the reputation(s) of those who helped and shared their time in helping you.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

+ 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 occurences based on name
    By djsouljah in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-27-2014, 10:07 AM
  2. How to count the occurences
    By Elainefish in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-16-2013, 04:00 AM
  3. Count occurences in one column, add to another
    By budge in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-16-2013, 09:35 AM
  4. Trying to count occurences if 2 conditions are met
    By NLithgow in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-05-2005, 10:05 PM
  5. Count occurences
    By AvalancheMike in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2005, 08:06 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