There are galore ways to benignant information successful Microsoft Excel, and 1 of the simplest and astir convenient is the SORTBY function. It lets you dynamically benignant your information by much than 1 array portion preserving the integrity of the archetypal data.
At the clip of penning (April 2025), the SORTBY relation is lone disposable to radical utilizing Excel oregon Office 2021 oregon later, Excel for Microsoft 365 connected PC oregon Mac, Excel for the Web, oregon the Excel mobile and tablet apps.
The SORTBY Syntax
The syntax for the SORTBY relation successful Excel is some straightforward and logical:
=SORTBY(a,b¹,b²,c¹,c²...)where
- a (required) is the scope oregon array you privation to sort,
- b¹ (required) is the archetypal scope oregon array by which you privation the information to beryllium sorted,
- b² (optional) is the benignant bid for b¹, and
- c¹ and c² (optional) are the 2nd array and bid by which you privation to benignant the data, and you tin person up to 64 of these pairings overall.
If you omit the benignant bid arguments oregon benignant 1, the information volition beryllium arranged successful ascending oregon alphabetical bid by the specified scope oregon array. On the different hand, benignant -1 to benignant the information successful descending oregon reverse-alphabetical order.
Arguments a, b¹, c¹, d¹, and truthful connected indispensable beryllium compatible successful presumption of their dimensions. For example, if the scope selected for statement a is 10 rows down, the arrays by which you privation to benignant the information indispensable besides beryllium 10 rows down.
Using SORTBY to Sort By One Column
Let's look astatine however the SORTBY relation tin beryllium utilized to benignant immoderate information by 1 column.
To travel on arsenic you read, download a escaped transcript of the workbook utilized successful this article's screenshots. After you click the link, you'll find the download fastener successful the top-right country of your screen.
In this example, accidental you've been handed an Excel array named T_Targets, and you've been asked to benignant the information by the Points column. At the aforesaid time, you request to permission the archetypal array unchanged, arsenic the accusation is structured successful an bid that indispensable stay unaltered.

The champion mode to bash this is to usage the SORTBY function.
The archetypal measurement is to hole the country successful your spreadsheet wherever the information volition go. In this example, I've copied and pasted the file headers to cells G1 to K1, and I've adjusted the font size and alignment of cells G2 to K25 (to let for vertical growth) to lucifer the formatting of the archetypal data.

Since the SORTBY relation returns a dynamic array, marque definite determination are capable vacant cells to show the effect successful full. Otherwise, you'll get the dreaded #SPILL! mistake erstwhile you implicit your formula.
Next, successful compartment G2, type:
=SORTBY(T_Targets,T_Targets[Points],-1)where
- T_Targets is the array,
- T_Targets[Points] is the sanction of the file containing the information that the array volition beryllium sorted by, and
- -1 tells Excel to benignant T_Targets[Points] successful descending order.
When you property Enter, you'll spot the effect reorder your information by the Points column. A bluish enactment astir the effect reminds you that it's a dynamic array (in different words, the effect has spilled from compartment G2 to the different cells).

The SORTBY look doesn't person to beryllium successful the aforesaid worksheet—or adjacent the aforesaid workbook!—as the root data. However, if you usage SORTBY betwixt workbooks, some files indispensable beryllium open—otherwise, you'll get a #REF! error.
You tin past use conditional formatting to the effect to assistance further analysis. For example, you mightiness privation to colour the rows of radical who person met their people green, and those who haven't red.
Using SORTBY to Sort By More Than One Column
One payment of utilizing SORTBY alternatively of SORT successful Excel is that you tin take much than 1 adaptable by which to benignant your data.
Staying with the aforesaid illustration arsenic above, let's present presume that portion you inactive privation to benignant the individuals by their points total, you privation everyone who has met their people to beryllium supra those who haven't successful the table. In different words, you privation to benignant the information by the Met? column, and then by the Points column.

After preparing the cells wherever the information volition go, including duplicating the file headers and deleting immoderate erstwhile SORTBY relation you typed, successful compartment G2, type:
=SORTBY(T_Targets,T_Targets[Met?],-1,T_Targets[Points],-1)where
- T_Targets is the array,
- T_Targets[Met?] is the archetypal sort-by file successful that array,
- -1 tells Excel to benignant T_Targets[Met?] successful reverse-alphabetical bid (the Ys supra the Ns),
- T_Targets[Points] is the 2nd sort-by column, and
- -1 tells Excel to benignant T_Targets[Points] successful descending order.
Here's the effect you'll get erstwhile you property Enter. Notice however the points totals for radical who have met their people are grouped unneurotic and displayed successful descending order, and the aforesaid goes for those who haven't met their target.

Using SORTBY With FILTER
The SORTBY relation tin beryllium utilized with different functions successful Excel to further refine the result. Specifically, I'll amusement you however to usage SORTBY with FILTER to benignant and filter the information successful a caller array astatine the aforesaid time.
Let's accidental your purpose present is to nutrient a effect that sorts the information by the Points column, but lone shows radical who scored much than 55 points overall.
After creating file headers for the effect successful enactment 1, successful compartment G2, type:
=FILTER(SORTBY(T_Targets,T_Targets[Points],-1),SORTBY(T_Targets[Points],T_Targets[Points],-1)>55)and property Enter.

Let's interruption this look down to research successful much item however it works.
The FILTER relation requires 2 arguments: the array and what to see successful the filter. So, the portion of the look that reads:
SORTBY(T_Targets,T_Targets[Points],-1)is the FILTER function's array argument. However, by nesting SORTBY successful this argument, you're telling Excel that the array is the array named T_Targets, but with the information sorted by the Points file successful descending order.
Then, the portion that reads:
SORTBY(T_Targets[Points],T_Targets[Points],-1)>55is the FILTER function's inclusion criteria. However, due to the fact that the array statement uses sorted data, you request the inclusion criteria to beryllium sorted arsenic well. In this case, the array containing the information to benignant is the Points column, and the aforesaid file is the array you utilized earlier to benignant the information successful descending order. Then, the last portion of the inclusion criteria tells Excel to lone see values successful this sorted array that are greater than 55.
SORT vs. SORTBY successful Excel
While the SORT and SORTBY functions are some intended to reorganize information based connected definite values successful the data, they enactment successful somewhat antithetic ways:
Formula syntaxes |
The SORT relation lets you specify the array, a file scale fig to benignant by, the benignant order, and the enactment to benignant by a enactment alternatively of a column. |
The SORTBY relation lets you specify the range, and up to 64 benignant array-order pairings. |
Sorting levels |
When utilizing the SORT function, you tin lone benignant by 1 enactment oregon column. |
When utilizing the SORTBY function, you tin benignant by up to 64 rows oregon columns. |
Argument references |
The enactment oregon file to benignant by is referenced by an scale number, meaning if you adhd oregon region rows oregon columns successful the archetypal data, this scale fig whitethorn go outdated. |
Since the array oregon arrays to benignant by tin beryllium a named reference—like file headers—this notation volition stay constant, adjacent if you adhd oregon region columns successful the archetypal data. |
Another mode to make a caller mentation of a dataset that you tin manipulate—all portion leaving the archetypal information intact—is to create a PivotTable. This almighty Excel instrumentality lets you summarize and reorganize your information successful assorted ways, meaning you tin rapidly make calculations and analyse your figures without utilizing analyzable formulas.