Aligning the data in cells By default, Excel aligns text entries on the left margin of the cell (left justification) and aligns numeric entries on the right margin of the cell (right justification). While these are commonly used cell alignments, Excel supports a wider array of cell alignments: horizontal alignment (left, right, and centered), vertical alignment (top, bottom, and center of cell), centering a label spanning several cells, rotated text, and word- wrapping text in cells Cell alignments can be set with tool buttons and the Format Cells dialog box, accessed by the Format Cells menu command and Format Cells popup command. Aligning the data in cells, Slide 1Copyright © 2004, Jim Schwab, University of Texas at Austin
The cell alignment tool buttons The Formatting tool bar contains three tool buttons for aligning cell contents (left, center, and right) and one tool button for merging cells and centering text across the merged cells. By default, Excel left justifies the word Name in cell A1 because it is text. The left justification button is not highlighted because this was not set by the user. By default, Excel left justifies the word Name in cell A1 because it is text. The left justification button is not highlighted because this was not set by the user. Aligning the data in cells, Slide 2Copyright © 2004, Jim Schwab, University of Texas at Austin
Centering text in a cell The text Name in cell A1 is left-justified by Excel's default cell alignment for text. To change the alignment to centered within the cell, click on the Center tool button on the Formatting tool bar. Excel centers the word Name in cell A1. The Center alignment tool button is highlighted to reflect the formatting of the active cell. Aligning the data in cells, Slide 3Copyright © 2004, Jim Schwab, University of Texas at Austin
Right justifying text in a cell The word Name is centered in cell A1, indicated by both the cell contents and the highlighted Center button. To change the alignment from centered to right justified, click on the Align Right tool button on the Formatting tool bar. Excel right-justifies the word Name in the cell. Note: unlike font styles which are cumulative, alignments are exclusive and only one can be applied at a time. If a second one is selected, the first one is turned off and the second one applied. Aligning the data in cells, Slide 4Copyright © 2004, Jim Schwab, University of Texas at Austin
Restoring default text alignment The tool buttons for justifying text are toggle buttons. If we click a second time on the Align Right tool button, the right justification will be removed and the text will return to its default left justification. All cell alignments have been removed and the text returns to its default justification. Note: if we had left-justified the text with the Align Left command, the Align Left tool button would be highlighted. Since it is not, we know that Excel is using its default justification. Aligning the data in cells, Slide 5Copyright © 2004, Jim Schwab, University of Texas at Austin
Centering text across several cells The Merge and Center tool is useful for a table with a heading row above a row of subheadings, and we want the heading centered over the subheadings. First, select the cells in which the heading is to be centered, A1 to A3. Second, click on the Merge and Center tool button on the Formatting tool bar. Excel merges the three cells so that they act like one cell. The vertical cell boundaries between A1 and B1 and B1 and C1 are removed. The text is centered in the merged cell. Excel highlights both the Merge and Center button and the Center button. Aligning the data in cells, Slide 6Copyright © 2004, Jim Schwab, University of Texas at Austin
The format cells menu command Cell alignments can also be set by using the Format Cells dialog box. To open the Format Cells dialog box, select Cells from the Format menu bar. Cell alignments can also be set by using the Format Cells dialog box. To open the Format Cells dialog box, select Cells from the Format menu bar. Aligning the data in cells, Slide 7Copyright © 2004, Jim Schwab, University of Texas at Austin
The format cells dialog box When the Format Cells dialog box opens, click on the Alignment tab to go to the options for cell alignment. In this dialog, there are commands for setting the horizontal and vertical alignment of the contents of cells. The Orientation panel supports changing text to print as a column instead of as a line, and commands to rotate the text so that it displays at an angle. Were we using a language where text was printed from right to left, we could enable this behavior in the worksheet. We can have text word-wrap in cells, shrink down to fit, and we can merge cells. Aligning the data in cells, Slide 8Copyright © 2004, Jim Schwab, University of Texas at Austin
Options for aligning text Aligning the data in cells, Slide 9Copyright © 2004, Jim Schwab, University of Texas at Austin Click on the down arrow for the drop down list of horizontal alignments. The Center Across Selection option works just like the Merge and Center tool button. We can include an indent for left and right justify, which will move the text from the left or right by the number of units specified in the Indent numeric spinner. On the Horizontal alignment drop down list, there are commands to left, center, and right justify cell contents.
Word wrapping text - 1 When the text in a cell is too long to be displayed, one of our options is to wrap the text across multiple lines. Select the Cells from Format menu to open the Format Cells dialog box. Aligning the data in cells, Slide 10Copyright © 2004, Jim Schwab, University of Texas at Austin
Word wrapping text - 2 First, click on the Alignment tab, if necessary. Second, mark the check box Wrap text. Third, click on the OK button to wrap the text in the selected cell. Aligning the data in cells, Slide 11Copyright © 2004, Jim Schwab, University of Texas at Austin
The cell containing the wrapped text Excel wrapped the text in cell A1 and increased the height of row 1 so that all of the text would be visible. Aligning the data in cells, Slide 12Copyright © 2004, Jim Schwab, University of Texas at Austin