Excel guide · 5 min read
How to add borders in Excel
Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| Row | A | B | C |
|---|---|---|---|
| 1 | Month | Category | Amount |
| 2 | Jan | Rent | 2400 |
| 3 | Jan | Utilities | 315 |
| 4 | Jan | Supplies | 188 |
| 5 | Feb | Rent | 2400 |
| 6 | Feb | Utilities | 342 |
| 7 | Feb | Software | 560 |
| 8 | Mar | Rent | 2400 |
| 9 | Mar | Utilities | 298 |
| 10 | Total | 8903 |
Download this sheet as an Excel practice file (.xlsx)
Borders vs gridlines
The grey grid you see on screen is gridlines. They don't print by default and they vanish when you fill cells with a color. Borders are formatting you add on purpose: they print, they show over fills and they stay when gridlines are turned off. If you only want lines on a printout of a whole sheet, printing gridlines is quicker. If you want specific lines, such as a box around a table or a line above a total, use borders.
Method 1: the Borders menu
The sample is a list of office expenses. A typical finish: All Borders on the data, a heavier box around the whole table and an accounting-style line under the total.
- Select A1:C9 and choose Home > Borders arrow > All Borders.
- Select A1:C10 and choose Thick Outside Borders. It replaces only the outer edge.
- Select A10:C10 and choose Top and Double Bottom Border, the classic look for a total row.
- To remove lines, select the cells and choose No Border.
Why does clicking the Borders button add the wrong border?
The button itself repeats the last style you used; only the arrow opens the menu. Click the arrow, or use Alt+H, B on Windows to open the menu from the keyboard.
Method 2: custom color, thickness and diagonals
More Borders at the bottom of the menu opens the Border tab of Format Cells (Ctrl+1 gets you there too). The order matters: pick the line first, then say where it goes.
- Select the cells and choose Borders arrow > More Borders.
- Under Line, pick a Style (a thicker line for emphasis) and a Color.
- Click Outline, Inside or both under Presets, or click individual edges in the preview. The two diagonal buttons draw a line corner to corner, used to strike out an unused cell.
- Check the preview, then click OK. If an existing border should change width, re-click its button after choosing the new style.
Method 3: draw borders with the mouse
For irregular layouts, such as a form, drawing is faster than selecting. Under Borders arrow, pick Line Color and Line Style first, then Draw Border (outer edges of whatever you drag over) or Draw Border Grid (every line). The pointer turns into a pencil. Erase Border turns it into an eraser for removing lines. Press Esc, or click the same option again, when you're done.
Keyboard shortcuts
On Windows, Ctrl+Shift+& draws an outline around the selection and Ctrl+Shift+_ removes the outline. On a Mac, use Cmd+Option+0 and Cmd+Option+Hyphen, and Cmd+Option+arrow keys add a single edge. For anything else, Alt+H, B opens the Borders menu and the underlined letters pick a style. See the formatting shortcuts for the full list.
Add a line every time the month changes
In a long list sorted by month, a line between months makes groups easy to read. Drawing them by hand breaks as soon as rows are added. A conditional formatting rule draws them for you: the bottom border appears wherever the month in the next row is different.
- Select A2:C9.
- Go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format.
- Type =$A2<>$A3. The $ locks the column so every cell in the row checks the month; the row stays relative.
- Click Format, go to the Border tab, pick a line and click the bottom edge, then OK twice.
Result: TRUE
TRUE: row 4 is the last Jan row and row 5 starts Feb, so row 4 gets the line. For row 2 (Jan above Jan) the same test is FALSE and no line is drawn.
Why can't I pick a thick line in the rule?
Conditional formatting only offers the thinner line styles. Use a darker color to make the line stand out.
Why borders disappear or end up in the wrong place
Borders belong to cells, so they travel with them. Sort the list and the line you drew under the last row moves to wherever that row lands. Paste a block over bordered cells and the pasted formatting replaces the borders; Paste Special > All except borders (Ctrl+Alt+V, then X) pastes everything else.
Neighbouring cells share an edge. Box B1:C5 and D1:D5 shows a left border, because it's the same line. If two styles meet on one edge, the last one applied wins. A right border on a range only goes on its outer right edge, not inside it.
Dotted borders print as solid lines by design, and a box split by a page break only closes on one page unless you add an inside border across the break. For tables that grow and get sorted, Insert > Table (Ctrl+T) is the maintenance-free option: the table style draws the lines and keeps them right as rows are added.
Result: 8903
8903: the total that sits above the double line. If you sort the data with the total inside the selection, both the total and its border move into the middle of the list, so leave the total row out when you sort.
Common mistakes
Clicking the Borders button instead of the arrow
The button repeats the last border used. Open the arrow to choose.
Drawing separator lines by hand in a list that gets sorted
Use a conditional formatting rule like =$A2<>$A3 so the lines follow the data.
Expecting gridlines to print like borders
Gridlines don't print unless you turn on Page Layout > Gridlines > Print. Add borders for specific lines.
Choosing the position before the line style in More Borders
Pick Style and Color first, then click the edges, or the old style is used.
FAQ
What is the shortcut for borders in Excel?
Ctrl+Shift+& adds an outline border and Ctrl+Shift+_ removes it on Windows. Alt+H, B opens the full Borders menu. On a Mac, Cmd+Option+0 adds an outline.
How do I add all borders in Excel?
Select the range, then Home > Borders arrow > All Borders. Every cell gets a line on all four sides.
How do I make borders thicker in Excel?
Choose Thick Outside Borders from the menu, or More Borders, pick a thicker style under Line and click the edges again.
How do I remove borders in Excel?
Select the cells and choose Home > Borders arrow > No Border, or press Ctrl+Shift+_ to remove the outline. Erase Border removes single lines with the mouse.
Why are my borders not printing?
Check you added borders, not just gridlines, and that the cells are inside the print area. Very light colors can also fade out on paper.
Functions used
Related guides
- How to change the default font in Excel
- How to split a cell in Excel
- How to print gridlines in Excel
- Excel gridlines not showing (or missing in some cells): how to get them back
- How to use Format Painter in Excel
- How to abbreviate large numbers in Excel: thousands (K), millions (M), billions (B)
- Excel opens to a blank grey screen: how to see your workbook
Updated