RANK variable blocks of cells between BLANK cells

BakerBaker

New Member
Joined
Feb 12, 2018
Messages
38
Office Version
  1. 2019
Platform
  1. Windows
I would like to RANK individual blocks of cells within a column which will be a variable number between BLANK cells. In the (simple) example I wish to RANK A1 to A4 and then A6 to A11. A formula in B1 would be copied down to the end of the column, which could be several hundred rows.


A1 22 B1 Formula
A2 46
A3 10
A4 8
A5 BLANK
A6 22
A7 12
A8 43
A9 2
A10 19
A11 18
A12 BLANK

etc
 
Thanks very much Peter, I really appreciate your time on this, I can only improve because of you and the other wizards on here
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Leave a blank cell above the first value, then use this formula, copied down.

Spreadsheet Formulas
CellFormula
B2=IF(A2="","",RANK(A2,INDEX(A$1:A2,AGGREGATE(14,6,(ROW(A$1:A1)-ROW(A$1)+1)/(A$1:A1=""),1)+1):INDEX(A2:A$1000,MATCH(TRUE,INDEX(A2:A$1000="",0),0)-1)))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Absolutely amazing!!!
 
Upvote 0
My initial question received an excellent answer. As an additional question - What needs changing in the formula to sort lowest to highest?
 
Upvote 0
What needs changing in the formula to sort lowest to highest?
Do you mean rank lowest to highest?

If so, add the red part.
=IF(A2="","",RANK(A2,INDEX(A$1:A2,AGGREGATE(14,6,(ROW(A$1:A1)-ROW(A$1)+1)/(A$1:A1=""),1)+1):INDEX(A2:A$1000,MATCH(TRUE,INDEX(A2:A$1000="",0),0)-1),1))

If that is not what you want, please post another small set of sample data and expected results.
 
Upvote 0
Spreadsheet Formulas
CellFormula
B2=IF(A2="","",RANK(A2,INDEX(A$1:A2,AGGREGATE(14,6,(ROW(A$1:A1)-ROW(A$1)+1)/(A$1:A1=""),1)+1):INDEX(A2:A$1000,MATCH(TRUE,INDEX(A2:A$1000="",0),0)-1)))

<tbody>
</tbody>

<tbody>
</tbody>

what is the purpose of ROW(A$1)? isn't that just 1 anyway?
 
Upvote 0
what is the purpose of ROW(A$1)? isn't that just 1 anyway?
The purpose is so that if the user later inserts new rows at the top of the worksheet, the formula still works. If we just used 1 instead, the formula would return incorrect results after row insertion.
 
Upvote 0
I have used this regularly since 2018.
Which? There have been a couple of different suggestions/discussions in the thread.

Is there a way to adapt the ranking to give unique rankings - in other words, NOT give equal ranking to duplicate numbers?
What a bout some sample data and expected results with XL2BB so we know just what you have and what you are after?

I also suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
The original post at Mar 22 2018 which begins: I would like to RANK individual blocks of cells within a column etc. This returns equal ranking for duplicate numbers. So, as indicated I would like to adapt the ranking to give unique rankings - in other words, NOT give equal ranking to duplicate numbers? The current formula is:

=IF(D5="","",IF(AB5="","",RANK(AB5,INDEX(AB$4:AB5,AGGREGATE(14,6,(ROW(AB$4:AB4)-ROW(AB$4)+1)/(AB$4:AB4=""),1)+1):INDEX(AB5:AB$993,MATCH(TRUE,INDEX(AB5:AB$993="",0),0)-1))))



842AHLAIN2
813BETTIES BAY3
851BOURGEOISIE1
010DIRE WOLF10
010DRAMATIC EFFECT10
768ELEFTHERIA8
797FLEMISH7
010GUSHING GOLD10
805JAKIMA5
813PANNONICA3
739RAQIYA9
805SIOBHANBROGAN5
691SOUTHWOLD1
04HES A GENTLEMAN4
691TELE RED1
04MOAI4
643BALQAA3
04EXTINCTION4
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,050
Members
449,206
Latest member
Healthydogs

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