sumproduct RANK array (multiple columns) - with conditions

collegeitdept

Board Regular
Joined
Nov 14, 2008
Messages
185
Hello,

The rank function using sumproduct supports multiple conditions and is really handy.

I found out how to modify the RANK function to support arrays (multiple columns) using something like the following function:


=SUMPRODUCT((LEFT($A$1:$D$1,LEN($F1))=F$1)*(Premiere!$A$2:$A$20<>0),--($A$2:$D$20>$F2))+1



However, it doesn't seem to work with conditions:

REGULAR
Product Name
Kind
Grouping
Release Date

Platform 5
RANK
Platform 1
RANK
Platform 2
RANK
Platform 3
RANK
Platform 4
RANK
Platform 6
RANK
Platform 7
RANK
Platform 8
RANK
Platform 9
Platform 10
1
Name 2
REGULAR
1
1/14/2014

12,283
1
44,600
1
48,498
1
75,502
1
3
1

8
19,542
1
2,683
1
4,289
1,795
2
Name 7
REGULAR
1
11/19/2013

4,428
3
17,463
2
17,930
2
23,687
2
2
5
1,013
4
1,240
4
93
7
115
3
3
Name 11
REGULAR
1
9/24/2013

2,528
4
10,523
3
11,088
3
16,085
3
2
2
2,298
2
757
6
370
3
600
139
4
Name 1
REGULAR
1
1/21/2014

2,423
4
8,690
5
9,111
5
13,250
4
2
4

8
2,071
3
407
2
1,110
605
5
Name 10
REGULAR
1
9/25/2013

1,691
6
4,691
7
4,843
7
7,158
7
1
8
1,636
3
630
8
265
4
329
53
6
Name 12
REGULAR
1
9/24/2013

1,373
6
7,835
6
8,025
6
10,035
6
1
7
2,791
1
804
5
257
5
424
134
7
Name 6
REGULAR
1
11/19/2013

1,010
7
9,211
4
9,479
4
12,011
5
2
3
825
5
727
7
34
10
52
18
8
Name 5
REGULAR
1
11/20/2013

627
10
942
10
985
9
1,641
9
1
10
797
6
60
10
165
6
197
29
9
Name 9
REGULAR
1
9/25/2013

413
13
2,805
8
2,873
8
4,107
8
2
6

8
17,655
2
57
8
83
36
10
Name 4
REGULAR
1
11/20/2013

309
15
588
12
618
10
945
10
1
9
504
7
73
9
41
9
66
23
11
0
0
0




















12
0
0
0




















13
0
0
0




















14
0
0
0




















15
0
0
0




















16
0
0
0




















17
0
0
0





















<tbody>
</tbody>


The RANK column in RED is not correct - the function is generating wrong rank position numbers.

Here is the formula in that column:

=SUMPRODUCT(('Release Day'!$C$2:$C$200=$B$15)*(LEFT('Release Day'!$I$1:$U$1,LEN(G$16))=G$16),--('Release Day'!$I$2:$U$200>G17))+1


What this rank formula is doing is combining the numbers for "Platform 5A" and "Platform 5B" and from that sum - provide the rank position for "REGULAR" products only.




Here is the raw data: (in 'Release Day' tab of Excel workbook)


Product NameUnitKindMetricsSale UnitsGroupingRelease DateExpiration DatePlatform 1Platform 2Platform 3Platform 4Platform 5APlatform 5BPlatform 6Platform 7Platform 8Platform 9Platform 10Platform 11Platform 12Proper DateRegular - platform 5 RANKSPECIAL - platform 5 RANK
Name 1NetworkREGULARSales MetricsPalette11/21/20141/21/201486909111132501.751738685207140711106050001-21-201440
Name 2NetworkREGULARSales MetricsPalette11/14/20141/14/20144460048498755022.6472954988195422,683428917950001-14-201410
Name 3NetworkSPECIALSales MetricsPalette112/5/201312/5/201363466611421.441969612-05-201304
Name 4NetworkREGULARSales MetricsPalette111/20/201312/25/20135886189451.1426049504734166230011-20-2013100
Name 5NetworkREGULARSales MetricsPalette111/20/201312/25/201394298516411.1348014779760165197290011-20-201380
Name 6NetworkREGULARSales MetricsPalette111/19/201312/24/201392119479120112.097992118257273452180011-19-201370
Name 7NetworkREGULARSales MetricsPalette111/19/201312/24/20131746317930236871.683836592101312409311530011-19-201320
Name 8NetworkSPECIALSales MetricsPalette111/19/201312/3/20136947249971.2282948029310011-19-201301
Name 9NetworkREGULARSales MetricsPalette19/25/201311/13/20132805287341071.5285128176555783360009-25-201390
Name 10NetworkREGULARSales MetricsPalette19/25/201311/27/20134691484371581.3613053861636630265329530009-25-201350
Name 11NetworkREGULARSales MetricsPalette19/24/201311/5/20131052311088160852.47204548322987573706001390009-24-201330
Name 12NetworkREGULARSales MetricsPalette19/24/201311/12/201378358025100351.37100736627918042574241340009-24-201360
Name 13NetworkSPECIALSales MetricsPalette19/23/20139/23/20131476150718510.625069181209-23-201303
Name 14NetworkSPECIALSales MetricsPalette11/17/20141/17/20141032106715550.58738771110001-17-201402

<colgroup><col><col><col><col><col><col><col><col><col><col span="15"></colgroup><tbody>
</tbody>



I was wondering if someone could kindly help please modify this sumproduct RANK function to support conditions and arrays?


Excel file:
https://dl.dropboxusercontent.com/u...t Rank condition - away multiple columns.xlsx



Thanks.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Why do you have to go back to the base data? Aren't you just ranking the values in the Platform 5 column with conditions, wouldn't this work?

=COUNTIFS(C$17:C$26,C17,G$17:G$26,">"&G17)+1
 
Upvote 0
Why do you have to go back to the base data? Aren't you just ranking the values in the Platform 5 column with conditions, wouldn't this work?

=COUNTIFS(C$17:C$26,C17,G$17:G$26,">"&G17)+1



Hi Barry,

I have to keep going back to the base data to apply that same formula to all other "RANK" columns.... so it can rank based on the appropriate Platform.

IE: Platform 1 rank
platform 2 rank
platform 3
platform 4
platform 5 (A & B)
Platform 6
etc...

Thanks.
 
Upvote 0
I still don't see that.

Given that you actually have all REGULAR values in one table it doesn't even have to be as complicated as the COUNTIFS function I suggested, can't you use a simple RANK function in H17 copied down?

=IF(G17=0,"",RANK(G17,G$17:G$33))

That can be copied to all other RANK columns

In fact, it doesn't seem like your ranks are correct for Platform 1 either - ranks go up to 12 but with 9 and 11 missing - (presumably because they are confused with values for Platform 10), so that version would fix that issue too.

The reason why your platform 5 version doesn't work is because it is trying to rank against the individual 5A and 5B values rather than the total 5A and 5B values for each product name

There may be a way to fix that but as you also need to fix the Platform 1/Platform 10 issue I can't seem any simpler way than just ranking those values as described above.

If that formula doesn't work can you explain which results are wrong so that I can better understand the issue
 
Upvote 0

Forum statistics

Threads
1,216,029
Messages
6,128,404
Members
449,448
Latest member
Andrew Slatter

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top