This tutorial will demonstrate how to center text in a cell in excel. To make any data table more visually attractive, it is important to align the data text into the center position in a cell. It creates a huge impact on the reader or viewer. So, in this, our main goal is to learn about the whole process with a proper image.
Download Practice Workbook
You can download the practice workbook from here.
3 Easy Methods to Center Text in a Cell in Excel
To understand easily, we’ll use a sample dataset as an example in Excel. For instance, we have names of different people in Column B marked as Name and Student ID in Column C. We will use this dataset for all the methods described below.
1. Using Excel Ribbon to Center Text in a Cell in Excel
Using Excel Ribbon is the fastest way to center text in a cell in Excel. Excel ribbon can be used in two forms: one is using Center Content Option and the other is applying the Format Option. Both of these forms will easily center the text in a cell if the below steps are followed properly.
1.1 Use Center Content Option
The Center content option is found in the Home tab in the upper portion of the window. So, it is very convenient to find and use. By using this option we can center the text in a cell in excel in the following ways:
- At first, select the whole data table and go to the Home tab.
- Next, click on the Center option from Alignment in the upper ribbon portion.
- After that, you will find the result like the below image.
1.2 Utilize Format Option
In this case, our goal is to use the format option from the ribbon tab. For this, we have to follow the steps described below:
- Firstly, select the whole data table and go to the Home tab.
- Secondly, choose the Format Cells option from the Format tab.
- Then, the Format Cells window will open on your display screen.
- Afterward, go to the Alignment option.
- This time, select the Center option in both Horizontal and Vertical into the Text alignment.
- Finally, press OK to get the desired result.
- If you have followed all steps perfectly, then you will get results like the below image.
Read More: How to Left Align in Excel (3 Handy Ways)
2. Center Text in a Cell in Excel Using Context Menu
If in any case the ribbon tab is not available or you want to center text in a cell with only the mouse and keyboard then you have to use the Context Menu option. The steps will lead you to learn the whole process:
- At first, select the whole data table and Right-Click on the table.
- Then, choose the Format Cells tab.
- After that, the Format Cells window will open on the screen. In this case, again select the Alignment and go to the Text alignment option to choose the Center option in both the Horizontal and Vertical alignment.
- After pressing OK, you should have found the result like the below image.
3. Applying VBA Code to Center Text in a Cell
In all cases, the most effective way to center text in a cell in excel is by applying the VBA code. If a person wants to know how the text alignment is changing from any position to the center position then the best way is to learn by the VBA code. The description of this process is written below:
- Initially, select the data table like the other two methods and press the Alt+F11 buttons to open the VBA Code window.
- Then, go to the Insert tab and select the Module option to open a new module window.
- In the new module window, insert the following code:
Sub CenterTextHorizontallyAndVertically() Selection.HorizontalAlignment = xlCenter Selection.VerticalAlignment = xlCenter End Sub
- Next, click on the Run tab or press F5 to run the desired code.
- In the end, you will find results like the below image.
How to Center Text Across Multiple Cells in Excel
When we are dealing with high-volume data, it is very necessary to merge many cells and center the text in the merged cells in Excel. Otherwise, the data will be very difficult to understand. To learn this process we will show the steps below:
- Firstly, in the B2 cell, we have written Centering Text Across Multiple Cells.
- Now, we want to make the writing heading of both Column B and Column C.
- So next, select both B2 and C2 cells.
- Then go to the Home tab and click on the Merge and Center option.
- Finally, we will get the result like the below image.
Things to Remember
- The fastest way is the first method. The other two methods are also helpful but the first method is always recommended.
- In the case of using VBA code, it is very important to save the code. Otherwise, the code won’t run.
- In the case of merging the cells, it is necessary to focus on which cells you are merging. If you merge the wrong cells then the data will create huge confusion.
Henceforth, follow the above-described methods. Thus, you can learn how to center text in a cell in excel. Let us know if you have more ways to do the task. Follow the ExcelDemy website for more articles like this. Don’t forget to drop comments, suggestions, or queries if you have any in the comment section below.