This section describes the basic elements used in formulas and the rules Calc uses to calculate formulas. Add-on Program dmathsThe add-on GPL software, dmaths, can be used as an addon to OpenOffice.org or StarOffice 6.0. It helps you more easily write formulas and vectors. See http://www.dmaths.com. Basic OperatorsTable 20-1 shows the operators (symbols that enable calculations and other operations) you'll use frequently in formulas.
Table 20-1. Basic operators you'll use in formulas
Order of Evaluation for ExpressionsWhat's the answer to the following math problem? =5+10*2-14/2+4 If you start the problem left-to-right, the answer is 12. Calc also calculates left-to-right , but it also follows algebraic ordering rules for the order it calculates: it multiplies and divides first, then adds and subtracts. With that in mind, let's simplify the problem by solving the multiplication and division parts first: =5+20-7+4 Then handle the addition and subtraction, working left-to-right, and the answer is 22. ExponentsIf you include exponents in your formulas (for example, 10 2 , which is written as 10^2 in Calc), those are calculated before multiplication and division. Using Parentheses to Control Calculation OrderYou can exercise more control over the calculation order by using parentheses. This is also an algebra thing. Calc solves formulas within parentheses first (using algebraic ordering within the parentheses) before it solves the rest of the formula. Using the previous formula as an example, Table 20-2 shows how using parentheses in different ways can produce different solutions. Table 20-2. Using parentheses to control calculation order
Inevitably as you use parentheses, you'll need to control calculation order further by nesting parentheses within parentheses. For example: =(9*(10-7))/((8*3)-(7*3))+10^2 Calc solves formulas the inner parentheses first. The solution to this formula is 109 (10^2 is the same as 10 2 , or 100). Since most of your formulas will contain cell references (rather, should contain cell references), creating a calculation order with parentheses can get tricky, because you're constantly trying to see which cell references represent which numbers. For example, =(A7*(SUM(B5:B7)))/D2. There are a couple of tricks you can use to help visually map cell references to the numbers they reference:
|