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.
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 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 the 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 Align 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:
- 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 in 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 the steps perfectly, then you will get results like the below image.
Read More: How to Left Align in Excel
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:
- 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 Excel 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.
- All Types of Alignment in Excel
- How to Top Align in Excel
- How to Middle Align in Excel
- How to Align Right in Excel
- How to Bottom Align in Excel
- How to Change Alignment in Excel
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 headings 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.
Read More: Align Decimal Points in Excel
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.
Download Practice Workbook
You can download the practice workbook from here.
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. Don’t forget to drop comments, suggestions, or queries if you have any in the comment section below.
- How to Justify Text in Excel
- Align Colon in Excel
- How to Align Columns in Excel
- How to Align Currency Symbol in Excel
- Default Alignment of Numbers in Excel
- How to Align Numbers in Excel
- Excel VBA to Set Vertical Alignment
- How to Format Cell and Center Text with Excel VBA
- Text Alignment with VBA Command Button in Excel
- [Fixed!] Excel Cell Alignment Not Working
- Excel VBA Horizontal Alignment