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

Spacing After Sentences

Word can check to see if you have a consistent number of spaces at the end of your sentences.

Discover More

Translating Text

Word includes several different tools you can use to improve your writing. One such tool is the translation tool. Here's ...

Discover More

Conditional Formatting in PivotTables

Conditional formatting is very powerful, and you can use it to dynamically adjust how your data looks. Excel allows you ...

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)

Moving Cell Borders when Sorting

Sort your data and you may be surprised at what Excel does to your formatting. (Some formatting may be moved in the sort ...

Discover More

Ignoring Selected Words when Sorting

If you use Excel to maintain a list of text strings (such as movie, book, or product titles), you may want the program to ...

Discover More

Sorting IP Addresses

If you keep track of IP addresses in an Excel worksheet, you probably already know that it is difficult to sort those ...

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 6 - 0?

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.