Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Sorting/ordering values from smallest to biggest in an array

I have a formula like this : =ArrayFormula(sort(INDEX($B$1:$B$10,MATCH(E1,$A$1:$A$10,0))))

in columns A:B:

    a   1
    b   2
    c   3
    d   4
    e   5
    f   6
    g   7
    h   8
    i   9
    j   10

    

and

 the data to convert in E:H
a   c   f   e
f   a   c   b
b   a   c   d

I get the following results using the above formula

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

in columns L:O:
1   3   6   5
6   1   3   2
2   1   3   4
        

My desired output is like this:

1   3   5   6
1   2   3   6
1   2   3   4

I’d like to arrange the numbers from smallest to biggest in value. I can do this with additional helper cells. but if possible i’d like to get the same result without any additional cells. can i get a little help please? thanks.

>Solution :

try:

=INDEX(TRIM(SPLIT(FLATTEN(QUERY(QUERY(QUERY(SPLIT(FLATTEN(E1:H3&"×​"&ROW(E1:H3)), "​"), 
 "select max(Col1) group by Col1 pivot Col2"), "offset 1", 0),,9^9)), "×")))

2

or if you want numbers:

=INDEX(IFNA(VLOOKUP(TRIM(SPLIT(FLATTEN(QUERY(QUERY(QUERY(SPLIT(FLATTEN(E1:H3&"×​"&ROW(E1:H3)), "​"), 
 "select max(Col1) group by Col1 pivot Col2"), "offset 1", 0),,9^9)), "×")), A:B, 2, 0)))

1

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading