Written by Allen Wyatt (last updated September 26, 2020)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021
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 is always applied.)
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8883) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021. You can find a version of this tip for the older menu interface of Excel here: Moving Cell Borders when Sorting.
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!
Government and industrial organizations often use a numbering system that relies upon a number both before and after a ...
Discover MoreWhen you sort information, Excel follows a set pattern of how your data is organized. This tip illuminates the burning ...
Discover MoreWant to sort addresses by even and odd numbers? By using a formula and doing a little sorting, Excel can return the ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments