There are two main ways to sort data in Excel: using the Ribbon commands for quick sorting or using the SORT function with a formula.
Sorting Using Ribbon Commands
- Select the range of data to sort (make sure to select entire rows if sorting multiple columns).
- Go to the Data tab on the Ribbon.
- Choose Sort Ascending (A to Z) for sorting from smallest to largest or alphabetically A to Z.
- Choose Sort Descending (Z to A) to sort from largest to smallest or Z to A.
- For more customized sorting, select Sort or Custom Sort in the Sort & Filter group, then specify the column, sort order, and add multiple levels if needed.
Sorting Using the SORT Function
- The syntax is: =SORT(array, [sort_index], [sort_order], [by_col])\text{=SORT(array, [sort\_index], [sort\_order], [by\_col])}=SORT(array, [sort_index], [sort_order], [by_col])
- array : The range or array to sort.
- sort_index : Optional. Column or row number to sort by (default is 1).
- sort_order : Optional. Use 1 for ascending (default), -1 for descending.
- by_col : Optional logical value. FALSE (default) to sort by row, TRUE to sort by column.
- Example: =SORT(B5:C14, 2, -1)\text{=SORT(B5:C14, 2, -1)}=SORT(B5:C14, 2, -1) sorts by the second column in descending order.
Quickly sorting a column with multiple rows requires selecting all the data first to keep rows intact. Both methods let users sort text alphabetically or numbers by value.