by Svetlana Cheusheva, updated on
In this tutorial, we will look at how to align cells in Excel as well as how to change text orientation, justify and distribute text horizontally or vertically, align a column of numbers by decimal point or specific character.
By default, Microsoft Excel aligns numbers to the bottom-right of cells and text to the bottom-left. However, you can easily change the default alignment by using the ribbon, keyboard shortcuts, Format Cells dialog or by setting your own custom number format.
To change text alignment in Excel, select the cell(s) you want to realign, go to the Home tab > Alignment group, and choose the desired option:
If you'd like to align data vertically, click one of the following icons:
Please note that changing vertical alignment does not have any visual effect unless you increase the row height.
To align your data horizontally, Microsoft Excel provides these options:
By combining different vertical and horizontal alignments, you can arrange the cell contents in different ways, for example:
Align to upper-left |
Align to bottom-right |
Center in the middle
|
![]() |
![]() |
![]() |
Click the Orientation button on the Home tab, in the Alignment group, to rotate text up or down and write vertically or sideways. These options come in especially handy for labeling narrow columns:
In Microsoft Excel, the Tab key does not indent text in a cell like it does, say, in Microsoft Word; it just moves the pointer to the next cell. To change the indentation of the cell contents, use the Indent icons that reside right underneath the Orientation button.
To move text further to the right, click the Increase Indent icon. If you have gone too far right, click the Decrease Indent icon to move the text back to the left.
To change alignment in Excel without lifting your fingers off the keyboard, you can use the following handy shortcuts:
At first sight, it looks like a lot of keys to remember, but upon a closer look the logic becomes obvious. The first key combination (Alt + H) activates the Home tab. In the second key combination, the first letter is always "A" that stands for "alignment", and the other letter denotes the direction, e.g. A + T - "align top", A + L - "align left", A + C - "center alignment", and so on.
To simplify things further, Microsoft Excel will display all alignment shortcuts for you as soon as you press the Alt + H key combination:
Another way to re-align cells in Excel is using the Alignment tab of the Format Cells dialog box. To get to this dialog, select the cells you want to align, and then either:
In addition to the most used alignment options available on the ribbon, the Format Cells dialog box provides a number of less used (but not less useful) features:
Now, let's take a closer look at the most important ones.
Apart from aligning text horizontally and vertically in cells, these options allow you to justify and distribute the cell contents as well as fill an entire cell with the current data.
Use the Fill option to repeat the current cell content for the width of the cell. For example, you can quickly create a border element by typing a period in one cell, choosing Fill under Horizontal alignment, and then copying the cell across several adjacent columns:
To justify text horizontally, go to the Alignment tab of the Format Cells dialog box, and select the Justify option from the Horizontal drop-down list. This will wrap text and adjust spacing in each line (except for the last line) so that the first word aligns with the left edge and last word with the right edge of the cell:
The Justify option under Vertical alignment also wraps text, but adjusts spaces between lines so the text fills the entire row height:
Like Justify, the Distributed option wraps text and "distributes" the cell contents evenly across the width or height of the cell, depending on whether you enabled Distributed horizontal or Distributed vertical alignment, respectively.
Unlike Justify, Distributed works for all lines, including the last line of the wrapped text. Even if a cell contains short text, it will be spaced-out to fit the column width (if distributed horizontally) or the row height (if distributed vertically). When a cell contains just one item (text or number without in-between spaces), it will be centered in the cell.
This is what the text in a distributed cell looks like:
Distributed horizontally |
Distributed vertically |
Distributed horizontally
|
![]() |
![]() |
![]() |
When changing the Horizontal alignment to Distributed, you can set the Indent value, telling Excel how many indent spaces you want to have after the left border and before the right border.
If you don't want any indent spaces, you can check the Justify Distributed box at the bottom of the Text alignment section, which ensures that there are no spaces between the text and cell borders (the same as keeping the Indent value to 0). If Indent is set to some value other than zero, the Justify Distributed option is disabled (grayed out).
The following screenshots demonstrate the difference between distributed and justified text in Excel:
Justified horizontally |
Distributed horizontally |
Justify distributed
|
![]() |
![]() |
![]() |
Tips and notes:
Exactly as its name suggests, this option centers the contents of the left-most cell across the selected cells. Visually, the result is indistinguishable from merging cells, except that the cells are not really merged. This may help you present the information in a better way and avoid undesirable side-effects of merged cells.
These options control how your Excel data is presented in a cell.
Wrap text - if the text in a cell is larger than the column width, enable this feature to display the contents in several lines. For more information, please see How to wrap text in Excel.
Shrink to fit - reduces the font size so that the text fits into a cell without wrapping. The more text there is in a cell, the smaller it will appear.
Merge cells - combines selected cells into one cell. For more information, please see How to merge cells in Excel without losing data.
The following screenshots show all text control options in action.
Wrap text |
Shrink to fit |
Merge cells |
![]() |
![]() |
![]() |
The text orientation options available on the ribbon only allow to make text vertical, rotate text up and down to 90 degrees and turn text sideways to 45 degrees.
The Orientation option in the Format Cells dialog box enables you to rotate text at any angle, clockwise or counterclockwise. Simply type the desired number from 90 to -90 in the Degrees box or drag the orientation pointer.
The bottom-most section of the Alignment tab, named Right-to-left, controls the text reading order. The default setting is Context, but you can change it to Right-to-Left or Left-to-Right. In this context, "right-to-left" refers to any language that is written from right to left, for example Arabic. If you don't have a right-to-left Office language version installed, then you will need to install an appropriate language pack.
For starters, it should be noted that the Excel number format is not explicitly designed for setting cell alignment. However, it allows "hardcoding" alignment for certain cells to ensure that your data looks exactly the way you want, regardless of the alignment options enabled on the ribbon. Please note, this method requires at least some basic knowledge of format codes, which are explained in detail in this tutorial: Custom Excel number format. Below I will demonstrate the general technique.
To set cell alignment with a custom number format, use the repeat characters syntax, which is nothing else but the asterisk (*) followed by the character you want to repeat, the space character in this case.
For example, to get numbers to align left in cells, take a regular format code that displays 2 decimal places #.00, and type an asterisk and a space at the end. As the result, you get this format: "#.00* " (double quotes are used only to show that an asterisk is followed by a space character, you don't want them in a real format code). If you want to display a thousand separator, use this custom format: "#,###* "
Taking a step further, you can force numbers to align left and text to align right by defining all 4 sections of the number format: positive numbers; negative numbers; zero; text. For instance: #,###* ; -#,###* ; 0* ;* @
With the format code established, perform the following steps to apply it:
Now, no matter what alignment options your users select on the ribbon, the data will be aligned according to the custom number format you've set:
Now that you know the essentials of Excel alignment, let me show you a couple of tips to enhance the visual presentation of your data.
To align numbers in a column by decimal point, create a custom number format as explained in the above example. But this time, you will be using the "?" placeholder that leaves a space for insignificant zeros but does not display them.
For example, to align numbers in a column by decimal point and display up to 2 decimal places, you can use any of the following formats:
In the above format codes, the number of question marks to the right of the decimal point indicates how many decimal places you want to show. For instance, to display 3 decimal places, use #.??? or 0.??? or 0.0?? format.
If you want to align numbers to the left in cells and have the decimal points align, click the Align Left icon on the ribbon, and then apply a custom format similar to this: _-???0.0?;-???0.0?
Where:
The following screenshot shows the above custom number formats in action:
In situations when the capabilities of Excel alignment may not be sufficient to replicate a certain data layout, Excel formulas may work a treat. To makes things easier to understand, let's consider the following example.
Goal: To have numbers centered in cells and aligned by the plus (+) symbol:
Solution: Create a helper column with the following formula, and then apply a monotype font like "Courier New" or "Lucida Sans Typewriter" to the helper column.
Where:
How this formula works: In essence, the formula adds leading spaces to the original string by repeating the space character, and then concatenates those spaces with the string. The number of spaces is calculated by subtracting the position of the aligning character from the maximum number of characters preceding it.
In this example, the formula takes the following shape:
=REPT(" ",12-FIND("+",A2))&A2
And works perfectly!
This is how you change cell alignment in Excel. I thank you for reading and hope to see you on our blog next week.
Table of contents