Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google-spreadsheet formula to get number ranks in column

I'm looking for formula/function for google-spreadsheet. Sorry for the title, but let me explain. I have a column with 5 rows of numbers:

2
5
9
7
4

I want to loop through rows and create another column which will tell me rank of each cell. So, for example "2" is the lowest so it gets 1. "9" is the highest to it gets 5 (highest rank, because there are 5 rows), "7" is second highest, so it gets 4, etc. So, I want to achieve this:

1
3
5
4
2

So, in other words. For every cell in new column, I need to put value how high relevant number in other column is. Can anyone help me with this? I'm using Google spreadsheet.

like image 286
Ish Thomas Avatar asked Dec 18 '25 20:12

Ish Thomas


2 Answers

Google Sheets and Microsoft Excel have a RANK function that has the syntax...

RANK(value, data, [is_ascending])

Suppose your data is in cell range A1:A5 and you want the results in cell range B1:B5. Then you could place the formula...

=RANK($A1,$A$1:$A$5,1)

in cell B1 and fill down to cell B5.

like image 125
Bobby Orndorff Avatar answered Dec 20 '25 08:12

Bobby Orndorff


having the numbers in A1 to A5 put in B1:

=ArrayFormula(MATCH(A1,SMALL(A$1:A$5,(ROW($1:$5))),0))

and auto-fill it down

like image 44
Dirk Reichel Avatar answered Dec 20 '25 09:12

Dirk Reichel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!