Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 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: Sorting Data on Protected Worksheets.

Sorting Data on Protected Worksheets

by Allen Wyatt
(last updated February 17, 2020)


When you protect a worksheet, Excel stops users from performing a wide variety of tasks on the data in the worksheet. One of the things that the user can no longer do is to sort data. What if you want the user to be able to sort data, but still have the sheet protected?

The answer is quite easy: Excel allows you to specify what users can and cannot do with a protected worksheet. When you display the Review tab of the ribbon and click Protect Sheet in the Protect group (Changes group in earlier versions of Excel), Excel displays the Protect Sheet dialog box. At the bottom of the dialog box is a long list of check boxes. All you need to do is select what the user should be able to do with the worksheet. One of the options (you need to scroll down a bit) is Sort. If you select this option, then users can sort protected data.

There is a big caveat to keep in mind: All of the cells that will be involved in the sorting (or potentially involved in the sorting) must be unlocked. This includes any column headings for the data that may be sorted.

Before locking the worksheet, select all the cells that you want people to be able to sort. (A great way to do this is to select one of the cells then press Shift+Ctrl+8. The selected region is what Excel thinks should be sorted when a sort is done.) With those cells still selected, display the Protection tab of the Format Cells dialog box and clear the Locked check box. Now protect your worksheet and make sure you allow for sorting in the protection specifications.

If you fail to unprotect all the cells that may be involved in the sorting (even a single cell), then Excel won't allow sorting the data on the protected worksheet, even if you've instructed it to allow sorting.


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (137) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Sorting Data on Protected Worksheets.

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. ...


Freezing Cell Size when Inserting Pictures

Insert a picture into a table cell, and you may quickly find that the table is no longer the size you expected. Here's ...

Discover More

Forcing Excel to Sort Cells as Text

If you have a mixture of numbers and text in a column and you want to sort based upon that column, the results may not be ...

Discover More

Displaying a Calendar

Want to know what today is? How about the date for next Thursday or the second Friday in October? Windows can display a ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 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

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 ...

Discover More

Sorting while Ignoring Leading Characters

Want to ignore some characters at the beginning of each cell when sorting? The easiest way is to simply create other ...

Discover More

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

View most recent newsletter.


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 one less than 2?

2020-06-30 11:50:43


This method of allowing sorting on protected cells means the user is able to amend the data in the cells as they are unlocked.

How do you protect the worksheet, so sorting to take place, but not allow data amendments?

2020-05-04 22:22:39



Your tip is only useful if the data in the columns is all static. In my case, Cols A thru E are for data entry, and F thru H are calculated. How can I protect those formulas in F thru H from being fat-fingered, while still allowing data entry in A thru E and Sorting?



2020-04-09 00:03:02


Here's my situation -- I want a master table to be uneditable but need to filter and also SORT the data. Filtering alone works fine, but to allow sortation via the AutoFilter arrows requires more work. This master table is on a worksheet by itself. So...

1. Select all ROWS of the table, including the headers -- it is important that for the sort to work, whole rows must be selected.
2. Hit Format|Cells, go to Protection tab, make sure Locked is UNchecked, hit OK.
3. Hit Data|Filter, turn AutoFilter on.
4. Select Tools|Protect (or Protection, depending on your version of Excel), click Allow Users to Edit Ranges, click New..., click OK, click OK.
5. Select the call in row 1 immediately to the right of your table.
6. Hit Tools|Protect (or Protection, depending on your version of Excel), click Protect Sheet, check Sort and check Use AutoFilter -- everything else should be unchecked. Use a password if you need to, hit OK.

That's it! Now you can sort and filter until the cows come home using the auto-filter arrows. Remember with some earlier versions you may need to scroll upward to see the Sort Ascending/Sort Descending selections. Since you haven't allowed any cells (locked -OR- unlocked to be selected, they cannot be edited. Well, ALMOST...

In some earlier versions of Excel (for sure 2003), If you have your Formula Bar visible, you can manually select a cell (or named range) by typing it into the "current cell" name box -- if you then hit the DELETE button on your keyboard it will delete the contents of that cell (or named range). Also let's say you have cell A1 selected -- when you press ENTER, it will advance to A2, A3, etc., leaving whatever cell is displayed vulnerable to manual deletion. To minimize this possibility, I will put the cursor in a cell immediately to the right of the table in the first row (step 5 above). For example, my table is A1:G51, so I select cell H1 before protecting the worksheet. If you leave the whole table or all rows selected when you execute step 6, then you hit DELETE, your whole table will be gone. Later versions will not allow changing the current cell or a named range from the name box, so it is essentially write-protected as long as you've selected a non-critical cell prior to step 6.

A note about step 4... This is necessary to make the whole thing work properly. You have to specify this range of rows to allow edit explicitly. If you don't do this, when you open your workbook, you will only be able to change the sort order one time, then it won't allow you to do it again. You can save, close, and reopen the file and sort it again by another column, but this is cumbersone. By doing step 4, this workaround isn't necessary and it will work the way it should.

Now let's say you want to do as Philip asked, have a sheet with some coumns with protected data and some user-entered with the ability to sort that table. You can create a second worksheet in the same workbook, and either use array formulae and/or lookup formulae to create links to the protected data, then sort the resulting worksheet as desired.

2019-01-10 11:18:17


I have a macro for the auto sorting the workbook. but, when I used the protected and the shared workbook, the macro doesn't work. How can I solve this?

2018-11-29 05:27:41


Wow, its working thanks for help..............but cells not protected.........may be data lost.

2016-11-23 11:30:49

Linda Bias

I have followed the instructions on how to sort in a protected worksheet, and it is not working. Any other hints?

2016-08-16 14:39:44

Ismael Torres

Vicky, only leave the headers unlocked. The data cells can remain locked. In the Protect Sheet dialog check the cells to allow sorting and filtering so that these actions can be performed.
Still this has another implication which is the inability of reordering columns, but hopefully you can get by without that.

2016-07-05 10:40:29


The only problem with this method is that this then lets the users edit the formulas in the cells which is what I need to prevent. Is there anyway to lock the cell formulas but allow the sorting?

2016-01-21 13:29:19

Philip Kogan

I want to distribute worksheets with some blank columns that the users will enter data into. I do not want them to be able to change data in the columns that are already populated so I assume those cells/columns need to be locked.
But I want them to be able to sort the entire worksheet.
Is this possible? How do I do it? (I do not want to use a macro and have a link they have to click before sorting).
Thank you for your time and any help

2016-01-17 23:05:45


how to download example file?

2015-12-08 08:03:59

Jesenko Sokoljak

Works also in Excel 2003 but the header must be unlocked as well.
In Excel 2003 Ctrl-A selects the region.

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

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.