• Aucun résultat trouvé

Getting Oriented

Dans le document Microsoft Excel 2010 (Page 120-134)

Figure 4–32. Standard font colors

Note, however, that the above menu also offers an Automatic color option; click it and you return the data to the default black font color. A More Colors option is likewise provided here, as well as a Custom color option.

Getting Oriented

The next group in the Home tab is called Alignment, and Alignment commands are likewise

considered formatting. These enable you to position, and reposition, the data you’ve entered in their cells (Figure 4–33):

Figure 4–33. The Alignment button group

The lower-left buttons in the group are rather simple and commonly used, and bring about left, center, and right alignments of the data in the cells you click. That is, click the left alignment button and data will be shunted to the left border of the cell. (Of course, text is left-aligned by default.) Click the center button, and any data are situated in the middle of their respective cells (Figure 4–34):

Figure 4–34. Centered text

Nothing prevents you from centering numbers in their cells, and this alignment decision seems to be a popular one. Users seem to like the symmetry it affords. Still, I wouldn’t recommend it, and for an obvious reason (Figure 4–35):

Figure 4–35. It’s your call: centered numbers…if you like this sort of thing

You see the problem. Enter numbers of varying widths in the same column, center them, and you’ll thereby misalign the ones, tens, etc. But remember that alignments, no matter how ornate, won’t change the quality of the data. Those numbers above are still numbers, and can be subject to exactly the same mathematical treatment as if they are right-aligned.

And while we’re at it, the right-align button rams data to the right border of their cells—which is the default alignment for numbers, after all.

The upper tier of alignment buttons controls a far more exotic set of possibilities—vertical alignment in cells (Figure 4–36):

Figure 4–36. Where to control vertical cell alignment If you need your data to look like this (Figure 4–37):

Figure 4–37. Centered data—centered vertically, that is

click one of the buttons shown in Figure 4–36. What these do is position data along a vertical axis in the cell—at the bottom of a cell (the default, when you think about it), in the center (as above), or even at the cell’s ceiling (Figure 4–38):

Figure 4–38. Hitting the heights. Cell data top-aligned

Just bear in mind that if you apply these formats to cells of normal heights, you won’t see the above effects. That’s because the default row height is too low to enable these to happen, and so you’ll need to elevate the heights of the rows you want.

How do you do that? The technique is in many ways the right-angled equivalent of the column-widening methods we described in chapter 2. In order to raise a row height, click on the row’s lower boundary and drag down (or up, if you want to shrink the row’s height). And if I select several row boundaries at the same time by dragging along the row numbers, releasing the mouse and then dragging on any selected row boundary, I’ll see something like this (Figure 4–39):

Figure 4–39. Modulating row heights

I can then modulate the height of all the selected rows at the same—and they’ll all exhibit the same, new height.

So to achieve the row height you see in Figure 4–40—brought about in cell A10—I simply dragged down on the lower boundary by the 10 (Figure 4–40):

Figure 4–40. Cell A10, now heightened

And once I’ve engineered the desired height I then clicked the Top Align button—and you get your top-of-the-cell number. Of course as always I can heighten the row first, click Top Align, and then enter the number. The sequence of clicks doesn’t matter here.

Now you’ll recall my flippant aside about 48-degree text, the one I threw out on the opening page of this chapter. Well, if you need or want something like that, look here (Figure 4–41):

Figure 4–41. The Orientation Button

That’s the Orientation button. Click its down arrow, and you’ll see this (Figure 4–42):

Figure 4–42. Orientation options

That’s a pretty illustrative, what-you-see-is-what-you-get drop-down. Select a cell, then click Vertical Text, for example, and you get (Figure 4–43):

Figure 4–43. Vertical text: Like THIS

And so on. Note, though, that when you call upon these Orientation options they automatically raise the heights of rows (as also happens with font size changes|) in order to accommodate their effects, unlike the vertical alignment buttons, which require the user to heighten the rows.

When you click the last Orientation button, Format Cells: Alignment, the aforementioned Format Cells dialog box appears, with the Alignment tab in view (Figure 4–44):

Figure 4–44. The Alignment tab of the Format Cells dialog box

If you type a number in the Degrees field on the box’s right side and click OK, you can achieve that 48-degree angle, or any other tilt you want, at least between -90 and 90 degrees. You can also click on the red diamond referenced by the arrow above, and drag it along that Orientation half-circle to angle your text, too. Either way, you could get the example shown in Figure 4–45:

Figure 4–45. 48 degrees worth of text alignmnent

To turn this effect off—that is, to restore the data to a level orientation—return to the Degrees field and type “0.”

And if you click that vertical Text field you see beneath the Orientation heading, that’s what you’ll get—vertical text in their cells, as per the Vertical Text options we saw in the Orientation drop-down menu in the Alignment Group.

On the left side of the Format Cells dialog are various Text alignment options. Now some of the options in those Horizontal and Vertical drop-down menus are obscure, but here goes:

General—Brings about standard data alignment defaults, e.g., text is left-aligned, numbers right-aligned. Obviously you’d only select this to restore realigned data to their original alignments.

Right and Left (Indent)—These simply push, or indent, data in their cells to the right or the left by the number of characters you type in the Indent field in the dialog box. But just remember that if you select a right indent, the text will move left, because it is the indent itself that pushes to the right.

Indents can bring about some rather unusual visual results. If I select a right indent and type 10 in the indent field, I can wind up with something like this (Figure 4–46):

Figure 4–46. Cell-dom used: the indent option

Don’t be fooled—the text is actually “in” the cell selected by the cell pointer. This can’t happen with a number, however, and for a reason we’ve already discussed in the chapter on data entry; Excel won’t allow a number to creep into another cell. Thus, if I type 43 in the very cell you see above with the same indent settings, this is what I’ll get (Figure 4–47):

Figure 4–47. An indented number

Here the indent carries out what’s tantamount to an Auto Fit. The number is indeed indented, but only within its own cell. Yeah—you’re not likely to use this very often. The two indent buttons (Figure 4–48) found on the Alignment Group on the Home tab of the ribbon:

Figure 4–48. The Indent buttons

equate respectively with the Right and Left Indent options in the Alignment Dialog box—but look at the buttons. What I’m calling Right Indent features an arrow pointing left, and what I’ve called Left Indent bears an arrow pointing right. Nevertheless that’s what they are. Moreover, the Alignment Group caption clinging to the first of the two buttons above (seen when you rest you mouse over it) calls it Decrease Indent, and not Right Indent; and the other button is labeled Increase Indent; and

neither of these labels corresponds to what the same commands are called in the Alignment Dialog box.

A couple other qualifications to what is again, not the sort of command you’re likely to call upon daily: Click the left-pointing indent button arrow in the button group and nothing happens in the cell at the outset—the data stay put. But click either left or right setting in the dialog box and type a number in the indent field and the data will indent in the desired direction.

Sorry about that.

Center—Really an equivalent of the Center alignment button. Typing a number in Indent here has no effect.

Fill—Takes any data you’ve written in the cell and repeats it in the cell, until the cell’s width is taken up with the data. For example, if I type the word “the” in a cell and select Fill, I’ll see (Figure 4–

49):

Figure 4–49. Filling the cell with data—repeatedly

And if I go on to widen the cell now, I’ll get Figure 4–50:

Figure 4–50. Same command, wider cell.

And yes, you can bring about the same effect with a number—though I can’t imagine why you’d want to. That is, if I type 3 in a cell and invoke the Fill format I’ll see

333333

across the width of the cell—but its actual value is still….3. Don’t ask questions, but remember—

this is a format, and as such, it doesn’t change the number’s value.

The Justify and Distributed options are similar, though not quite identical to one another. These commands represent a kind inverse of the column Auto Fit; instead of widening a column to

accommodate its widest entry, Justify and Distributed treat the current column width as a fixed margin and stack the text in the cell so that it all fits. So for example, if I type (Figure 4–51):

Figure 4–51. Before justifying the text…

And select Justify, the text is realigned like this (Figure 4–52):

Figure 4–52. … and after

The text continues to use the existing column width, and so needs to raise its row height in order to pinch all the text within that width. The command is called Justify because it emulates a similar effect in Word, whereby text in a paragraph exhibits straight left and right margins—at least to the extent possible. Distribution differs only in that it attempts to distribute the text equally across each line in the cell, so that each line spans the current column width, including the last line—again, to the extent possible. Here’s another instance of a justified cell (Figure 4–53):

Figure 4–53. Justified vs. Distributed text

And here’s the same test subject to the Distributed option (Figure 4–54):

Figure 4–54. The text, Distributed

Note how the word “happen” is centered here. It’s the closest Distribute could come to spanning the entire column width with that one word. Try typing the above phrase, applying the Justify and Distribute effects, and widening the column.

Center Across Selection centers a cell entry across a range of cells. That is, if I type this:

This is how to center data across a selection in cell E28, and then select this range (Figure 4–55):

Figure 4–55. Data about to be centered across a range selection And select Center Across Selection, I’ll view this (Figure 4–56):

Figure 4–56. The data, now centered

