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.

48<br />

Part I: Basic Information<br />

Subtraction or negation?<br />

One operator that can cause confusion is the minus sign (–), which you use for subtraction.<br />

However, a minus sign can also be a negation operator, which indicates a negative number.<br />

Consider this formula:<br />

=–3^2<br />

Excel returns the value 9 (not –9). The minus sign serves as a negation operator, and has a<br />

higher precedence than all other operators. The formula is evaluated as “negative 3, squared.”<br />

Using parentheses clarifies it:<br />

=(–3)^2<br />

The formula is not evaluated like this:<br />

=–(3^2)<br />

This is another example of why using parentheses, even if they are not necessary, is a good idea.<br />

Use parentheses to override Excel’s built-in order of precedence. Returning to the previous<br />

example, the formula without parentheses is evaluated using Excel’s standard operator precedence.<br />

Because multiplication has a higher precedence, the Expenses cell multiplies by the<br />

TaxRate cell. Then, this result is subtracted from Income — producing an incorrect calculation.<br />

The correct formula uses parentheses to control the order of operations. Expressions within<br />

parentheses always get evaluated first. In this case, Expenses is subtracted from Income, and the<br />

result multiplies by TaxRate.<br />

Table 2-3: Operator Precedence in Excel <strong>Formula</strong>s<br />

Symbol Operator<br />

Colon (:), comma (,), space( ) Reference<br />

– Negation<br />

% Percent<br />

^ Exponentiation<br />

* and / Multiplication and division<br />

+ and – Addition and subtraction<br />

& Text concatenation<br />

=, , =, and Comparison

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

Saved successfully!

Ooh no, something went wrong!