Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to multi level sort an array in excel, using formulas? I am aware about the way, using SORT button on DATA tab

Input data:

r1 r2
1 3
2 1
1 1
1 2

Output data:

r1 r2
1 1
1 2
1 3
2 1

Using SORT formula in excel, gives the result:

r1 r2
1 3
1 1
1 2
2 1
like image 301
Armaan Gohil Avatar asked Oct 22 '25 13:10

Armaan Gohil


1 Answers

Use SORTBY, e.g.

=SORTBY(A2:B5,A2:A5,1,B2:B5,1)

or simply SORT with an appropriate second parameter:

=SORT(A2:B5,SEQUENCE(,2))

like image 195
Jos Woolley Avatar answered Oct 24 '25 19:10

Jos Woolley



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!