Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Moving Cell Borders when Sorting.
by Allen Wyatt
(last updated December 20, 2014)
Frank has a simple two-column table that contains random dates in the first column and the letters A through E in the second column. He formats the cell containing the letter C so it has a background color and a border around the cell. When Frank sorts the table according to what is in the first column, Excel moves the background color with the C cell, but it doesn't move the border. Frank wonders if there is a way to move both the color and border of a cell when sorting.
The solution is to change how you are doing your formatting. Excel provides two types of formatting that can be applied to cells—regular formatting and conditional formatting. If you apply regular formatting, then what moves when you sort can seem rather arbitrary. If you apply conditional formatting, then all the formatting applied by the condition (or conditions) will move with the cell when you sort.
So the answer to the question is to change how you do your formatting in this instance. Just apply a conditional format that modifies the border of the cell, and then you can sort in peace. (The condition you set could easily be one that is always True, and thus the formatting always applied.)
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8881) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Moving Cell Borders when Sorting.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
One way you can easily work with data in a worksheet is to sort it into whatever order you find most helpful. Excel ...Discover More
As yo get more and more worksheets into a workbook, you'll find yourself moving them around into different sequences. You ...Discover More
Need to sort your data based on the color of the cell? Excel doesn't include this capability, but you can still do the ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.