Forum Discussion
Need help with SORTBY function.
- Nov 24, 2025
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})
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.
- Tinny426Nov 24, 2025Copper 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.