The effect is clear. Excel treats the selected range as a single space—in essence as one big cell, even though each cell retains its own identity— and centers the data accordingly. You may want to contrast this with the Merge & Center command coming up soon.

Of the five Vertical Alignment drop-down options in our dialog box (Figure 4–57),

Figure 4–57. Vertical cell alignment options

the first three—Top, Bottom and Center—are clones of the Vertical Alignment buttons we’ve already seen in the Alignment Group. The other two—Justify and Distributed—attempt to realize the same effects as their similarly-named Horizontal options, but to appreciate how they work you need to tinker with column widths and text length. Here are two examples (Figures 4–58 and 4–59):

Figure 4–58. Vertically distributed text

Figure 4–59. Text, vertically jusftified

The three Text control options in the Alignment dialog box are variations on themes we’ve previously sounded. As with Justify and Distribute, Wrap text regards a cell’s current width as a margin, and wraps cell text accordingly. The difference here is that Wrap text doesn’t try to flatten the right text margin, but rather lets text advance unevenly against cell’s right boundary (Figure 4–60):

Figure 4–60. Wrapping and styling: text wrapped in its cell

Wrap text allows text to wrap naturally to the next line, and doesn’t try the spacing heroics of Justify or Distribute; this command is represented by the Wrap Text button in the Alignment Group.

Those options—Wrap text, Justify, and Distribute—that realign text by raising row heights instead of stretching column widths do serve a real purpose. They’re usefully applied to worksheets in which you want to present data in a series of columns and maintain the same width for all of them, even as the data in the columns exhibit various widths.

Shrink to fit is a curious flip side to the workings of Wrap text and column Auto Fit. Whereas Wrap text tries to pile text into a cell without changing its width by raising its row height instead, and Auto Fit tries to widen columns to accommodate all text in one cell, Shrink to fit changes neither column width nor row height; it shrinks text in order to gather it all into existing width and height. So if you start with this (Figure 4–61):

Figure 4–61. Text, normally sized

Shrink to Fit will recast the text to look like this (Figure 4–62):

Figure 4–62. Look honey, I shrunk the text Well, you get the idea.

Finally, the Merge cells option does as it says. It actually consolidates, or merges, selected contiguous cells into one mega cell. Thus if I start with this entry in cell J12 (Figure 4–63):

Figure 4–63. Text in cell J12

And I then select cells J12 through N12 and click the Merge cells command, I get (Figure 4–64):

Figure 4–64. A merged cell

And what you’re looking at now is all J12; all the selected cells have been absorbed by one cell—

J12—in which I typed my data. All of which raises a fairly obvious question: what does that do for me?

Answer: not much.

But what you really may want to do is merge these cells as we’ve demonstrated above, and then center the data in the new, super-sized cell. And indeed, there’s an Alignment Group button—Merge &

Center—which does exactly that (Figure 4–65):

Figure 4–65. The Merge & Center button

By default, clicking Merge & Center on our selection of J12 through N12 brings about (Figure 4–

66):

Figure 4–66. A mega, merged cell

This option resolves an old spreadsheet problem—the need to center a title over a collection of columns (Figure 4–67):

Figure 4–67. How to center that title over all those months?

In the old days, users had to resort to all manner of contortions in order to situate that title in the middle of the row above the month names, including trying to locate a “middle” column. But we’re working with 12 columns here, aren’t we? There is no middle column. Merge & Center will turn A1:L1 into one cell (of course that’s the range you need to select), after which Monthly Sales will be precisely centered within the new super cell—which is still called A1.

The drop-down menu attaching to Merge & Center affords three additional options. Merge Across allows you to Merge & Center data in consecutive rows. Thus if you start with this (Figure 4–68):

Figure 4–68. Text, one word per cell

You see that I’ve already selected the cells to be merged. Clicking Merge & Center: Merge Across results in this (Figure 4–69):

Figure 4–69. Each row, its selected cells merged

The respective rows are merged—but here, you see that the data in them are centered. At this point, you need to then click the standard Center button in the Alignment Group in order to center each bit of data in each new merged cell in each row. Inelegant, but it works.

Merge & Center: Merge Cells duplicates the Merge cells command we described above in the Alignment Dialog Box, and Merge & Center: Unmerge Cells returns all cells back to their original integrity.

An important additional note about the Merge Cells options: Be sure that only the leftmost of the cells you wish to merge has data in it. Thus if I want to merge cells J12 through N12, and any cells other than J12 have data in them, those data will be lost when you go ahead with the merge—though Excel will warn you about this prospect with an onscreen message.

Dans le document Microsoft Excel 2010 (Page 120-134)