Merge & Center combine and center the contents of the selected cells in a new, larger cell. This is a great way to create a label that spans multiple criteria. This is used to combine multiple cells into a single cell and create the main headers for reports in Microsoft Excel.
So when you work dashboards, you get the need for Merge and Center cells. The traditional way is lengthy and there is no simple shortcut to merge and center, like CTRL+C for copying. But there are ways to workaround.
To merge and center two or more cells follow these steps:
This is not actually a shortcut to merge cells in excel but it is fast. The ALT key activates the ribbon and following keys take you to the Merge and Center option. H takes you to Home tab, M takes you to Merge and Center options and C selects the Merge and Center option.
As we can see text in B1 cell is now merged and centered in B1 to D1 cells.
Merge And Center Options
There are four options available in Merge and Center:-
We are going to focus on Merge and Centre here.
As I said, there is no specific shortcut for merge and center but you can create one using macros. It's easy.
Selection.Merge 'to merge selected cells
Now you have a shortcut to merge cells. If you instead want to merge and center then add this line in macro
Selection.HorizontalAlignment = xlCenter
And if you want to the text to be in the center of the cell vertically too, add this line too.
Selection.VerticalAlignment = xlCenter
Finally, your code will look like this,
Sub mergeCells() ' mergeCells Macro Selection.HorizontalAlignment = xlCenter ' to align text horizontally in cent Selection.VerticalAlignment = xlCenter ' to align text vertically in center Selection.Merge ' to merge cells End Sub
Now, whenever you'll press CTRL+j, all selected cells will be merged. And this how you get a shortcut to merge and center cells in excel.
Note: Merge and Centre option takes the text of only one cell which will be upper-left most cell while performing Merge and center. |
You have to be careful about your content in the cells which is to be merged.
Example of Merge And Center in Excel
We need to merge cells B1 to D1. When we'll use ALT>H>M>C excel shortcut to merge cells, excel will show a warning. This warning says that all cells will lose their data except upper-left cell if we merge and center these cells.
Click OK and output will be like as shown below.
Now the same function will be performed on E1 to G1 cell and H1 to J1 cells.
So we will use the F4 key to perform the last function again.
In the above image data of Team A is under Team A label. Similarly, for Team B and Team C, we can say the same.
Frequently Asked Questions
Q1. How to merge columns in Excel?
Ans: Simple, select the columns and press keys ALT>H>M>C sequentially. Done. Next.
Q2. How to unmerge cells in excel?
Again same, select merged cells and press keys ALT>H>M>C sequentially. Done. Next.
Q3. How to merge cells in word?
Well, this is an Excel tutorial but still, select the cell in word and press ALT>J>L>M.
Please find more articles on Labeling and highlighting cells here. Hope you got this by now. Please share your queries in the comment box below. We will solve it for you.
Popular Articles:
50 Excel Shortcut to Increase Your Productivity
How to use the VLOOKUP Function in Excel
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.
Thanks
Yes, Abdul Hannan. That's the only drawback of macros. You can't undo any work done with a macro using CTRL+Z command in excel. The unmerge can be done manually.
You should be really sure before running any complex code that changes the file a lot. You'll not be able to get back using undo command. the best way is to keep a copy of the previous file.
CTRL + Z is not working after creating the module and running it. Like its not undoing the merge cells after merging it.
Hi there! Can you please add some pictures? We cannot understand the details. Please also add videos. Thank You!
For now we are using Pictures and GIFs. Soon we will add videos too... stay tuned.
Hi,
How can I merge the cells of a column with identical values. E.x. An excel had 10 columns and 500 rows. Each row has a column E with name field and excelsheet is sorted on that column. Now I want to merge the column E 'name' only for all the rows of same name. Like there are 5 rows for Name 'John' then for all those five rows the name cells will be merged into one cell and rest of the cells for those rows will remain unchanged. This should happen for each Name.
Thanks,
Sachin
in another column
use the concatenate function ( wich ads the two adiacent two cells in one) and then save as values
=(a1&" "&b1) ; the " " is one space.. betwen the refrences in a1 and b1
hope it helps
very gooood and useful thanks
Very Nice trick
Thanks a lot of you.....
Thank you, very helpful, exactly what I was looking for.
This is greatly appreciated.
thanks