+ Reply to Thread
Results 1 to 7 of 7

Formula to find the number of times a row has the max value of the column

  1. #1
    Registered User
    Join Date
    04-24-2012
    Location
    Tampa, FL
    MS-Off Ver
    Excel for Mac 2011
    Posts
    5

    Formula to find the number of times a row has the max value of the column

    I was trying to find a way to count the number of times a given row has the maximum value in the column. Was that confusing enough? Basically, in rows I have scores for a given group over a ten week period. For each week there is one or more groups which have the highest score, and I'd like to know how many times each group "won" the week over that ten week period.

    I attached an example spreadsheet in which I've highlighted the highest value for each week column (using conditional formating) and (manually) counted the times that group had the highest value. Is there a way to automate this (I have a larger data set and would like to not have to do it manually).

    Groups.xlsx

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Formula to find the number of times a row has the max value of the column

    would something like =COUNTIF(C3:L3,MAX(C3:L3)) if you are doing it across rows or =COUNTIF(C3:C17,MAX(C3:C17)) if you are doing it down columns work for you?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Formula to find the number of times a row has the max value of the column

    Hello Cheung,

    Paste the below code in B3 and copy down:

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


    Shelton A.
    If Helpful, Add Reputaion!

  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: Formula to find the number of times a row has the max value of the column

    Try this...

    This formula entered in B3 and copied down as needed:

    =SUMPRODUCT(--(C3:L3=SUBTOTAL(4,OFFSET(C$3:C$17,,COLUMN($C$3:$L$17)-COLUMN($C$3)))))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    04-24-2012
    Location
    Tampa, FL
    MS-Off Ver
    Excel for Mac 2011
    Posts
    5

    Re: Formula to find the number of times a row has the max value of the column

    Quote Originally Posted by Sambo kid View Post
    would something like =COUNTIF(C3:L3,MAX(C3:L3)) if you are doing it across rows or =COUNTIF(C3:C17,MAX(C3:C17)) if you are doing it down columns work for you?
    That's what I tried as well (made sense in my head), but it was definitely not working for me.

    Quote Originally Posted by playaller View Post
    Hello Cheung,

    Paste the below code in B3 and copy down:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This worked great! The only issue is that my data set is much larger than just 10 columns, more like 60 and growing, and while I would only have to do it once and then drag down this is a big formula that involves a lot of clicking and typing. I was hoping for something simpler like...

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

    This formula entered in B3 and copied down as needed:

    =SUMPRODUCT(--(C3:L3=SUBTOTAL(4,OFFSET(C$3:C$17,,COLUMN($C$3:$L$17)-COLUMN($C$3)))))
    ... this! This worked perfectly and in addition it was easy to adapt to my real data and short and simple enough for me to understand what it was doing. Nice job, and thanks for the help!

  6. #6
    Registered User
    Join Date
    04-24-2012
    Location
    Tampa, FL
    MS-Off Ver
    Excel for Mac 2011
    Posts
    5

    Re: Formula to find the number of times a row has the max value of the column

    One modification I made... when I applied it to my data set I had a lot of empty cells (which I will be filling in the future) and the formula Tony gave me was counting these having the max values for the column (technically true, I guess). To solve this problem I just added "-COUNTBLANK(range of row values)" after the formula, so that it would be:
    Please Login or Register  to view this content.

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

    Re: Formula to find the number of times a row has the max value of the column

    Good deal. 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. Need a Formula Find sections in a column and return start and end times
    By john dalton in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-27-2014, 05:42 AM
  2. Find number of times a value from a list appears in a seperate column
    By GSmith8 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-17-2013, 02:05 AM
  3. Replies: 1
    Last Post: 04-04-2013, 10:53 AM
  4. [SOLVED] find number of times a letter or a number appears in a column
    By dcoates in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2012, 02:47 PM
  5. find out number repeated max. times in column.
    By vimivijay in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2005, 06:59 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