• Aucun résultat trouvé

Excel Has Got Your Number(s)

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

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.

Excel Has Got Your Number(s)

Now that we’ve gotten ourselves oriented and aligned, we can push on to a group whose modest bearing belies its importance—the Number group (Figure 4–70):

Figure 4–70. The Number button group

Needless to say, formatting numbers is a pretty essential Excel task, but with a couple of slightly pause-giving exceptions, the task is pretty easy. And the number formats you’re most likely to need are a snap.

Let’s start with the group’s lower tier, moving left to right. That first button, picturing a pile of coins and a bank note of indeterminate origin, enables you to format numbers in currency mode—but unfortunately it’s called, rather cryptically, Accounting Number Format, with its caption asking you to

“Choose an alternate currency format for the selected cell” (of course you know that means cells, too).

That term “alternate” is pretty cryptic, too—but what it means here simply is that clicking the button will impart a currency motif from one monetary system—Euro instead of Dollars, for example. (But as we’ll see, there’s a slightly different format out there called Currency, too—but we’ll get to that.)

If you select a cell or a range of cells and click the Accounting Number Format, this is what happens by default:

• The number is now embellished by your indigenous currency symbol. If you’re in the States, you’ll see the dollar sign, in the UK the pound sign, and so on (how Excel knows what symbol to use is tied to your system setup in Control Panel).

• If the number exceeds 999, commas will punctuate where necessary, e.g., 1,234,582. (In France, the comma is replaced by a space. It’s another country-specific, Control Panel thing).

• The number will exhibit two decimal points. Thus 27 will appear as 27.00, 678.1 as 678.10.

And why the term Accounting? Well, to repeat—this is a currency-specific format, but of a special type. What’s special—or at least different—about it is that it lines up the currency symbol independent of the length of numbers. Consider this example: If I stack these numbers in a column (Figure 4–71):

Figure 4–71. Numbers, pre-formatted

And I click Accounting Number Format, I’ll see (Figure 4–72):

Figure 4–72. Numbers, as per the Accounting format

Note the position of the dollar signs—all positioned in the far left of their cells, even as the actual numbers describe various widths (note also how the 12 receives those two decimal points, as does 123.8).

Of course that’s all for starters—and you can stop right there if you’re happy with the defaults. But if you’re in the US and require a different currency, click the down arrow and some standard,

alternative currency options appear, e.g., the British pound and the Euro.

But if you need something else, click More Accounting Formats (Figure 4–73):

Figure 4–73. The Number tab, in an abridged Format Cells dialog box

We’re back to the Format Cells dialog box, this time showing only one tab. Then click the down arrow by Symbol and click on any one of the long array of currency formats Excel makes available;

your numbers will take on that denomination, and you’ll note as well that you can add or diminish the number of decimal points your currency displays, either by typing a number in the Decimal places field or clicking one of those Spin Box arrows in either direction.

That’s really all there is to the Accounting Number Format, but that’s not all there is to currency formatting, as we’ll see.

The next button in the Number lineup is Percent Style, and while it’s most easy to use (no drop-down menu, either!) you need to understand what the style will do to a number. If I type:

41 and select that cell, and click Percent Style, I’ll see:

4100%

And not 41%. That’s because percentages really express a number’s percentage of the number 1—

which is, after all, 100%. Thus our number above—which is 41 times the size of 1—has to turn out to be 4100%. If you were expecting 41%, you will need to have typed .41.

But there is an alternative way to institute the Percent Style. If I type:

41%

in a cell, complete with the percent sign, I will achieve exactly that figure—41 percent.

The next button, Comma Style—symbolized, naturally enough, by the comma—imitates the Accounting Number Format, minus the currency symbol. Thus if I select a cell containing the number 3457, the comma button will make it look like this:

3,457.00

The following two buttons, Increase Decimal and Decrease Decimal, are simple, too, but a jot more thought-provoking. With each click, Increase Decimal will indeed add one decimal point to a number—

and that includes numbers that have already received two such points under either of the Accounting Number Comma Style formats. Thus:

67

will appear as 67.0, 67.00, 67.000, etc., with each successive Increase Decimal click. If you write:

=4/7 your result will initially appear as:

0.571429

in a cell of default column width. If you execute an Auto Fit, you’ll see:

.0571428571

