Calc Guide
months time. Use comments and notes liberally to document your
work.
You might be aware that you cannot use negative values or zero values
for a particular argument, but if someone else inputs such a value will
your formula be robust or simply return a standard (and often not too
helpful) Err: message? It is a good idea to trap errors using some form
of logic statements or with conditional formatting.
Place a unique formula in each cell
The most basic strategy is to view whatever formulas are needed as
simple and with a limited useful life. The strategy is then to place a
unique formula in each appropriate cell. This can be recommended
only for very simple or “throw away” (single use) spreadsheets.
Break formulas into parts and combine the parts
The second strategy is similar to the first, but instead you break down
longer formulas into smaller parts and then combine the parts into the
whole. Many examples of this type exist in complex scientific and
engineering calculations where interim results are used in a number of
places in the worksheet. The result of calculating the flow velocity of
water in a pipe may be used in estimating losses due to friction,
whether the pipe is flowing full or partially empty, and in optimizing
the diameter for the given flow regime.
In all cases you should adopt the basic principles of formula creation
described previously.
Use the Basic editor to create functions
A third strategy is to use the Basic editor and create your own
functions and macros. This approach would be used where the result
would greatly simplify the use of the spreadsheet by the end user and
keep the formulas simple with a better chance of avoiding errors. This
approach also can make the maintenance easier by having corrections
or updates kept in one central location. The use of macros is described
in Chapter 12 of this book and is a specialized topic in itself. The
danger of overusing macros and custom functions is that the principles
upon which the spreadsheet is based become much more difficult to
see by a user other than the original author (and sometimes even by
the author!).
204 OpenOffice.org 3.x Calc Guide