Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. 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: Storing Sorting Criteria.

Storing Sorting Criteria

by Allen Wyatt
(last updated March 29, 2014)

3

Stephanie often has to perform sorts of her data using the same criteria over and over again. For instance, she often needs to perform a sort that uses the same four columns. She wonders if there is a way to "store" a set of sorting criteria so she doesn't need to enter them over and over again.

There are a couple of ways that you can approach this issue. The first is to create custom views (described in other issues of ExcelTips) that include your data sorted in a desired manner. You can always store and recall the view to see it sorted as you want.

You could also make sure the data in your worksheets is defined as a formal data table. All you need to do is select a cell in the data and press Ctrl+T or display the Insert tab of the ribbon and click the Table tool. Once the data table is set up and you sort it, Excel stores the sorting criteria with the workbook so it is available when you later work with the table.

Perhaps the most flexible approach, however, is to perform your sorting in a macro instead of by using the Sort dialog box. You can easily use the macro recorder to set up and execute your sort; later running the macro will sort the same area over again, using the same criteria.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8346) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Storing Sorting Criteria.

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

Insert a TOC without Upsetting Pagination

Insert a table of contents in your document, and your page numbering may get thrown for a loop. If you want the page ...

Discover More

Problem with Menus Crashing Word

What do you do if, one day, one of your Word menus suddenly stops working and actually crashes the program? Here's the ...

Discover More

Printing Only Changed Pages

Turn Track Changes on, and you can easily see where you've made changes throughout a document. If you want to print only ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Sorting ZIP Codes

Sorting ZIP Codes can be painless, provided all the codes are formatted the same. Here's how to do the sorting if you have ...

Discover More

Sorting with Graphics

If you use graphics in a worksheet that are associated with certain cells (perhaps images of parts or icons for worksheet ...

Discover More

Performing Complex Sorts

One way you can easily work with data in a worksheet is to sort it into whatever order you find most helpful. Excel allows ...

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. 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?

2015-07-28 10:32:16

Jen

I have a weird one.

I have a spreadsheet that I inherited from a previous employee. I'm not sure what version of Excel it was created in, but when I got it, it had an .xls extension. We are currently running Office 2013 and Windows 7 in this office. I upgraded the spreadsheet to .xlsx, added a filter and some conditional formatting, and it's working fine. I just have this one problem.

When I first overhauled it, I set up a custom sort so that I could use the filter to filter and sort, and then when I finished what needed to be done, I could just run the custom sort, and it would sort the table correctly (sorting on two criteria.) I want it to work this way because the spreadsheet is being used by people who are not as versed in Excel as I am, and I don't want to overwhelm them. This was working fine for months. But suddenly, it stopped working... but only on my computer.

Now, when I clear the filter, it erases my custom sort. The spreadsheet is saved to a shared drive. I have tried having the other Excel whiz open the original spreadsheet on his computer, and I've had him try opening copies of it. On his computer, it works fine. On mine, clearing the filter clears the custom sort.

I did a lot of work on the spreadsheet in between the last time I know it worked, and the first time I noticed it not working, and I honestly don't even remember everything I did. But apparently did something. Any advice on this one?


2015-05-17 10:57:32

John McCarthy

I'm using Excel 2010 as part of MS Office 2010

Custom views are great, but they do NOT seem to store DIFFERENT sort criteria.

You can create subsets of rows and columns using hide column and filters,
and save different printing specifications

But when I tried to make
view A sorted by X
and
view A sorted by Y
it simply gives me whatever the last sort happened to be.

I then noted that the Help for Custom Views does not include sort as one of the things that are included.

Am I missing something?

Thanks,

John Mc


2014-03-31 15:58:23

Bryan

How does the data table store your sorting criteria? If you sort it one way, then sort another way, how can you get the first sort back?


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.