a nine-digit rendition of this repeating decimal (note that the “9”—the last digit in the original six-digit version above—is replaced by 8571—adding additional precision to the number). But you can add still more decimal digits—up to 15 meaningful ones in total—to a number, after which 5 additional zeroes will then appear. But of course unless you’re a currency-exchange high roller or a nuclear physicist, you’re not likely to need all those extras.

Decrease Decimal works in the opposite direction, paring a decimal point with each click. And that means, for example, that if you click Decrease Decimal once on this number:

4.56 you’ll see:

4.6 Click Decrease Decimal again and you’ll see:

5

Now what’s the numerical value of that figure? The answer: 4.56, and that’s because—at the risk of repeating myself—we’re formatting data, and formatting changes the appearance of the data only, not their value. And that means in turn that if I write the above number in cell A12, and write somewhere else:

=A12*2

I’ll realize 9.12, not the 10 you might assume on the basis of appearances. And if you want proof of all this, type 4.56 in A12, click back in A12 and click Decrease Decimal twice, and grab a look at the Formula Bar. You’ll see 4.56.

And what this could mean is that a printout of a worksheet containing the above activity would display a 5 in A12 and a calculation showing 9.12, when you multiply A12 by 2—and that could be rather misleading, to put it mildly. It’s something you need to think about. (It should be added, by the way, that text entries in cells bearing any of the above number formats will be completely unaffected by any of this. It’s only when you actually enter a numeric value in such cells that these changes matter.)

There’s one other clarification to be made about the buttons we’ve examined thus far: that any one of the buttons overrules the effect of any other. Thus, if I’ve formatted 5457.67 to take on this

appearance:

$5,457.67

and then click Comma Style, I’ll see 5,457.67. If I click Percent Style, I’ll see 545767%, and so on. The point is that the last format selected takes priority.

Now if you examine the broad strip—called Number Format —sitting atop all these buttons in the Number group, you’ll view the default entry General (Figure 4–74):

Figure 4–74. The General number format

Click the accompanying drop-down arrow and you’ll see (Figure 4–75)

Figure 4–75. The Number Format drop-down menu

Each of those eleven options (you can’t see that eleventh one—Text—in the screen shot, because you need to scroll down) introduces formatting variations, some of which you’ve already seen, others of which need to be explained. And note the More Number Format option at the base of the menu, too;

that also requires a closer look. So let’s move in sequence.

The default General format type is captioned No specific format—and that means General makes its own guess about what kind of data you’ve entered in a cell. If I type a number, General assumes that’s exactly what I had in mind—an entry that possesses quantitative value. If I type a prose sentence in the cell instead, General deems it text in nature. If I type a formula, General treats it as such.

Now at this point you’re probably itching to ask a rather pressing question, because I see a lot of raised hands out there. You want to know: Isn’t this all completely obvious? Why do we need a format to make any decision about the data, when the nature of those data is so clear?

The answer is that the data types aren’t always so clear. If I type this:

4/5

that sure looks like text, because it’s missing the tell-tale = sign. But General treats the above expression as a date, namely:

05-Apr And similarly, General treats:

4–5

the same way, as that same date. Yes—by rights, the General format could have assigned text status to these entries, but Excel assumes that users who write such expressions really want to enter dates. And dates, as we’ll see, are really numbers.

In any case, the General format keeps an open mind about what it is you’ve written, whereas the other formats are a bit bossier, in the sense that they impose their expectations on the data to the extent they can.

Thus the Number Format option can’t turn text into a number, but it can turn numerical data displaying a different format back into a garden-variety number—and it throws in two decimal points for free. Thus if a cell contains this entry:

34.5%

Clicking that cell and then clicking Number will yield:

.35

See why? Here, Number has really done two things: it’s repealed the percent style, and rounded off the number to two decimal points—because that what Number does by default. But remember: the number is really .345. Check out the Formula Bar.

Currency is a cousin of the Accounting Number Format, and we’ve already alluded to it. It differs from Accounting in one respect: the currency symbol it imparts hugs each number’s first digit, instead of assigning it to a fixed place in the far left of the cell. Thus our Accounting example of a few pages back looked like this (Figure 4–76):

Figure 4–76. The Accounting format redux

Click Currency on the same range and you’ll come away with this (Figure 4–77):

Figure 4–77. The Currency format

And you’ll be happy to know we’ve already discussed Accounting.

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