How to Make Lines in Excel: Borders and Shapes Guide
In this article
To make lines in Excel, you can either apply cell borders for structured data organization or insert shape lines for custom visual markers. Borders are best for creating tables and separating headers, while shapes are ideal for diagrams, arrows, or dividing sections of a worksheet. Depending on your goal, you will use the Home tab for borders or the Insert tab for drawing lines.
What You'll Need
- A computer with Microsoft Excel installed (Windows or macOS).
- An open workbook or a new blank worksheet.
- A mouse or trackpad for precise placement of shapes.
Step-by-Step
Method 1: Creating Lines Using Cell Borders
Borders are the most common way to create lines in Excel because they snap to the grid, ensuring your data remains aligned. Note that menu labels may differ slightly depending on your version of Excel or region.
- Select the Cells: Click and drag your mouse to highlight the specific cells where you want the lines to appear. If you want a line across the bottom of a row, select the entire row or the specific range of cells in that row.
- Open the Border Menu: Go to the Home tab on the top ribbon. In the Font group, look for the Borders icon (it looks like a small window grid). Click the small downward arrow next to this icon to open the dropdown menu.
- Choose Your Line Type: From the dropdown, select the specific line you need. Common options include:
- Bottom Border: Places a line only at the base of the selected cells.
- Top Border: Places a line only at the top.
- All Borders: Creates a full grid around every selected cell.
- Outside Borders: Places a line only around the perimeter of the selected group.
- Customize Line Style and Color: If you need a thicker line, a dotted line, or a specific color, scroll to the bottom of the Borders dropdown menu and select Line Color to pick a hue, or Line Style to choose the thickness and pattern.
- Apply Custom Styles: After selecting a custom style or color, your cursor may change to a pencil. You can now click and drag directly over the cell edges to "draw" the lines manually, or you can return to the Borders menu and select the desired border placement to apply that specific style.
Method 2: Creating Lines Using Shapes (Drawing)
Use this method when you need a line that isn't tied to a cell, such as a diagonal line across a cell or a line that floats over your data.
- Navigate to Insert: Click on the Insert tab in the top ribbon.
- Select Shapes: In the Illustrations group, click on Shapes. This will open a gallery of available drawing tools.
- Choose the Line Tool: Under the Lines category, click on the simple straight line icon.
- Draw the Line: Click and hold your left mouse button on the worksheet where you want the line to start, drag the cursor to where you want the line to end, and release the button.
- Ensure a Straight Line: To make a perfectly horizontal or vertical line, hold down the Shift key on your keyboard while you drag the mouse. This snaps the line to 45-degree increments.
- Format the Shape Line: Once the line is drawn, the Shape Format tab will appear in the ribbon. Click this tab to access Shape Outline, where you can change the color, weight (thickness), and dash style (solid, dashed, or dotted).
Method 3: Creating Diagonal Lines in a Single Cell
Diagonal lines are often used in the top-left cell of a table to separate the row header from the column header.
- Select the Cell: Click on the single cell where you want the diagonal line.
- Open Format Cells: Right-click the cell and select Format Cells... from the context menu. Alternatively, press Ctrl + 1 (Windows) or Command + 1 (Mac).
- Go to the Border Tab: In the Format Cells dialog box, click the Border tab at the top.
- Select the Diagonal Line: In the border preview area, you will see two small diagonal line buttons in the corners. Click the one that slopes in the direction you need (top-left to bottom-right or top-right to bottom-left).
- Confirm: Click OK. The line will now be fixed within that cell, regardless of how you resize the row or column.
Common Mistakes
One of the most frequent errors is confusing gridlines with borders. Gridlines are the faint grey lines you see by default in Excel; they are visual guides and do not print. If you print a document and the lines are missing, it is because you used gridlines instead of actual borders. Always apply borders if you want the lines to be visible on a physical printout or a PDF.
Another common mistake is drawing too many individual shape lines. If you use the Insert Shape method to create a table, the lines will not move when you resize columns or rows. This leads to a messy spreadsheet where lines overlap text or leave gaps. For any data-driven layout, always prefer the Border method over the Shape method.
Users also frequently forget to hold the Shift key when drawing lines. Without the Shift key, lines are often slightly tilted, which looks unprofessional in a business report. If your line looks "almost" straight but not quite, delete it and redraw it while holding Shift.
Tips
To speed up your workflow, use the Format Painter. If you have spent time creating a complex border style (e.g., a thick double-bottom border with a specific blue color), select that cell, click the Format Painter (brush icon) on the Home tab, and then click other cells to apply the exact same line style instantly.
For a cleaner look, consider removing the default gridlines entirely. Go to the View tab and uncheck Gridlines. This makes your custom borders stand out more and gives your spreadsheet a professional, app-like appearance.
When using shapes, use the Align tool found in the Shape Format tab. If you have multiple lines, you can select them all (hold Ctrl while clicking) and use the Align Left, Align Center, or Distribute Horizontally options to ensure they are perfectly spaced.
Troubleshooting
The line is not appearing after I select it: Check your line color. If the line color is set to white or a very light grey, it may be invisible against the background. Go back to the Borders menu > Line Color and select Black to verify if the line is there.
I can't select the line I drew: If you have many layers of shapes or data, you might be clicking on a cell instead of the line. Try clicking near the end of the line or use the Selection Pane (found under Page Layout > Selection Pane) to see a list of all shapes on the sheet and select the line from the list.
The diagonal line is cutting through my text: Diagonal lines in cells are purely decorative. They do not push text aside. To fix this, type your two header words in the cell, then use Alt + Enter to put them on separate lines. Use the space bar to push the top word to the right side of the cell so it sits above the diagonal line.
Borders are not printing: Ensure that you are not in "Page Break Preview" mode and that the borders are actually applied. Check the Print Preview (Ctrl + P) to see if the lines appear. If they don't, re-apply the borders using the Home tab.
Frequently Asked Questions
How do I remove all lines from my spreadsheet?
Select the entire worksheet by clicking the triangle in the top-left corner of the grid. Go to the Home tab, click the Borders dropdown arrow, and select No Border. This will strip all custom lines from the selected area.
Can I make a line that spans across multiple columns?
Yes. Select the range of cells you want the line to cover, then apply a Bottom or Top border. Alternatively, you can Merge and Center the cells first and then apply a border to the single resulting large cell.
How do I change the thickness of a border line?
Go to Home > Borders dropdown > Line Style. Select the thicker line from the options provided. Once selected, you must re-apply the border (e.g., click "Bottom Border") for the thickness to take effect on the cells.
Is there a way to automatically add lines when I enter data?
Yes, using Conditional Formatting. Select your data range, go to Home > Conditional Formatting > New Rule. Choose "Use a formula to determine which cells to format." Enter a formula like =A1<>"" (which means "if the cell is not empty"). Then, click the Format button, go to the Border tab, and select the lines you want. Excel will now automatically draw lines as you type.
Can I draw a curved line in Excel?
Yes. Go to Insert > Shapes and select the Curve or Scribble tool. Click at various points on the worksheet to create the curve, and double-click to finish the line.