When working with data in Excel and creating reports/dashboards, sometimes you would have a need to split a cell diagonally.
This is helpful when you want to show two separate headings within the same cell – one for the row and one for the column (as shown below in cell A1).

And being the super awesome spreadsheet tool that Excel is, there is an inbuilt way to easily insert a diagonal line within a cell in Excel.
In this tutorial, I will show you how to quickly split a cell diagonally in Excel, add a header on each side of the line, and fill each half with a different color.
So let’s get started!
Follow along with the example file
Split Cell Diagonally Excel.xlsx
Inserting a Diagonal Line in Excel
Suppose you have a data set as shown below and you want to insert a diagonal line in cell A1 (this is the Practice sheet in the example file).

Below are the steps to do this:
- Select the cell in which you want to insert the line (which is cell A1 in our example)
- Click the Home tab

- In the Font group, click on the dialog box launcher icon (the small, tilted arrow at the bottom right of the group)

Pro Tip: Instead of steps 2 and 3, you can use the keyboard shortcut Control + 1 (Command + 1 on a Mac) to open the Format Cells dialog box. It works from any tab, so you don’t need to go to the Home tab first.
- In the Format cells dialog box, click on the ‘Border’ tab

- In the Border section, click on the diagonal line icon at the bottom right of the section (as shown below). This will also show you the live preview of how the cell would look like

This icon draws the line from the top-left corner of the cell to the bottom-right corner. The icon at the bottom left of the same section draws it the other way, from the bottom-left corner to the top-right corner.
- Click Ok
The above steps would insert a diagonal line within the selected cell. In case you have selected multiple cells, this would insert the diagonal line in all the selected cells.

You can also customize the line that is inserted.
For example, you can choose the thickness of the line or the color of the line that should be inserted in the cell. The setting is right there in the format cells dialog box, in the Line section of the Border tab (as highlighted below).
You first need to make the Style and Color selections (if needed) and then click on the diagonal border icon.

You can also use the same method to insert a diagonal line in merged cells. The line runs from corner to corner of the whole merged area, not through each of the original cells.
A diagonal border always goes from one corner of the cell to the opposite corner. If you need a line at a different angle, you can draw a line using the Shapes option and place it over the cell.
Split a Cell Diagonally and Add Text on Both Sides
Now that we have the diagonal line in the cell, all you have to do is insert the text for the two headers and space it out a little bit to make it look as if it’s separated by the tilted line.
Let’s say I want to insert the header ‘Month’ at the top and ‘Country’ at the bottom within the same cell (the finished version is on the Diagonal Header sheet in the example file).

Below are the steps to do this:
- Select the cell that already has the diagonal line
- Double click on the cell, or press the F2 key on your keyboard to get into the edit mode
- Enter the text ‘Month’ (which is the header title for the first row)

- While still being in the edit mode, hold the ALT key and press the Enter key (or Control + Option + Return if you’re using Mac). This will insert a line break and take your cursor to the next line within that same cell
- Enter the text ‘Country’ (which is the header title for the first column)

- Press Enter to get out of the edit mode, and then select the cell again
- Adjust the formatting (such as make it bold, align text to the left, increase the row height), and add some space characters before the ‘Month’ header to push it a little to the right
To add the spaces, get back into the edit mode and place your cursor before ‘Month’.

The above steps would insert two headers in the same cell and make it appear that these are being divided by a diagonal line.
The number of spaces you need depends on your column width, so keep adding them until ‘Month’ clears the line.
Note that this doesn’t create two cells. Cell A1 still holds one piece of text (the spaces, Month, a line break, and Country), so a formula that refers to A1 gets all of it together.
Also read: Get New Line in Cell in Excel
Use Distributed Alignment Instead of Adding Spaces
Adding space characters works, but you have to adjust them by hand whenever you change the column width. If your two headers are single words, you can let Excel do the spacing for you.
Below I have the same sales data with a diagonal line in cell A1, and I want ‘Country’ below the line and ‘Month’ above it (the finished version is on the Distributed Text sheet in the example file).

The cell also has to be big enough for this. At the default column width, the two words stack on top of each other, so make the cell bigger first (here, column A has a width of 20 and row 1 has a height of 42).
The Practice sheet already has this size, so you can try the steps there, after adding the diagonal line to cell A1.
Below are the steps to space out the two headers using Distributed alignment:
- Select cell A1, enter the text Country Month (with one space between the two words and no line break), press Enter, and then select cell A1 again

- Press Control + 1 to open the Format Cells dialog box and click on the ‘Alignment’ tab

- In the Horizontal drop-down, select Distributed (Indent)

