+ Reply to Thread
Results 1 to 6 of 6

Counting lists

  1. #1
    Registered User
    Join Date
    09-01-2010
    Location
    Atlanta
    MS-Off Ver
    Excel 2003
    Posts
    3

    Counting lists

    Hello, Thank you in advance for your help.

    Data:
    I have a list of names entered in a worksheet as follows: In Column A is the first group. For rows 1-7 I have a name. Each column after that contains 7 more names. They correspond to players on a team that were on the field for each point in the game. I want to be able to count the number of times the same players were on the field.

    For example ( groups of 3 vertically)

    Amy Brad Devin
    Brad Amy Mike
    Devin Devin Brad

    I need excel to give me results that the combination of Amy, Brad, and Devin - in any order - occurred twice and that the combination of Devin, Mike, and Brad occurred once.

    I am familiar with the IF & COUNTIF functions.

    Thank you.
    .

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

    Re: Counting lists

    Please post a sample file with a meaningful amount of sample data and provide also some expected results for the same.

    As it stands it's not entirely clear if you're looking for instances wherein all 7 names repeat or only subsets thereof.

  3. #3
    Registered User
    Join Date
    09-01-2010
    Location
    Atlanta
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Counting lists

    I have attached a worksheet as requested. Thank you.
    Attached Files Attached Files

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

    Re: Counting lists

    See attached as proof of concept

    There are two approaches shown - both utilise Chip Pearson's QSortInPlace UDF which allows you to create an ordered string of the various names involved in each point.
    (note this means you must enable macros when opening the file else #NAME? errors will result)

    Doing the same (ordering names) without a UDF is viable but if you can use the UDF it I would advise it

    The second approach of the two I mention shows how to use the ordered strings to first return all of the unique name combinations that appear and then subsequently the frequency of that combination across all points.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-01-2010
    Location
    Atlanta
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Counting lists

    Thank you. Very helpful! Essentially I need to order the columns alphabetically, create a string and count the string's occurrences.

    FYI, I've decided to implement the ordernames UDF to create the sorted array for each lineup and then countif for frequency.

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

    Re: Counting lists

    I'm glad it helped.

    To reiterate the UDF is driven by the QSortInPlace code (this does the hard work) and is something I use quite frequently for this type of exercise.

    You can find more info. on this routine from the authors website: http://www.cpearson.com/Excel/SortingArrays.aspx
    (see also: http://www.cpearson.com/Excel/VBAArrays.htm)

    The same can be achieved without need for VBA but the UDF makes things a lot cleaner from the worksheet point of view.

+ 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