Sort a range

Try Office 2010 In Excel 2010, it’s easier to sort data the way you want.
Watch a video or try Office 2010!

By using the sort commands, you can make more sense of the data in your rows by arranging them in ascending or descending order.

Sort rows in ascending order (A to Z, or 0 to 9) or descending order (Z to A, or 9 to 0)

  1. Click a cell in the column you would like to sort by.
  2. Click Sort Ascending Button image or Sort Descending Button image.

 Note    In a PivotTable report, Microsoft Excel uses the selected field to sort.

Sort rows by two or three criteria (columns)

For best results, the range you sort should have column labels, or headers.

  1. Click a cell in the range you want to sort.
  2. On the Data menu, click Sort.
  3. In the Sort by and Then by boxes, click the columns you want to sort, starting with the most important.
  4. Select any other sort options you want, and then click OK.

Sort rows by four criteria (columns)

  1. Click a cell in the range you want to sort.
  2. On the Data menu, click Sort.
  3. In the first Sort by box click the column of least importance.
  4. Click OK.
  5. On the Data menu, click Sort.
  6. In the Sort by and Then by boxes, click the other three columns you want to sort, starting with the most important.
  7. Select any other sort options you want, and then click OK.

Sort rows by months or weekdays

  1. Select a cell or range you want to sort.
  2. On the Data menu, click Sort.
  3. In the Sort by box, click the column you want to sort.
  4. Click Options.
  5. Under First key sort order, click the custom sort order you want, and then click OK.
  6. Select any other sort options you want, and then click OK.

Use your own data as the sort order

  1. In a range of cells, enter the values you want to sort by, in the order you want them, from top to bottom. For example:
Data
High
Medium
Low
  1. Select the range.
  2. On the Tools menu, click Options, and then click the Custom Lists tab.
  3. Click Import, and then click OK.
  4. Select a cell in the range you want to sort.
  5. On the Data menu, click Sort.
  6. In the Sort by box, click the column you want to sort.
  7. Click Options.
  8. Under First key sort order, click the custom list you created. For example, click High, Medium, Low.
  9. Click OK.
  10. Select any other sort options you want, and then click OK.

 Note    You can't use a custom sort order in a Then by box. The custom sort order applies only to the column specified in the Sort by box. To sort multiple columns by using a custom sort order, sort by each column separately. For example, to sort by columns A and B, in that order, first sort by column B, and then specify the custom sort order by using the Sort Options dialog box. Next, sort the range by column A.

Sort columns instead of rows

Most of the time, you sort rows. This procedure sorts the order of columns.

  1. Click a cell in the range you want to sort.
  2. On the Data menu, click Sort.
  3. Click Options.
  4. Under Orientation, click Sort left to right, and then click OK.
  5. In the Sort by and Then by boxes, click the rows you want to sort.

 Note    When you sort rows that are part of a worksheet outline, Microsoft Excel sorts the highest-level groups (level 1) so that the detail rows or columns stay together, even if the detail rows or columns are hidden.

Sort one column without affecting the others

Warning Be careful using this feature. Sorting by one column may produce results you don't want, such as moving cells in that column away from other cells in the same row.

  1. Click the column heading to select the column you want to sort.
  2. Click Sort Ascending Button image or Sort Descending Button image.

The Sort Warning dialog box is displayed.

  1. Select Continue with the current selection.
  2. Click Sort.

If the results are not what you want, click Undo Undo button.

 Notes 

  • To exclude the first row of data from the sort, because it is a column header, on the Data menu, click Data, and then under My data range has, click Header row.
  • To do a case-sensitive sort, on the Data menu click Sort, click Options, and then select Case sensitive.
  • To find the top or bottom values in a range, such as top 10 grades or bottom 5 sales amounts, use AutoFilter. For more information, see Filter a range.
 
 
Applies to:
Excel 2003