How to change the 'REF' of a RANK formula based on a value in a cell

mattadams84

Board Regular
Joined
Oct 30, 2016
Messages
54
I have a long list of data in rows on one sheet. What i want to do is create a rank within those rows on blocks of data, depending on a unique identifier in column A:

So, i set up the following formula (as an example):

=RANK.EQ(e2,$e$2:$e$20,0)

This will indeed rank what ever is in between e2 and e20. However i want to be able to change the 'REF' array part of the rank formula to be dynamic. In column A there is unique identifier for each block of data, so for example in rows 2-20 there is a numerical identifier, lets say 0001 and then from rows 21-25 its 0002 and so on. For info the identifiers arent incremental they are random, sometimes it can pass from 4520 to 6020 for example, The number of rows in the blocks of data always changes, and there are roughly 900 rows.

Is it possible within my formula to make the reference of where it is trying to rank dynamic, based on the cell value of what is in column A? So i guess it would need to find on which row the unique identifier in column A starts and the row it finishes.

Any help is appreciated
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
you can work with offset in your formula to change your ref, but i don't understand how it works now.
You point to a cell in column A and then excel has to understand that 4520 means range ("E...:E...").
Can you describe the logic/relation between that cell and the range ?
 
Upvote 0
Here is an example sheet of my data:

iddata 1data 2data 3rank data 1rank data 2rank data 3
6019685631
60194453818
60194433922
60194425333
60194804927
60194403624
6019573823
60194413719
6019564026
60194494223
60194354124
60194913520
60194513118
60194443115
60194902714
60194862512
60194342817
60194482211
60194382515
60194333820
6135936840
61351517137
61351525327
6135594122
61351494521
61351534625
6135924023
61352232410
61351463418
61351433922
61351583724
61351084022
61352092610
61351573020
61352183014
61352222915
61351442818
22501452210
22501552714
2250159169
6192387638
6192336439
6192406433
6192494827
6192465135
6192424021
61925413217
6192413620
6192343524
6192443714
61925402719
6192432714
6192393421
6192502717
61925432212
6192472617
6192513122
61925442312
61984615422
61984706035
6198744923
6198904218
42224645024
42221134620
42224635732
30004714631
30004735330
30004694919
 
Upvote 0
Basically the logic is (using the example above) i would like to rank, for example, data 1, but rank the data (between themselves) on everything that has the ID 6019 (col A) so the range to rank would be all the rows that have 6019 in column A. If i then wanted to rank everything that has the ID 6198 it would rank (between themselves) everything that has the ID 6198.

In reality i have about 900 rows, and the ID's change at random points, they are always grouped, as in they are in successive rows because i sort by ID, so the range would always be a block
 
Upvote 0
every block is unique, means that you can repeat 6019 later then row 21 a 2nd time !!!
with conditional format : green is a new value, red is a new but not unique value
Map1
ABCDEFG
1ddata 1data 2data 3rank data 1rank data 2rank data 3
260196856311812
3601944538188813
4601944339221079
5601944253331121
660194804927433
76019440362413125
860195738231987
960194413719121112
1060195640262064
1160194494223647
12601943541241555
136019491352011310
146019451311851413
156019444311591416
166019490271421718
176019486251231819
1860194342817161615
196019448221172020
2060194382515141816
216019433382017810
2261359368401521
2361351517137912
2461351525327833
2561355941221767
266135149452110510
2761351534625744
2861359240231676
296135223241011716
3061351463418111112
31613514339221397
32613515837245105
33613510840221477
346135209261041616
356135157302061211
366135218301431215
376135222291521414
3861351442818121512
3922501452210322
4022501552714211
412250159169133
4261923876381612
4361923364391821
4461924064331424
456192494827755
466192465135943
4761924240211268
486192541321731112
49619241362013810
5061923435241796
51619244371410715
526192540271941311
536192432714111315
54619239342115108
55619250271761312
566192543221221817
57619247261781612
5861925131225127
596192544231211717
6061984615422223
6161984706035111
626198744923432
636198904218344
6442224645024122
6542221134620333
6642224635732211
6730004714631231
6830004735330112
6930004694919323
Blad2
Cell Formulas
RangeFormula
E2:E69E2=RANK.EQ(B2,OFFSET(B$1,MATCH($A2,$A$1:$A2,0)-1,,COUNTIF($A$2:$A$1000,$A2)),0)
F2:G69F2=RANK(C2,OFFSET(C$1,MATCH($A2,$A$1:$A2,0)-1,,COUNTIF($A$2:$A$69,$A2)),0)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A100Expression=EN($A2<>A1;AANTAL.ALS($A$1:$A2;$A2)>1)textNO
A2:A100Expression=EN($A2<>A1)textNO
 
Upvote 0
Solution
i see now that above columns E is "Rank.Eq" and F:G is "Rank":sleep:, easy to adapt yourself
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

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