- In the Vertical drop-down, select Center

- Click OK
Excel pushes the first word to the left edge of the cell and the second word to the right edge, which is why ‘Country’ goes first. Each word now sits on its own side of the line.

This only works well with two single-word headers, because Excel spreads every word across the cell. With a third word, one of the words ends up sitting on the line, so use the line break and spaces method for longer headers.
Split a Cell Diagonally and Fill Half With Color
A diagonal border only draws a line. A cell’s fill color always covers the whole cell, so you can’t color just one half of it from the Format Cells dialog box.
To get two colors, you can fill the cell with one color and place a right triangle shape over the other half. One header goes in the cell and the other goes inside the triangle.
Below is the same sales data, and I want the top half of cell A1 in blue to match the month headers and the bottom half in yellow to match the country names (the finished version is on the Two Colors sheet in the example file).

‘Country’ has to fit inside the triangle, and in a cell of the default size the text gets cut off. So make the cell bigger first (here, column A has a width of 20 and row 1 has a height of 42).
The Practice sheet already has this size, so you can try the steps there.
Below are the steps to split cell A1 into two colors:
- Select cell A1 and pick the color for the top half from the Fill Color option in the Home tab

- Enter the text ‘Month’ in the cell and press Enter. Select cell A1 again, then click on Top Align and Align Right in the Home tab to place it in the top-right corner

- Click the Insert tab, click on Shapes, and choose Right Triangle from the Basic Shapes section

- Hold the ALT key and drag from the top-left corner of cell A1 to its bottom-right corner (holding ALT makes the shape snap to the cell edges)

- In the Shape Format tab, click on Shape Fill and choose the color for the bottom half

- Click on Shape Outline and choose No Outline

- With the triangle still selected, type ‘Country’ and press the Escape key to select the whole triangle. Then change the font color to black and make the text bold in the Home tab (the text inside a shape is white by default)

The triangle moves and resizes with the cell when you change the row height or column width, so the split stays lined up.
It’s still a shape sitting on top of the cell though. ‘Country’ lives in the triangle and only ‘Month’ is in cell A1, so a formula that refers to A1 only sees ‘Month’.
You may also see a two-color gradient suggested for this (Format Cells > Fill > Fill Effects). It does give you two colors in one cell, but they blend into each other, so you don’t get a clean split.
Add Two Diagonal Lines to Cross Out a Cell
You can also use both diagonal lines together to put an X through a cell. This is useful when you want to show that a cell is empty on purpose.
Below is sales data where Brazil and the UK have no sales in the first few months, and I want to put an X in those empty cells (the finished version is on the Crossed Out Cells sheet in the example file).

You can try the steps on any cells on the Practice sheet.
Below are the steps to do this:
- Select the cells you want to cross out (B6:C6 and B7:E7 in our example, holding the Control key to select the second range)

- Press Control + 1 to open the Format Cells dialog box and click on the ‘Border’ tab

- In the Border section, click on both the diagonal line icons (the one at the bottom left and the one at the bottom right)

- Click OK
Each selected cell gets its own X.

This puts the X through the cell, not through the text in it. If you want a line through the text instead, use strikethrough.
How to Remove the Diagonal Line in the Cell
If you want to get rid of the line within the cell, just follow the same steps and you can remove it in the same Format Cells dialog box.
Below I have the same sales data with a diagonal line in cell A1, and I want to remove that line (you can try this on the Diagonal Header sheet in the example file).

Select cell A1 and press Control + 1 to open the Format Cells dialog box. In the Border tab, click on the None option in the Presets and then click on OK.

This will make the diagonal line go away.
Note that None removes all the borders from the selected cell, not just the diagonal line. If your cell has other borders you want to keep, click on the diagonal line icon again in the Border tab to turn it off, and then click on OK.
So this is how you can easily split the cells diagonally in Excel by inserting a line using the format cells dialog box options.
I hope you found this tutorial useful.
Other Excel tutorials you may also like:
- How to Indent in Excel (3 Easy Ways + Keyboard Shortcut)
- How to Add Bullet Points in Excel
- How to Split Cells in Excel (separate into multiple columns)
- How to Freeze Row/Column Headers
- Working with Gridlines in Excel: How to Add, Remove, Change, and Print Gridlines
- How to Rotate Text in Cells in Excel
- How to Split Screen in Excel (Compare Side-by-Side)
- How to Insert/Draw a Line in Excel (Straight Line, Arrows, Connectors)
- How to Write Vertically in Excel
- How to Split Multiple Lines in a Cell into a Separate Cells / Columns