Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Performing Complex Sorts.

Performing Complex Sorts

Written by Allen Wyatt (last updated February 27, 2021)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


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 Data tab of the ribbon.
  2. Click the Sort tool. Excel displays the Sort dialog box. Using this dialog box, sorting is performed according to criteria you set. (See Figure 1.)
  3. Figure 1. The Sort dialog box.

  4. Use the Sort By drop-down to select the field (or column) by which you want to sort.
  5. Click Add Level each time you want to specify a secondary sorting key.
  6. Specify for each sorting key whether you want that field to be sorted in ascending or descending order.
  7. Click the Options button to display the Sort Options dialog box where you can specify whether you want capitalization to matter and whether you want to sort rows or columns. (See Figure 2.)
  8. Figure 2. The Sort Options dialog box.

  9. Click on OK to close the Sort Options dialog box.
  10. Click on OK to complete your sort.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7216) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Performing Complex Sorts.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Creating Selections

Want a really easy way to create a selection of a group of cells? Discover how to use the Extend key to make this task ...

Discover More

Printing a Bookmark List with Contents

Bookmarks can be a great tool in Word, allowing you to easily remember the location of desired blocks of text. If you ...

Discover More

Controlling Automatic Formatting of Dates

When you enter something into a cell, Excel tries to figure out if your entry should be formatted in a particular way. ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Sorting Data Containing Merged Cells

When formatting the layout of your worksheet, Excel allows you to easily merge adjacent cells together. This can cause ...

Discover More

Controlling Sorting Order

When you sort information in a worksheet, you have control over the order in which that information is sorted. Here's a ...

Discover More

Too Many Formats when Sorting

Sorting is one of the basic operations done in a worksheet. If your sorting won't work and you instead get an error ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is one less than 9?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.