+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Problem - Rank multiple criteria using SUMPRODUCT

  1. #1
    Registered User
    Join Date
    02-23-2011
    Location
    MY, House
    MS-Off Ver
    Excel 2010
    Posts
    3

    Problem - Rank multiple criteria using SUMPRODUCT

    Hello guys, I've been searching everywhere for this answer! (google you have failed me (can't be the user))

    I need to rank multiple criteria using SUMPRODUCT. I created a little fake test file... (it's attached, and here is the text of it)

    Name Office Hours job Shift
    Guy 1 south 40 Delivery Day
    Guy 2 south 35 Desk Night
    Guy 3 south 37 Desk Day
    Guy 4 north 32 Desk Day
    Guy 5 north 39 Desk Day
    Guy 6 north 38 Desk Day
    Guy 7 north 41 Delivery Night
    Guy 8 north 48 Delivery Day
    Guy 9 south 52 Delivery Night
    Guy 10 south 33 Desk Day
    Guy 11 south 27 Desk Night
    Guy 12 south 22 Desk Day
    Guy 13 north 22 Delivery Day
    Guy 14 south 40 Delivery Day
    Guy 15 south 37 Desk Day
    Guy 16 north 28 Desk Night
    Guy 17 north 43 Desk Night
    Guy 18 north 39 Desk Day

    ... (my real file is 5000 columns deep)

    I would like to rank the hours based on the other 3 sets of criteria. I, somewhat, understand the formula (for 1 criteria) =SUMPRODUCT(--(C3<($B$3:$B$8=B3)*$C$3:$C$8))+1 , but other than switching the rows around I'm lost as how to add multiple criteria to this.

    Any help would be thankful

    ... seriously, I can't wrap my head around this
    Attached Files Attached Files

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

    Re: Problem - Rank multiple criteria using SUMPRODUCT

    Profile implies XL2010 - in which case you should use COUNTIFS

    Please Login or Register  to view this content.
    that said even with 5000 rows of data the above will be inefficient.

    Given the above, if you can, (assuming XL2010) sort your data by Cols B, D, E & C (desc) at which point your formula becomes very basic / efficient.

  3. #3
    Registered User
    Join Date
    02-23-2011
    Location
    MY, House
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Problem - Rank multiple criteria using SUMPRODUCT

    Quote Originally Posted by DonkeyOte View Post
    Profile implies XL2010 - in which case you should use COUNTIFS

    Please Login or Register  to view this content.
    that said even with 5000 rows of data the above will be inefficient.

    Given the above, if you can, (assuming XL2010) sort your data by Cols B, D, E & C (desc) at which point your formula becomes very basic / efficient.
    Yes (i do have excel 2010), That would be the best and easiest way to do it. The problem is, is that I need to have this huge file sorted by another criteria (5000 columns... rows to **) .

    Lets assume, that on this example that for some reason, it's important to have it sorted by tenure (which we will pretend is F.) Thus, the solution (although is the best way for most) won't work

    for my file, I've done the whole rankifs manually:
    ---I created, on a seperate sheet a rankifs (for the attached file, this is the wrong rankifs via sumproduct by the way) (=SUMPRODUCT(--(C3<($B$3:$B$8=B3)*$C$3:$C$8))+1) column for each separate criteria rank I wanted

    --- then I wrote this formula as a means to a true/false (0 or 1) file (=IF(e3=day,0,(COUNTIFS($b3,"north",$B3,CT$1,$d3,"desk")))) (where (in the attached file's data) ct1 would equal which office)

    --- then I have a third formula look at the second set of data, and if a 1 value (true) is in a countif row, then it will return the value of the correct Rankif row (via sumproduct)

    Problems with my rankifs solution
    huge file
    Large amounts of new rows required for sorts (it's more like 28 offices, 10 jobs, 8 shifts) so you can see, since I have so many of these rankifs in play, the solution requires (for 2 different sorts) 112 rows

    -----This is where the rankifs using sumproducts with 3 criteria (if possible)would come in uber-handy----

    heh, sorry guys, most likely, I did a poorjob of explaining myself l in this post, I apologize if my bad sense of logic makes your head spin
    Last edited by josemartillo10; 02-23-2011 at 02:42 PM.

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

    Re: Problem - Rank multiple criteria using SUMPRODUCT

    The formula provided previously is for unsorted data.
    Using your sample as provided paste the COUNTIFS formula from my prior post into F2 and copy down for rank values.

    I simply made the point that sorting invariably allows for greater efficiencies.
    If you can't sort so be it but be aware that 5000 COUNTIFS won't be that quick, however, they will still be significantly quicker than 5000 SUMPRODUCTs
    Last edited by DonkeyOte; 02-23-2011 at 03:14 PM.

  5. #5
    Registered User
    Join Date
    02-23-2011
    Location
    MY, House
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Problem - Rank multiple criteria using SUMPRODUCT

    Quote Originally Posted by DonkeyOte View Post
    The formula provided previously is for unsorted data.
    Using your sample as provided paste the COUNTIFS formula from my prior post into F2 and copy down for rank values.

    I simply made the point that sorting invariably allows for greater efficiencies.
    If you can't sort so be it but be aware that 5000 COUNTIFS won't be that quick, however, they will still be significantly quicker than 5000 SUMPRODUCTs
    Ha!!!! You are brillant sir!!! I'll just link data on a second sheet, then use your awesome formula, sort, than link the rankings back to the original file!!!!

    I'd prefer the rankifs sumproducts, but this works just as well and seems alot better than have 100+ rows of data, heh.

+ 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