Written by Allen Wyatt (last updated April 30, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003
Let's say you have a list of company transactions. Each transaction includes a department number, a title, and other information (amount, date, time, sales rep, etc.). As you get more and more of these items in your list, you may want a way to automatically add "dividing lines" based on the department number. For instance, when the department number changes, you may want to include a line between the two departments.
To add this type of formatting to your list, start by sorting your data table by department. Then follow these steps:
Figure 1. The Conditional Formatting dialog box.
Figure 2. The Borders tab of the Format Cells dialog box.
That's it; you should now see a line that appears across the entire width of your data every time the department changes.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3189) 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: Automatic Lines for Dividing Lists.
Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!
Borders on all sides of a cell are easy to do in Excel. You can also create diagonal borders that run right through the ...
Discover MoreWant a quick way to replace background colors in cells? It's easy to do using Find and Replace, or you can simply use the ...
Discover MoreAdding borders around cells is a common formatting task. You can make the task more intuitive by actually drawing 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 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.
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