SOLVED

Complicated sorting

Copper Contributor

Hello

 

I'm trying to sort some data, i have multiple columns that i want to use for the sort.

I used the SORT function to sort by one column but then i want if 2 or more of the values are equal to sort the equal lines by values of anoter column. For example

 

name1      3       4

name2      3       5

name3      2       3

Now the range is sorted by 2nd column but because 2 of the values are equal i want it to sort these 2 lines by 3rd column so name2 to go first on the list. 

Can this happen by functions or i have to use code?

 

all best

4 Replies

@bernidakis If you have SORT you should also have SORTBY. The fist argument is the array you want to sort, followed by pairs of columns and sort order. 

Something like this:

Riny_van_Eekelen_0-1660892712473.png

 

But if in line 4
name3 2 6
then will it go to the top or it will stay at bottom as it should?
best response confirmed by Hans Vogelaar (MVP)
Solution

@bernidakis It will stay at the bottom, indeed. Just give it a try yourself. Otherwise play around with the attached file.

 

Tried it and worked perfectly! Thanks a lot!!!!
1 best response

Accepted Solutions
best response confirmed by Hans Vogelaar (MVP)
Solution

@bernidakis It will stay at the bottom, indeed. Just give it a try yourself. Otherwise play around with the attached file.

 

View solution in original post