Excel 2007 For Dummies
Book image
Explore Book Buy On Amazon

Many formulas that you create in Excel 2007 perform multiple operations. Excel performs each operation, moving from left to right, in a strict pecking order. This is the natural order of arithmetic operations, sometimes called the order of operations, outlined in the table below. You can use parentheses to change the order of operations, even nesting sets of parentheses within each other.

Order of Operator Precedence in Formulas
Precedence Operator Type/Function
1 - Negation
2 % Percent
3 ^ Exponentiation
4 * and / Multiplication and division
5 + and - Addition and subtraction
6 & Concatenation
7 =, <, >, <=, >=, <> All comparison operators

Order of operator precedence

Multiplication and division pull more weight than addition and subtraction and, therefore, are performed first, even if these operations don’t come first in the formula (when reading from left to right).

Consider the series of operations in the following formula:

=A2+B2*C2

If cell A2 contains the number 5, B2 contains the number 10, and C2 contains the number 2, Excel evaluates the following formula:

=5+10*2

In this formula, Excel multiplies 10 times 2 to equal 20 and then adds this result to 5 to produce the result 25.

If you want Excel to perform the addition between the values in cells A2 and B2 before the program multiplies the result by the value in cell C2, enclose the addition operation in parentheses as follows:

=(A2+B2)*C2

The parentheses tell Excel that you want this operation performed before the multiplication. If cell A2 contains 5, B2 contains 10, and C2 contains 2, Excel adds 5 and 10 to equal 15 and then multiplies this result by 2 to produce the result 30.

Use nesting in formulas

In fancier formulas, you may need to add more than one set of parentheses, one within another (like the Russian matryoshka dolls that nest within each other) to indicate the order in which you want the calculations to take place. When nesting parentheses, Excel first performs the calculation contained in the most inside pair of parentheses and then uses that result in further calculations as the program works its way outward. For example, consider the following formula:

=(A4+(B4-C4))*D4

Excel first subtracts the value in cell C4 from the value in cell B4, adds the difference to the value in cell A4, and then finally multiplies that sum by the value in D4.

Without the addition of the two sets of nested parentheses, Excel, if left to its own devices, would first multiply the value in cell C4 by that in D4, add the value in A4 to that in B4, and then perform the subtraction.

Don’t worry too much when nesting parentheses in a formula if you don’t pair them properly so that you have a right parenthesis for every left parenthesis in the formula. Excel displays an alert dialog box that suggests the correction that needs to be made to balance the pairs. If you agree with Excel’s suggested correction, you simply click Yes. However, be sure that you only use parentheses: ( ). Excel balks at the use of brackets — [ ] — or braces — { } — in a formula by giving you an Error alert box.

About This Article

This article is from the book:

About the book author:

Greg Harvey has authored tons of computer books, the most recent being Excel Workbook For Dummies and Roxio Easy Media Creator 8 For Dummies, and the most popular being Excel 2003 For Dummies and Excel 2003 All-In-One Desk Reference For Dummies. He started out training business users on how to use IBM personal computers and their attendant computer software in the rough and tumble days of DOS, WordStar, and Lotus 1-2-3 in the mid-80s of the last century. After working for a number of independent training firms, Greg went on to teach semester-long courses in spreadsheet and database management software at Golden Gate University in San Francisco.
His love of teaching has translated into an equal love of writing. For Dummies books are, of course, his all-time favorites to write because they enable him to write to his favorite audience: the beginner. They also enable him to use humor (a key element to success in the training room) and, most delightful of all, to express an opinion or two about the subject matter at hand.
Greg received his doctorate degree in Humanities in Philosophy and Religion with a concentration in Asian Studies and Comparative Religion last May. Everyone is glad that Greg was finally able to get out of school before he retired.

This article can be found in the category: