Forum Discussion

bernidakis's avatar
bernidakis
Copper Contributor
Aug 19, 2022
Solved

Complicated sorting

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

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    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:

     

    • bernidakis's avatar
      bernidakis
      Copper Contributor
      But if in line 4
      name3 2 6
      then will it go to the top or it will stay at bottom as it should?

Resources