11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2: Basic Facts about <strong>Formula</strong>s 49<br />

Nested parentheses<br />

You can also nest parentheses in formulas — that is, put parentheses inside of parentheses. When<br />

a formula contains nested parentheses, Excel evaluates the most deeply nested expressions first<br />

and works its way out. The following example of a formula uses nested parentheses:<br />

=((B2*C2)+(B3*C3)+(B4*C4))*B6<br />

This formula has four sets of parentheses. Three sets are nested inside the fourth set. Excel evaluates<br />

each nested set of parentheses and then sums the three results. This sum is then multiplied<br />

by the value in B6.<br />

It’s a good idea to make liberal use of parentheses in your formulas even when they aren’t necessary.<br />

Using parentheses clarifies the order of operations and makes the formula easier to read.<br />

For example, if you want to add 1 to the product of two cells, the following formula does the job:<br />

=A1*A2+1<br />

Because of Excel’s operator precedence rules, the multiplication will be performed before the<br />

addition. Therefore, parentheses are not necessary. You may find it much clearer, however, to use<br />

the following formula even though it contains superfluous parentheses:<br />

=(A1*A2)+1<br />

Every left parenthesis, of course, must have a matching right parenthesis. If you have<br />

many levels of nested parentheses, you may find it difficult to keep them straight.<br />

Fortunately, Excel lends a hand in helping you match parentheses. When editing a formula,<br />

matching parentheses are colored the same, although the colors can be difficult<br />

to distinguish if you have a lot of parentheses. Also, when the cursor moves over a<br />

parenthesis, Excel momentarily displays the parenthesis and its matching parenthesis in<br />

bold. This lasts for less than a second, so watch carefully.<br />

In some cases, if your formula contains mismatched parentheses, Excel may propose a correction<br />

to your formula. Figure 2-2 shows an example of Excel’s AutoCorrect feature in action.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!