Hi. In this article, we will learn how to insert a diagonal line in a cell in google sheets using three different methods. A diagonal line inside a cell can be used to display more than one header or column, or more than one value or entity inside a cell. The purpose can be many and different for everyone, but the thing is, we don’t have any method natively inside google sheets to break a cell diagonally or add a diagonal line in a cell in google sheets.
Some users who have used excel in past maybe worry about this because in excel we have a simple direct method to insert a diagonal line in a cell. But in sheets, there is no direct method. So, in this article, we will see some indirect methods that can be used to insert a diagonal line in a cell in google sheets.
When to Insert a Diagonal Line in a cell in Google Sheets
Many times, we have data, especially data headers, where we want to separate a single cell by a line to write two different headers or x/y-like headers. Sometimes we need to write two things inside a cell but show them like OR, or showing them like PER, there are many use cases where we could need this feature, but this is not directly available in google sheets. We need to learn some workaround to learn how to insert a diagonal line in a cell in google sheets. In this article, we will three methods of doing this.
We often need to have a diagonal line in an empty cell, which is supposed to be filled by two values after print. Are you getting my point? We are designing a format for an audit report, so there we need to have empty spaces which are used by the auditor after the format is printed. So, therefore, there can be many use cases where we need to insert a diagonal line in a cell in google sheets.
How to Insert a Diagonal Line in a cell in Google Sheets
We will see various methods, firstly we will see how to insert a simple and basic diagonal line in a cell with some content, then we will see how to add a line over a cell with content, and last we will see a method which is used to insert a diagonal line in a cell without content means adding a diagonal line with no other content in a cell. We will also see various how to insert a line with various colors inside an empty cell.
Insert a Diagonal Line in a cell in Google Sheets – By Cell Rotation
In this section, we will learn how to insert a diagonal line in a cell in google sheets using a manual method, which is by adding some dashes within a cell to look like a line and then changing the rotation of the entire cell. This method fails when we need to change the size of the columns frequently, but still, this is one of the simple methods and you just need to learn this.
For all these examples I have dummy data in which the headers need to have double values.
Step 1
Sample data
Step 2
In the header, we need to add a diagonal line between Jan and another word
Step 3
For doing this simply add a line break after the first word “Jan”
Step 4
Now add various dashes ——– like this to make a line-like shape.
Step 5
Now, it is not looking like a diagonal line, it is a horizontal line.
Step 6
Now keep the cell selected, and go to Format
Step 7
Inside Format menu > Rotation > Tilt up
Step 8
Now the selected cells have been tilted up.
Step 9
Now you can adjust the column width
This is how to insert a diagonal line in a cell in google sheets.
Insert a Diagonal Line in a cell in Google Sheets – Using Drawing
In this section, we will learn how to insert a diagonal line in a cell in google sheets using the drawing method. Now, the drawing method is already covered many times in this series of articles. We can draw any shape in the drawing tool and then we can add it over cells in the sheets. But there is a problem with this method, the line is over cells and not inside the cells so, if a column or row is deleted or added then a problem can appear. But still, it’s a useful method, and let’s see how we can use it.
Step 1
The same sample tilted headers
Step 2
Give appropriate spaces in the text content
Step 3
Go to Insert > Drawing
Step 4
Click on the line in the drawing tool menu
Step 5
Drag your mouse and draw a diagonal line using the Shift key for equal proportion.
Step 6
You can select the color of your line, and you also have many other editing options.
Step 7
Once you’re done, now click and Save and Close button on the top right of the drawing window.
Step 8
Your artwork is now on your sheet over cells, you can resize it by holding the handles on the corners of the box
Step 9
Place it on the diagonal position of the cell
This is not an optimum way, but still, if you are doing this after completing your work then it is one of the most useful methods to insert a diagonal line in a cell.
Insert a Diagonal Line in a cell in Google Sheets – Empty cell
In this section, we will learn how to insert a diagonal line in a cell in google sheets empty cell. Here empty cell means, that you want to make a section using a diagonal line, and this section will be used physically after the sheet is printed out. Examples are physical banking forms, where we have several boxes to fill out our details and many sections using diagonal, horizontal, or vertical lines. So, let’s see how we can do this.
For this, I have the same sheet and I will use this in a way that will be usable after print.
In this example, I have a simple template for an audit report, where I have hours, and within a column, I have two quantities, 1 is checked quantity, and the other is defective quantity. So, this audit report is physical, so I need to insert diagonal lines in it, I don’t need any text so I am using the below method, which can not be used with text.
Step 1
Sample data
Step 2
Select the first cell of the first column after the header
Step 3
Write down the SPARKLINE formula
=SPARKLINE({1,0})
The arguments 1 and 0 are for a diagonal line, 0 and 1 can be replaced by each other to make a rotated diagonal
Step 4
If I replace 1 with 0 and keep 0, 0 for both arguments, then the line created will be horizontal, similarly, if I keep both arguments as 1, 1 then the line will also be horizontal.
Step 5
You can also give color to your line by adding another optional argument that defines that color name with an attribute “color”.
Below is the formula to add a blue line, you can write any color name.
=Sparkline({1,0},{“color”,”blue”})
Step 6
Now simply copy and paste in all the cells.
I hope you find this tutorial helpful.
Download/Copy Google Sheets Workbook
Note: Don’t ask for editor access. Make your copy for your practice
Important Notes
- The sparkline function takes a complete cell and does not let you write any other value, text, or number in that cell. If you need to use this function, so you have to leave that cell empty with a line only
- The line or any artwork you draw using the drawing tool is always kept over cells in the sheets. It is not associated with that cell, so we manually have to adjust its position and size just like that to make it look integrated with the cell, while in reality, it’s only floating over that cell with a relative position.
- The first method included some dashes and then a rotation to tilt method, this method is mostly used, this way the text is also tilted up, there are more options for rotating a text inside a cell, and you also have a custom angle option by which you can set the degree of rotation.
Frequently Asked Questions
Why do we need to insert a diagonal line in a cell in google sheets?
We need to insert a diagonal line in a cell in google sheets to make a section for more than one text in our header cell. They can also be used in an empty cell without any text. We discussed three methods that can be used with any use case you are having.
Conclusion
So this was all about how to insert a diagonal line in a cell in google sheets. We have discussed three different methods. The first method was the simplest method in which we saw how to add dashes between two pieces of text and then rotate the cell content using a built-in tilt-up feature, then we saw a drawing method in which we drew a line using a drawing tool and then added it over the cell to make it look like a diagonal line. In this method, we need to add appropriate spaces before and after the texts to make them clean and readable. Then finally we saw a function that help us draw a miniature line in a cell.
I hope you find this article helpful and that you have learned something new from it. Thank you for reading. Keep learning with Office Demy.