Forum Discussion

Tinny426's avatar
Tinny426
Copper Contributor
Nov 23, 2025
Solved

Need help with SORTBY function.

Hi all,

In reference to this formula, SORT(FILTER('Big 4 NOV 21-23'!A3:D221,'Big 4 NOV 21-23'!B3:B221="M"),3,-1) I can only sort using one column (3).

I need to sort the rows by column 3 then column 4. Column 5 is static

I have tried using the SORTBY function, but there is an #VALUE issue with the array.

Appreciate any help with this!

Cheers Richard.

NAMEMENSTOTAL UNITSTOTAL WEIGHTPOINTS
Fred M48.65325
Rob M44.55620
BobM48.51717
RickM410.58415
DaveM410.42514
GregM48.77313
CalM35.95812
EdM33.77611
HalM23.83410
IanM22.3249
JoeM25.5438
KenM22.7517
LenM27.1796
NeilM213.0775
MikeM14.7724
OllieM15.9833
  • You do not need SORTBY() in this case. You can specify multi column for sorting and individual sort order for each column.

    =SORT(FILTER('Big 4 NOV 21-23'!A3:E221,'Big 4 NOV 21-23'!B3:B221="M"),{3,4,5},{-1,-1,-1})

     

5 Replies

  • Harun24HR's avatar
    Harun24HR
    Bronze Contributor

    You do not need SORTBY() in this case. You can specify multi column for sorting and individual sort order for each column.

    =SORT(FILTER('Big 4 NOV 21-23'!A3:E221,'Big 4 NOV 21-23'!B3:B221="M"),{3,4,5},{-1,-1,-1})

     

    • Tinny426's avatar
      Tinny426
      Copper Contributor

      Hi Harun24HR,

      Your solution is perfect to me as it has added a little more to my excel knowledge and does exactly what i needed! Thank you!

  • m_tarler's avatar
    m_tarler
    Bronze Contributor

    that is probably because the sortby() function needs an array for the sortby parameters (not just a column number).  So you need to filter the table then pass the full column 3, column 4, and column 5 to the sortby parts.  this is perfect time to use the LET() statement:

    =LET(in, A1:E17, 
              a, FILTER(in,CHOOSECOLS(in,2)="M"),
              VSTACK(
                   TAKE(in,1),
                   SORTBY(a,CHOOSECOLS(a,3),-1,CHOOSECOLS(a,4),-1,CHOOSECOLS(a,5),-1))
              )

    so you can pick whatever range you want to use for line 1

    line 2 performs the FILTER (in this case filter the second column for "M"

    line 3 is the output and on line 4 it will return the header row and line 5 does the sort

    notice on line 5 each sortby is passing the full column of corresponding data.

     

    • Tinny426's avatar
      Tinny426
      Copper Contributor

      Hi m_tarler,

      Thanks for taking the time to reply to my question. I'm sure your solution would work perfectly, but i have no experience with some of the functions you recommended. 

      Cheers Richard.

       

Resources