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

When to Hyphenate Your Document

Want to add a finishing touch to your printed document? Hyphenating the words in the document can make your text read ...

Discover More

Quickly Deleting Rows and Columns

Deleting rows or columns is easy when you use the shortcut described in this tip. Just select the rows or columns and ...

Discover More

Replacing Formatting Functions as a Toggle

Sarra is having a problem getting Find and Replace to behave properly when replacing italic-formatted text. This tip ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

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

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

Sorting Letters and Numbers

Sorting information in a worksheet can be confusing when Excel applies sorting rules of which you are unaware. This is ...

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. 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 eight more than 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.