Javascript required
Skip to content Skip to sidebar Skip to footer

Draw Lines Between Cells in Google Sheets

Those who switch from using Excel to Google Sheets often miss the fact that there is no in-built feature in Google Sheets to split cells diagonally.

But if you still want to insert a diagonal line in Google Sheets, there are some workarounds that should work.

In this tutorial, I will show you a couple of methods to insert a diagonal line in Google Sheets.

Inserting the Diagonal Line With Text in the Cell

Since there is no in-built way to insert a diagonal line in a cell in Google Sheets, let's get a bit creative.

Suppose I have a dataset as shown below and I want to have a diagonal line in cell A1 so that below the line, I have the text 'Store' and above it, I have the text 'Month'

Data to add diagonal line in cell A1

Let's see a couple of methods to do this:

Using the Tilt Feature

While you cannot insert a diagonal line in Google Sheets, you can insert a regular horizontal line and then tilt it to make it look like a diagonal one.

Below are the steps to use the Tilt feature to insert a diagonal line:

  1. Select the cell that you want to split using a diagonal line (cell A1 in this example)
  2. Enter the text "Month" (which is the header for the first row)
  3. With the cell in the edit mode, hold the Alt key and press the Enter key (Option + Enter if using Mac). This would insert a line break and you would be able to type in the next line within the same cell.
  4. Enter a series of dashes (———-)Enter dashes below the word month
  5. Again, hold the ALT key and press the Enter key
  6. Enter the text "Store" (which is the header for Column A)

At this point, your cell would look something as shown below.

Insert the word store below the dashed

Now all you need to do is tilt the content of this cell so that the horizontal line becomes diagonal.

Below are the steps to do this:

  1. Select the cell (A1 in this example)
  2. Click the Format option in the menuClick on Format
  3. Hover the cursor over the 'Text Rotation' option
  4. In the options that appear, click on 'Tilt down'Click on Tilt Down
  5. Adjust the row height and column width accordingly (I made it bold, aligned the text to the middle and to the center)

The above steps would give you something as shown below.

Tilt method final result with split diagonal line

While this is not perfect, it gets the work done. It gives an impression that the text above the line is the header for the row and the text below the line is the header for the column

Note: When using this technique, you can not apply a border to the cell that has the headers, as that would show a tilted line in the cell.

You can also use the below formula to do the same, where the formula will return the cell content, and then you need to tilt it using the same steps covered above.

          =          "Month"          &          char          (          10          )          &          Rept          (          Char          (          8213          )          ,          6          )          &          char          (          10          )          &          "Store"        

Drawing a Diagonal Line and Adding the Text

Another good workaround to split the cell diagonally is to manually draw a line and add it to the cell.

Suppose I have the same dataset and I want to have both the headers in cell A1 with a split diagonal line separating both headings.

Data to add diagonal line in cell A1

Here is how to do this:

  1. In cell A1, enter the text Month
  2. With the cell in the Edit mode, hold the ALT key and press the Enter key (or Option + Enter if using Mac)
  3. Repeat step 2 a couple of times 2 or 3 more times (to get more distance between the cursor and the word 'Month')
  4. Enter the text Store. This would give you a cell as shown below (with two headings and a gap in between)Both words entered with space in between
  5. Click the Insert option in the menuClick the Insert option
  6. Click on DrawingClick on Drawing
  7. In the Drawing dialog box that opens, click on the 'Line' optionClick on drawing line
  8. Draw a diagonal lineLine inserted in the drawing dialog box
  9. Click on Save and Close. This will insert the line in the worksheet
  10. Resize the line and place it within the cell A1Adjust and fit the line in the cell
  11. Adjust the position of the word Month in the cell by adding a few spaces before it

This method gives a better-looking result as compared to the previous tilt method.

Final result with diagonal line in the cell

But there is one drawback of this method.

The line that we have inserted is not a part of the cell but an object that sits over the worksheet. While we have resized the line to make it fit within the cell, in case you resize the cell or you hide the column or filter it, this diagonal line would not follow the cell (i.e., it would not get resized or hidden with the cell)

A better workaround could be to use the image function and insert the image of a diagonal line within the cell.

Inserting Just the Diagonal Line in a Blank Cell

If all you want to do is insert a diagonal line within the cell in Google Sheets, there is an amazing sparkline chart technique that you can use.

Enter the below formula in the cell where you want the diagonal line, and you would get that as the result.

=Sparkline({1,0},{"color","black"})

Sparklinre formula to insert the diagonal line

The above formula creates a sparkline line chart with the cell with two data points, 1 and 0. This is why you get a diagonal line within the cell.

In case you want the diagonal in the other direction, use the below formula:

=Sparkline({0,1},{"color","black"})

Since we are using the sparkline chart, you would not be able to enter any data or use any formula to combine text with the sparkline chart formula.

The good thing about this method is that the line would stick with the self. So, if you hide the cell or filter the cell then because the line is apart of the cell it would follow the suit.

These are some of the methods that you can use to split a cell by inserting a diagonal line in Google Sheets.

I hope you found this tutorial useful.

Other Google Sheets tutorials you may like:

  • How to Insert Text Box in Google Sheets
  • How to Change Text Case in Google Sheets (Upper, Lower, or Proper)
  • How to Wrap Text In Google Sheets (with a single click)
  • How to Indent Text in Google Sheets

Related posts:

Draw Lines Between Cells in Google Sheets

Source: https://spreadsheetpoint.com/insert-diagonal-line-google-sheets/