+ Reply to Thread
Results 1 to 6 of 6

ranking with sumproduct or countifs with multiple criteria

  1. #1
    Registered User
    Join Date
    05-23-2014
    Posts
    37

    ranking with sumproduct or countifs with multiple criteria

    Hi,

    I am trying to rank the numbers if it falls under the same date and category.


    Column C: Date Column J: Category Column O: Count Column P: Desired Rank Outcome
    Aug 2014 Coats 50 2
    Aug 2014 Coats 50 2
    Aug 2014 Coats 50 2
    Aug 2014 Jeans 100 1
    Sep 2014 Coats 25 3
    Sep 2014 Jeans 50 2
    Sep 2014 Sweaters 75 1


    After searching for solutions, it seems like I should use sumproduct or the countifs formula so I tried the following but I couldn't get it to work.
    =COUNTIFS($C:$C,$C2,$J:$J,$J2,$O:$O,">"&$O2)+COUNTIFS($C:$C,$C2,$J:$J,$J2,$O:$O,$O2) just counts the amount of times it appears so it will give me 3 instead of 2 for coats in Aug 2014.

    =1+SUMPRODUCT(($C$2:$C$88=C2)*($J$2:$J$88=J2)*($O$2:$O$88>O2)) only gives me 1 for all the rows because the sumproduct part is just giving me 0s.

    What am I missing? Should I be using a different formula altogether? Thanks!

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,290

    Re: ranking with sumproduct or countifs with multiple criteria

    What I'm missing is why all of your desired ranks for the shown data are not all 1: - there are either only 1 comparable data point, so its rank should be 1, or ties, so they should be 1 as well.

    Personally, I would use the formula

    =COUNTIFS($C:$C,$C2,$J:$J,$J2,$O:$O,">"&$O2) +1
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    05-23-2014
    Posts
    37

    Re: ranking with sumproduct or countifs with multiple criteria

    Ah, I see where I got confused: I shouldn't have included the category in the formula if I wanted to rank them by date. Thanks for pointing that out. So my next question is, how do I get sweaters to be ranked as 3 instead of 5 below?

    Column C: Date Column J: Category Column O: Count Column P: Desired Rank Outcome
    Aug 2014 Coats 50 2
    Aug 2014 Coats 50 2
    Aug 2014 Coats 50 2
    Aug 2014 Jeans 100 1
    Aug 2014 Sweaters 25 3

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,290

    Re: ranking with sumproduct or countifs with multiple criteria

    That's not how any ranking system works, so we need to use a helper columns of formulas to identify unique values and duplicates.

    In P2, use

    =IF(COUNTIFS($C$2:C2,C2,$O$2:O2,O2)=1,1,0)

    and copy down to match.

    Then in Q2, use

    =COUNTIFS($C$2:$C$6,C2,$P$2:$P$6,1,$O$2:$O$6,">"&O2)+1

    Change the $6s to your actual last row, then copy down.

  5. #5
    Registered User
    Join Date
    05-23-2014
    Posts
    37

    Re: ranking with sumproduct or countifs with multiple criteria

    Wow, there was no way I would've figured that out on my own. Greatly appreciated!!

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,290

    Re: ranking with sumproduct or countifs with multiple criteria

    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. COUNTIFS/SUMPRODUCT If criteria matches any in the given set
    By darioskis in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-11-2014, 02:39 PM
  2. [SOLVED] Sumproduct / Countifs multiple criteria
    By Biffer in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-25-2013, 11:08 AM
  3. [SOLVED] Need to use either COUNTIFS or SUMPRODUCT to count rows based on multiple criteria
    By erabinov in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-15-2013, 03:15 PM
  4. [SOLVED] Countifs and sumproduct with two criteria
    By jewellove in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 10-28-2012, 08:07 PM
  5. [SOLVED] Help with sumproduct for mutliple criteria ranking with a tie breaker
    By sshahils in forum Excel General
    Replies: 2
    Last Post: 07-17-2012, 11:39 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