Google Sheets is a common name when dealing with real-time data organization in a spreadsheet. It’s filled with users who migrated from MS Excel in search of better file sharing and cloud sync features. People who’ve used Sheets are already familiar with most of its functions but there are some which are easy but rarely used.
One such function is merging cells, It can be really daunting for some when you want to combine a cell but somehow aren’t able to find the perfect way to do it. So without further delay, let’s see how you can merge cells and handle tables.
How to Combine Cells in Google Sheets
It syncs with your Email and is easily accessible from a browser. Google Sheets is the easiest way out of MS Excel, but dealing with cells can be complicated. Let’s say You’ve to combine two cells, i.e, combine two cells on the sheet so that it can become one large heading and there are individual cells under it. How do we do it?
Login to your Google Docs and then open Documents and select Spreadsheet. You’ll be either working with an existing spreadsheet or you can simply click File and Create a New Spreadsheet.
You can type entries with one heading and a few other values under it or just follow my approach.
This feature can be tweaked by selecting format in the toolbox and then hovering over Merge Cells. You can select whether you want to merge all cells or you want to do it horizontally or vertically. There is also an option to unmerge which I’ll talk about further in the article.
It is a function to merge many cells which can comprise of horizontal and vertical values or both. It can be done with multiple cells but generally with one value. So if you try and select cells with individual cell values, it’ll merge and keep the value of the Top-left cell, everything else will be deleted.
To merge, just select the cells and go to format on the top toolbar. It will be disabled by default if you haven’t selected more than one cell. Then simply click on Merge Cells and Merge All. This will expand your cell and merge all the cells coming under the selection.
This will merge all the cells that are horizontally lined together. Merge Horizontally could also be used instead of Merge All in case of dealing with just one Horizontal axis. If we’re dealing with multiple cells horizontally, it’ll again keep the values of the Left-most cell in individual horizontal cells.
It puts the cells into Verticles retaining the value in cells vertically. You can easily manage data if you want to segregate cells vertically. Merge all and Merge Vertically will result in the same if there is just one column involved. If there are multiple select Merge Vertically to retain the values.
What if you want single cells again in places of merged cells? There is always a possibility to add more data in the merged cells, Unmerge let’s you revert.
Text isn’t aligned perfectly?
There are chances that your value/text jumps towards one side of the cell when you merge it. For example in our case, Time Table merged all cells together, but that pushed it towards the extreme left. In the case of Hours which was Merged Vertically, it automatically went to the bottom.
Both of these texts technically should’ve been in the middle. To do that we’ll use the Alignment option.
Simply click on the Cell, in our case Time Table, Then click on format and hover to alignment and select center. This will align the text in the middle making it look better formatted. In the case of Hours, we have to align it both in the center and in the middle. We’ll select Hours then format and align option, we’ll select the center and middle to place the text right in the middle of the cell.
HTML (Colspan and Rowspan)
I often need Tables to compare products and services in WordPress but the block editor is laggy and disappoints most of the time. Using HTML helps bridge the problem. So how do we use it? Let’s start with some definitions.
Colespan makes a cell expand horizontally, i.e, spanning the width of a cell or multiple cells.
Rowspan makes a cell expand vertically, i.e, spanning the height of a cell or multiple cells.
These provide the same features as Merge in Google Sheets. Here is an HTML you can copy. You can modify the value accordingly to make it expand more or contract. There is also an Align command I’ve used to make the text fall right in the center. You can tweak the colspan and also the rowspan to get used to it.
<table> <tbody> <tr> <th style="text-align: center;" colspan="7">Time Table</th> </tr> <tr> <th style="text-align: center;" rowspan="7">Hours</th> </tr> <tr> <th>Mon</th> <th>Tue</th> <th>Wed</th> <th>Thu</th> <th>Fri</th> </tr> <tr> <th>Maths</th> <th>Comp.</th> <th>Music</th> <th>Arts</th> <th>Free</th> </tr> <tr> <th>Eco</th> <th>Maths</th> <th>Draw</th> <th>Free</th> <th>Sports</th> </tr> <tr> <th style="text-align: center;" colspan="5">Lunch</th> </tr> <tr> <th>Music</th> <th>Arts</th> <th>Chem</th> <th>Arts</th> <th>Free</th> </tr> <tr> <th>Bio</th> <th>Music</th> <th>Music</th> <th>Phy</th> <th>Free</th> </tr> </tbody> </table>
Here is the result that you will get with the code. Pretty neat eh?
Merge is an easy tool and also comes in with functionality once you get used to it. It helps organize data better in the spreadsheet and also easy to use it elsewhere. There are multiple options to choose from if you’re specifically dealing with tables. While WordPress does give flexibility, online options also are convenient in terms of extra features like selecting responsiveness and borders.
Was this helpful? Comment below if you want to know more such tweaks about Google Sheets and tables.