Excel.Tips.Net Welcome toExcel.Tips.Net

Helpful Links

Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment

Tips.Net Store

ExcelTips FAQ
ExcelTips Premium

Learn Access Now
Free Printable Forms

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

Newest Tips

Recording a Macro

Adding a Little Animation to Your Life

Converting a Range of URLs to Hyperlinks

Making the Formula Bar Persistent

Engineering Calculations

Digital Signatures for Macros

Fixing the Decimal Point

 

Performing Complex Sorts

Summary: One way you can easily work with data in a worksheet is to sort it into whatever order you find most helpful. Excel allows you to perform sorting based on the criteria you determine, as discussed in this tip. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)

By using the sorting capabilities of Excel you can perform complex sorting of either an entire list or any portion of a list. If you want to sort an entire list, you only need to select a single cell within the list. If you want to sort a portion of a list, you need to select those rows (they must be contiguous) that you want sorted.

  1. Display the Sort dialog box. (Click here to see a related figure.) In Excel 2007 display the Data tab of the Ribbon and then click on the Sort tool. In versions of Excel prior to 2007 choose the Sort option from the Data menu. Using this dialog box, sorting is performed according to criteria you set.
  2. Use the Sort By drop-down to select the field (or column) by which you want to sort.
  3. Use the subsequent Then By areas to specify secondary sorting keys. (In Excel 2007 you click Add Level each time you want to specify a secondary sorting key.)
  4. Specify for each sorting key whether you want that field to be sorted in ascending or descending order.
  5. Click the Options button to display the Sort Options dialog box (Click here to see a related figure.) where you can specify whether you want capitalization to matter and whether you want to sort rows or columns.
  6. Click on OK to close the Sort Options dialog box.
  7. Click on OK to complete your sort.

The First Key Sort Order option (from the Sort Options dialog box, step 5, in versions of Excel prior to Excel 2007) probably needs explanation. You will rarely need to change the value of this field. There will be times, however, when you will want to make changes. For instance, your primary sorting key might contain days of the week (Monday, Tuesday, Wednesday, and so on), and you want them to sort in proper chronological order. This is one of the sort orders you can specify in this field. You should pick a First Key Sort Order that most closely matches the needs of your data.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2919) applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007

A Picture is Worth Thousands! Your worksheets are not limited to holding numbers and text. You can also add graphics or easily create charts based on your data. Excel Graphics and Charts, available in two versions, helps you make your graphics and charts their absolute best.
 
Check out Excel Graphics and Charts today!