Open Office Calc Guide
Open Office Calc Guide
Open Office Calc Guide
3
Calc Guide
Using Spreadsheets in OpenOffice.org 3.3
Copyright
This document is Copyright 20052011 by its contributors as listed below. You may
distribute it and/or modify it under the terms of either the GNU General Public
License (http://www.gnu.org/licenses/gpl.html), version 3 or later, or the Creative
Commons Attribution License (http://creativecommons.org/licenses/by/3.0/), version
3.0 or later. Note that Chapter 8, Using the DataPilot, is licensed under the Creative
Commons Attribution-Share Alike License, version 3.0.
Contributors
Rick Barnes
James Andrew
Stephen Buck
T. J. Frazier
Spencer E. Harpe
John Kane
Jared Kobos
Alexandre Martins
Andrew Pitonyak
Gary Schnabl
Sowbhagya Sundaresan
John Viestenz
Sharon Whiston
Michele Zarri
Peter Kupfer
Krishna Aradhi
Bruce Byfield
Stigant Fyrwitful
Regina Henschel
Kirk Abbott
Sigrid Kronenberger
Kashmira Patel
Iain Roberts
Rob Scott
Nikita Telang
Jean Hollis Weber
Claire Wood
Magnus Adielsson
Martin Fox
Andy Brown
Nicole Cairns
Ingrid Halama
Peter Hillier-Brook
Emma Kirsopp
Shelagh Manton
Anthony Petrillo
Hazel Russman
Jacob Starr
Barbara M Tobias
Stefan Weigel
Linda Worthington
Sandeep Samuel Medikonda
Feedback
Please direct any comments or suggestions about this document to:
[email protected]
Contents
Copyright................................................................................................................... 2
Note for Mac users.................................................................................................... 8
Chapter 1
Introducing Calc.......................................................................................................... 9
What is Calc?........................................................................................................... 10
Spreadsheets, sheets, and cells............................................................................... 10
Parts of the main Calc window................................................................................ 10
Starting new spreadsheets...................................................................................... 18
Opening existing spreadsheets................................................................................ 20
Opening CSV files.................................................................................................... 21
Saving spreadsheets................................................................................................ 22
Password protection................................................................................................. 24
Navigating within spreadsheets.............................................................................. 26
Selecting items in a sheet or spreadsheet...............................................................29
Working with columns and rows.............................................................................. 32
Working with sheets................................................................................................. 33
Viewing Calc............................................................................................................ 34
Using the Navigator................................................................................................. 38
Using document properties...................................................................................... 40
Chapter 2
Entering, Editing, and Formatting Data....................................................................43
Introduction............................................................................................................. 44
Entering data using the keyboard...........................................................................44
Speeding up data entry............................................................................................ 46
Sharing content between sheets.............................................................................. 49
Validating cell contents............................................................................................ 50
Editing data.............................................................................................................. 52
Formatting data....................................................................................................... 53
Autoformatting cells and sheets..............................................................................59
Formatting spreadsheets using themes...................................................................60
Using conditional formatting................................................................................... 60
Hiding and showing data......................................................................................... 61
Sorting records........................................................................................................ 63
Finding and replacing in Calc.................................................................................. 65
Chapter 3
Creating Charts and Graphs...................................................................................... 69
Introduction............................................................................................................. 70
Creating a chart....................................................................................................... 70
Editing charts........................................................................................................... 74
Formatting charts.................................................................................................... 79
Formatting 3D charts............................................................................................... 82
Formatting the chart elements................................................................................85
Windows/Linux
Mac equivalent
Effect
OpenOffice.org >
Preferences
Right-click
Control+click
Ctrl (Control)
z (Command)
F5
Shift+z+F5
F11
z+T
Chapter
Introducing Calc
What is Calc?
Calc is the spreadsheet component of OpenOffice.org (OOo). You can enter data
(usually numerical) in a spreadsheet and then manipulate this data to produce certain
results.
Alternatively, you can enter data and then use Calc in a What if... manner by
changing some of the data and observing the results without having to retype the
entire spreadsheet or sheet.
Other features provided by Calc include:
Note
If you want to use macros written in Microsoft Excel using the VBA
macro code in OOo, you must first edit the code in the OOo Basic IDE
editor. See Chapter 12 (Calc Macros).
Note
10
If any part of the Calc window in Figure 1 is not shown, you can display it
using the View menu. For example, View > Status Bar will toggle (show
or hide) the Status Bar. It is not always necessary to display all the parts,
as shown; show or hide any of them, as desired.
Title bar
The Title bar, located at the top, shows the name of the current spreadsheet. When
the spreadsheet is newly created, its name is Untitled X, where X is a number. When
you save a spreadsheet for the first time, you are prompted to enter a name of your
choice.
Menu bar
Under the Title bar is the Menu bar. When you choose one of the menus, a submenu
appears with other options. You can modify the Menu bar, as discussed in Chapter 14
(Setting Up and Customizing Calc).
File contains commands that apply to the entire document such as Open,
Save, Wizards, Export as PDF, and Digital Signatures.
Edit contains commands for editing the document such as Undo, Changes,
Compare Document, and Find and Replace.
View contains commands for modifying how the Calc user interface looks such
as Toolbars, Full Screen, and Zoom.
11
Window contains commands for the display window such as New Window,
Split, and Freeze.
Help contains links to the Help file bundled with the software, What's This?,
Support, Registration, and Check for Updates.
Toolbars
Calc has several types of toolbars: docked (fixed in place), floating, and tear-off.
Docked toolbars can be moved to different locations or made to float, and floating
toolbars can be docked.
Four toolbars are located under the Menu bar by default: the Standard toolbar, the
Find toolbar, the Formatting toolbar, and the Formula Bar.
The icons (buttons) on these toolbars provide a wide range of common commands
and functions. You can also modify these toolbars, as discussed in Chapter 14
(Setting Up and Customizing Calc).
Placing the mouse pointer over any of the icons displays a small box, called a tooltip.
It gives a brief explanation of the icons function. For a more detailed explanation,
choose Help > Whats This? and hover the mouse pointer over the icon. To turn this
feature off again, click once or press the Esc key twice. Tips and extended tips can be
turned on or off from Tools > Options > OpenOffice.org > General.
12
Moving toolbars
To move a docked toolbar, place the mouse pointer over the toolbar handle, hold
down the left mouse button, drag the toolbar to the new location, and then release
the mouse button.
13
Customizing toolbars
You can customize toolbars in several ways, including choosing which icons are
visible and locking the position of a docked toolbar.
To access a toolbars customization options, use the down-arrow at the end of the
toolbar or on its title bar (Figure 6).
Formatting toolbar
In the Formatting toolbar, the three boxes on the left are the Apply Style, Font
Name, and Font Size lists (see Figure 8). They show the current settings for the
selected cell or area. (The Apply Style list may not be visible by default.) Click the
down-arrow to the right of each box to open the list.
14
Note
If any of the icons (buttons) in Figure 8 is not shown, you can display it by
clicking the small triangle at the right end of the Formatting toolbar,
selecting Visible Buttons in the drop-down menu, and selecting the
desired icon (for example, Apply Style) in the drop-down list. It is not
always necessary to display all the toolbar buttons, as shown; show or
hide any of them, as desired.
Formula Bar
On the left hand side of the Formula Bar is a small text box, called the Name Box,
with a letter and number combination in it, such as D7. This combination, called the
cell reference, is the column letter and row number of the selected cell.
15
the Input line area, click in the area, then type your changes. To edit within the
current cell, just double-click the cell.
Individual cells
The main section of the screen displays the cells in the form of a grid, with each cell
being at the intersection of a column and a row.
At the top of the columns and at the left end of the rows are a series of gray boxes
containing letters and numbers. These are the column and row headers. The columns
start at A and go on to the right, and the rows start at 1 and go down.
These column and row headers form the cell references that appear in the Name Box
on the Formula Bar (see Figure 9). You can turn these headers off by selecting View
> Column & Row Headers.
Sheet tabs
At the bottom of the grid of cells are the sheet tabs. These tabs enable access to each
individual sheet, with the visible (active) sheet having a white tab. Clicking on
another sheet tab displays that sheet, and its tab turns white. You can also select
multiple sheet tabs at once by holding down the Control key while you click the
names.
From Calc 3.3, you can choose colors for the different sheet tabs. Right-click on a tab
and choose Tab Color from the pop-up menu to open a palette of colors. To add new
colors to the palette, see Color options in Chapter 14 (Setting up and Customizing
Calc).
16
Status bar
The Calc status bar provides information about the spreadsheet and convenient ways
to quickly change some of its features.
17
From the operating system menu, in the same way that you start other
programs. When OOo was installed on your computer, in most cases a menu
entry for each component was added to your system menu. If you are using a
Mac, you should see the OpenOffice.org icon in the Applications folder. When
you double-click this icon, OOo opens at the Start Center (Figure 14).
18
From the Start Center. When OOo is open but no document is open (for
example, if you close all the open documents but leave the program running),
the Start Center is shown. Click one of the icons to open a new document of
that type, or click the Templates icon to start a new document using a
template. If a document is already open in OOo, the new document opens in a
new window.
19
You can also open an existing document in one of the following ways. If a document is
already open in OOo, the second document opens in a new window.
20
Figure 16: Text Import dialog, with Comma (,) selected as the separator and double
quotation mark () as the text delimiter.
21
6) In OOo 3.3, two new options are available when importing CSV files that
contain data separated by specific characters.
These options determine whether quoted data will always be imported as text,
and whether Calc will automatically detect all number formats, including
special number formats such as dates, time, and scientific notation. The
detection depends on the language settings.
7) Click OK to open the file.
Caution
If you do not select Text CSV (*csv;*txt;*xls) as the file type when
opening the file, the document opens in Writer, not Calc.
Saving spreadsheets
Spreadsheets can be saved in three ways.
Press Control+S.
Choose File > Save (or Save All or Save As).
Click the Save button on the main toolbar.
If the spreadsheet has not been saved previously, then each of these actions will open
the Save As dialog. There you can specify the spreadsheet name and the location in
which to save it.
Note
If the spreadsheet has been previously saved, then saving it using the
Save (or Save All) command will overwrite an existing copy. However,
you can save the spreadsheet in a different location or with a different
name by selecting File > Save As.
22
Some users of Microsoft Excel may be unwilling or unable to receive *.ods files.
(Perhaps their employer does not allow them to install the plug-in.) In this case, you
can save a document as a Excel file (*.xls or *.xlsx).
1) ImportantFirst save your spreadsheet in the file format used by
OpenOffice.org, *.ods. If you do not, any changes you may have made since the
last time you saved it will only appear in the Microsoft Excel version of the
document.
2) Then choose File > Save As.
3) On the Save As dialog (Figure 17), in the File type (or Save as type) dropdown menu, select the type of Excel format you need. Click Save.
Caution
Tip
From this point on, all changes you make to the spreadsheet will occur
only in the Microsoft Excel document. You have changed the name and
file type of your document. If you want to go back to working with the
*.ods version of your spreadsheet, you must open it again.
To have Calc save documents by default in a Microsoft Excel file format,
go to Tools > Options > Load/Save > General. In the section named
Default file format and ODF settings, under Document type, select
Spreadsheet, then under Always save as, select your preferred file
format.
23
4) In the Export of text files dialog, select the options you want and then click
OK.
Password protection
Calc provides two levels of document protection: read-protect (file cannot be viewed
without a password) and write-protect (file can be viewed in read-only mode but
cannot be changed without a password). Thus you can make the content available for
reading by a selected group of people and for reading and editing by a different
group. This behavior is compatible with Microsoft Excel file protection.
24
1) Use File > Save As when saving the document. (You can also use File > Save
the first time you save a new document.)
2) On the Save As dialog, type the file name, select the Save with password
option, and then click Save.
To read-protect the document, type a password in the two fields at the top
of the dialog box.
To write-protect the document, click the More Options button and select
the Open file read-only checkbox.
25
To write-protect the document but allow selected people to edit it, select
the Open file read-only checkbox and type a password in the two boxes at
the bottom of the dialog box.
4) Click OK to save the file. If either pair of passwords do not match, you receive
an error message. Close the message box to return to the Set Password dialog
box and enter the password again.
Caution
26
Figure 20. (left) One selected cell and (right) a group of selected cells
Using the Tab and Enter keys
Pressing Enter or Shift+Enter moves the focus down or up, respectively.
Pressing Tab or Shift+Tab moves the focus to the right or to the left,
respectively.
Using the arrow keys
Pressing the arrow keys on the keyboard moves the focus in the direction of the
arrows.
Using Home, End, Page Up and Page Down
Home moves the focus to the start of a row.
End moves the focus to the column furthest to the right that contains data.
Page Down moves the display down one complete screen and Page Up moves
the display up one complete screen.
Tip
Use one of the four Alt+Arrow key combinations to resize the height or
width of a cell. (For example: Alt+ increases the height of a cell.)
Movement
Up one cell
Control+
Control+
27
Key Combination
Movement
Control+
Control+
Control+Home
To Cell A1
Control+End
Alt+Page Downn
Alt+Page Up
Control+Page Down
Control+Page Up
Tab
Shift+Tab
Enter
Shift+Enter
28
Note
The sheet tab arrows that appear in Figure 22 only appear if you have
some sheet tabs that can not be seen. Otherwise, they appear faded as
in Figure 1.
29
Tip
You can also select a contiguous range of cells by first clicking in the
STD field on the status bar and changing it to EXT, before clicking in
the opposite corner of the range of cells in step 3 above. If you use this
method, be sure to change EXT back to STD or you may find yourself
extending the selection unintentionally.
Tip
You can also directly select a range of cells using the Name Box. Click
into the Name Box as described in Using a cell reference on page 26.
To select a range of cells, enter the cell reference for the upper lefthand cell, followed by a colon (:), and then the lower right-hand cell
reference. For example, to select the range that would go from A3 to
C6, you would enter A3:C6.
Tip
30
Select All
Selecting sheets
You can select either one or multiple sheets. It can be advantageous to select multiple
sheets at times when you want to make changes to many sheets at once.
Single sheet
Click on the sheet tab for the sheet you want to select. The active sheet becomes
white (see Figure 22).
Multiple contiguous sheets
To select multiple contiguous sheets:
1) Click on the sheet tab for the first desired sheet.
2) Move the mouse pointer over the sheet tab for the last desired sheet.
3) Hold down the Shift key and click on the sheet tab.
All the tabs between these two sheets will turn white. Any actions that you perform
will now affect all highlighted sheets.
Multiple noncontiguous sheets
To select multiple noncontiguous sheets:
1) Click on the sheet tab for the first desired sheet.
2) Move the mouse pointer over the sheet tab for the second desired sheet.
3) Hold down the Control key and click on the sheet tab.
4) Repeat as necessary.
The selected tabs will turn white. Any actions that you perform will now affect all
highlighted sheets.
Chapter 1 Introducing Calc
31
All sheets
Right-click any one of the sheet tabs and choose Select All Sheets from the pop-up
menu.
Note
When you insert a single new column, it is inserted to the left of the
highlighted column. When you insert a single new row, it is inserted
above the highlighted row.
Cells in the new columns or rows are formatted like the corresponding
cells in the column or row before (or to the left of) which the new
column or row is inserted.
32
Tip
Deleting sheets
Sheets can be deleted individually or in groups.
Single sheet
Right-click on the tab of the sheet you want to delete and choose Delete Sheet
from the pop-up menu, or choose Edit > Sheet > Delete from the Menu bar.
Either way, an alert will ask if you want to delete the sheet permanently. Click Yes.
Multiple sheets
To delete multiple sheets, select them as described earlier, then either right-click
over one of the tabs and choose Delete Sheet from the pop-up menu, or choose
Edit > Sheet > Delete from the Menu bar.
33
Renaming sheets
The default name for the a new sheet is SheetX, where X is a number. While this
works for a small spreadsheet with only a few sheets, it becomes awkward when
there are many sheets.
To give a sheet a more meaningful name, you can:
Enter the name in the Name box when you create the sheet, or
Right-click on a sheet tab and choose Rename Sheet from the pop-up menu;
replace the existing name with a different one.
Note
Viewing Calc
Using Zoom
Use the zoom function to change the view to show more or fewer cells in the window.
In addition to using the Zoom slider (new in OOo 3.1) on the Status bar (see page 18),
you can open the Zoom dialog and make a selection on the left-hand side.
34
35
36
Tip
You can also split the screen using a menu command. Click in a cell
immediately below and to the right of where you wish the screen to be
split, and choose Window > Split.
37
Choose Window > Split to remove all split lines at the same time.
Table 2 summarizes the functions of the icons at the top of the Navigator.
38
Action
Data Range. Specifies the current data range denoted by the position of
the cell cursor.
Start/End. Moves to the cell at the beginning or end of the current data
range, which you can highlight using the Data Range button.
Contents. Shows or hides the list of categories.
Toggle. Switches between showing all categories and showing only the
selected category.
Displays all available scenarios. Double-click a name to apply that
scenario. See Chapter 9 (Data Analysis) for more information.
Drag Mode. Choose hyperlink, link, or copy. See Choosing a drag mode
for details.
To jump to a specific cell in the current sheet, type its cell reference in the
Column and Row boxes at the top of the Navigator and press the Enter key; for
example, in Figure 32 the cell reference is A7.
To see the content in only one category, highlight that category and click the
Toggle icon. Click the icon again to display all the categories.
Chapter 1 Introducing Calc
39
Use the Start and End icons to jump to the first or last cell in the selected
data range.
Tip
Ranges, scenarios, pictures, and other objects are much easier to find if
you have given them informative names when creating them, instead of
keeping Calcs default Graphics 1, Graphics 2, Object 1, and so on, which
may not correspond to the position of the object in the document.
Information that changes. You can store data for use in fields in your
document; for example, the title of the document, contact information for a
project participant, or the name of a product might change during the course
of a project.
This dialog can be used in a template, where the field names can serve as reminders
to users of information they need to include.
You can return to this dialog at any time and change the information you entered.
When you do so, all of the references to that information will change wherever they
appear in the document. For example, on the Description page (Figure 33) you might
need to change the contents of the Title field from the draft title to the final title.
40
Figure 34: Custom Properties page, showing drop-down lists of names and types
When the Custom Properties page is first opened in a new document, it may be blank.
However, if the new document is based on a template, this page may contain fields.
Click Add to insert a row of boxes into which you can enter your custom properties.
The Name box includes a drop-down list of typical choices; scroll down to see
all the choices. If none of the choices meet your needs, you can type a new
name into the box.
In the Type column, you can choose from text, date+time, date, number,
duration, or yes/no for each field. You cannot create new types.
41
In the Value column, type or select what you want to appear in the document
where this field is used. Choices may be limited to specific data types
depending on the selection in the Type column; for example, if the Type
selection is Date, the Value for that property is limited to a date.
To remove a custom property, click the button at the end of the row.
Tip
42
To change the format of the Date value, go to Tools > Options >
Languages and change the Locale setting. Be careful! This change
affects all open documents, not just the current one.
Chapter
Entering, Editing, and
Formatting Data
Introduction
You can enter data into Calc in several ways: using the keyboard, the mouse
(dragging and dropping), the Fill tool, and selection lists. Calc also provides the
ability to enter information into multiple sheets of the same document at the same
time.
After entering data, you can format and display it in various ways.
Entering numbers
Click in the cell and type in the number using the number keys on either the main
keyboard or the numeric keypad.
To enter a negative number, either type a minus () sign in front of it or enclose it in
parentheses (brackets), like this: (1234).
By default, numbers are right-aligned and negative numbers have a leading minus
symbol.
Entering text
Click in the cell and type the text. Text is left-aligned by default.
Tip
Numbers can have leading zeros and still be regarded as numbers (as
opposed to text) if the cell is formatted appropriately. Right-click on the
cell and chose Format Cells > Numbers. Adjust the Leading zeros
setting to add leading zeros to numbers.
When a plain apostrophe is used to allow a leading 0 to be displayed, it
is not visible in the cell after the Enter key is pressed. If smart quotes
are used for apostrophes, the apostrophe remains visible in the cell.
Note
44
Caution
When a number is formatted as text, take care that the cell containing
the number is not used in a formula because Calc will ignore the value.
Note
Inserting dashes
To enter en and em dashes, you can use the Replace dashes option under Tools >
AutoCorrect Options > Options tab. This option replaces two hyphens, under
certain conditions, with the corresponding dash.
In the following table, the A and B represent text consisting of letters A to z or digits
0 to 9.
Chapter 2 Entering, Editing, and Formatting Data
45
Result
AB (A, em-dash, B)
A-B (unchanged)
A -B (unchanged)
46
Caution
Tip
Choices that are not available are grayed out, but you can still choose
the opposite direction from what you intend, which could cause you to
overwrite cells accidentally.
A shortcut way to fill cells is to grab the handle in the lower righthand corner of the cell and drag it in the direction you want to fill. If
the cell contains a number, the number will fill in series. If the cell
contains text, the same text will fill in the direction you chose.
Figure 37: Specifying the start of a fill series (result is in Figure 38)
Chapter 2 Entering, Editing, and Formatting Data
47
48
Caution
49
50
Figure 44: Defining an error message for a cell with invalid data
51
Editing data
Editing data is done is in much the same way as entering it. The first step is to select
the cell containing the data to be edited.
52
Formatting data
The data in Calc can be formatted in several ways. It can either be edited as part of a
cell style so that it is automatically applied, or it can be applied manually to the cell.
Some manual formatting can be applied using toolbar icons. For more control and
extra options, select the appropriate cell or cells range, right-click on it, and select
Format Cells. All of the format options are discussed below.
Note
All the settings discussed in this section can also be set as a part of the
cell style. See Chapter 4 (Using Styles and Templates) for more
information.
53
54
Formatting numbers
Several different number formats can be applied to cells by using icons on the
Formatting toolbar. Select the cell, then click the relevant icon. Some icons may not
be visible in a default setup; click the down-arrow at the end of the Formatting bar
and select other icons to display.
Apply any of the data types in the Category list to the data.
Control the number of decimal places and leading zeros.
Enter a custom format code.
The Language setting controls the local settings for the different formats such as the
date order and the currency marker.
55
Tip
To choose whether to show the font names in their font or in plain text,
go to Tools > Options > OpenOffice.org > View and select or
deselect the Show preview of fonts option in the Font Lists section. For
more information, see Chapter 14 (Setting Up and Customizing Calc).
To choose the size of the font, click the arrow next to the
Font Size box on the Formatting toolbar. For other
formatting, you can use the Bold, Italic, or Underline icons.
To choose a font color, click the arrow next to the Font
Color icon to display a color palette. Click on the required
color.
(To define custom colors, use Tools > Options >
OpenOffice.org > Colors. See Chapter 14 for more
information.)
To specify the language of the cell (useful because it allows
different languages to exist in the same document and be
spell checked correctly), use the Font tab of the Format
Cells dialog. See Chapter 4 for more information.
57
Note
The cell border properties apply to a cell, and can only be changed if
you are editing that cell. For example, if cell C3 has a top border
(which would be equivalent visually to a bottom border on C2), that
border can only be removed by selecting C3. It cannot be removed in
C2.
58
Note
If the selected cell range does not have column and row headers,
AutoFormat is not available.
59
2) In the Theme Selection dialog, select the theme that you want to apply to the
spreadsheet. As soon as you select a theme, some of the properties of the
custom styles are applied to the open spreadsheet and are immediately visible.
3) Click OK. If you wish, you can now go to the Styles and Formatting window to
modify specific styles. These modifications do not change the theme; they only
change the appearance of this specific spreadsheet document.
Note
Conditional formatting depends upon the use of styles. If you are not familiar with
styles, please refer to Chapter 4. An easy way to set up the required styles is to
format a cell the way you want it and click the New Style from Selection icon in the
Styles and Formatting window.
After the styles are set up, here is how to use them.
1) In your spreadsheet, select the cells to which you want to apply conditional
formatting.
2) Choose Format > Conditional Formatting from the menu bar.
3) On the Conditional Formatting dialog (Figure 57), enter the conditions. Click
OK to save. The selected cells are now formatted in the relevant style.
Cell value is / Formula is
Specifies whether conditional formatting is dependent on a cell value or on a
formula. If you select cell value is, the Cell Value Condition box is displayed, as
shown in the example. Here you can choose from conditions including less than,
greater than, between, and others.
60
Parameter field
Enter a reference, value, or formula in the parameter field, or in both parameter
fields if you have selected a condition that requires two parameters. You can also
enter formulas containing relative references.
61
To hide or show sheets, rows, and columns, use the options on the Format menu or
the right-click (context) menu. For example, to hide a row, first select the row, and
then choose Format > Row > Hide (or right-click and choose Hide).
To hide or show selected cells, choose Format > Cells from the menu bar (or rightclick and choose Format Cells). On the Format Cells dialog, go to the Cell Protection
tab.
62
Sorting records
Sorting rearranges the visible cells on the sheet. In Calc, you can sort by up to three
criteria, which are applied one after another. Sorts are handy when you are searching
for a particular item, and become even more powerful after you have filtered data.
In addition, sorting is often useful when you add new information. When a list is long,
it is usually easier to add new information at the bottom of the sheet, rather than
inserting rows in the proper places. After you have added the information, you can
sort it to update the sheet.
Highlight the cells to be sorted, then select Data > Sort to open the Sort
dialog (Figure 60) or click the Sort Ascending or Sort Descending
63
toolbar buttons. Using the dialog, you can sort the selected cells using up to three
columns, in either ascending (A-Z, 1-9) or descending (Z-A, 9-1) order.
Tip
You can define a custom sort order if the supplied alphanumeric ones do
not fit your requirements. See Defining a fill series on page 48 for
instructions.
64
Case sensitive
If two entries are otherwise identical, one with an upper case letter is placed
before one with a lower case letter in the same position if the sort is descending; if
the sort is ascending, then the entry with an upper case letter is placed after one
with a lower case letter in the same position.
Range contains column labels
Does not include the column heading in the sort.
Include formats
A cell's formatting is moved with its contents. If formatting is used to distinguish
different types of cells, then use this option.
Copy sort results to
Sets a spreadsheet address to which to copy the sort results. If a range is
specified that does not have the necessary number of cells, then cells are added. If
a range contains cells that already have content, then the sort fails.
Custom sort order
Select the box, then choose from the drop-down list one of the sort orders defined
in Tools > Options > OpenOffice.org Calc > Sort Lists.
Direction
Sets whether rows or columns are sorted. The default is to sort by columns unless
the selected cells are in a single column.
Type a search term in the Find box, and then click the Find Next (down-arrow) or
Find Previous (up-arrow) button. To find other occurrences of the same term,
continue clicking the button.
65
Text and numbers in cells may have been entered directly or may be the result of a
calculation. The search method you use depends on the type of data you are
searching for.
Tip
By default, Calc searches the current sheet. To search through all sheets of the
document, click More Options, then select Search in all sheets option.
Caution
Use Replace All with caution; otherwise, you may end up with some
highly embarrassing mistakes. A mistake with Replace All might
require a manual, word-by-word search to fix, if it is not discovered in
time to undo it.
66
67
Tip
The online help describes many of the regular expressions and their
uses.
In Calc, regular expressions are applied separately to each cell. This means
that a search for r.d will match red in cell A1 but will not match r in cell A2
and d (or ed) in cell A3. (The regular expression r.d means the system will try
to match r followed by any other character followed by d.)
When a match is found, the entire cell is highlighted but only the text found
will be replaced. For example, searching for brown will result in highlighting a
cell containing redbrown clay, and choosing nothing in the Replace with box
leaves the cell containing red clay.
If Find is used twice in a row, and the second time the Current selection only
box is activated, then the second search will evaluate the whole of each
selected cell, not just the strings that caused the cells to be selected in the first
search. For example, searching for joh?n, then activating Current selection
only and searching for sm.th will find cells containing Jon Smith and
Smythers, Johnathon.
The hard line break acts to mark end of text (similar to end of paragraph in
Writer), found by the regular expression special character $, in addition to the
end of text in the cell. For example, if a cell contains red [hard line break]
clay then a search for d$ replacing with al leaves the cell with real [hard line
break] clay. Note that with this syntax the hard line break is not replaced.
Using \n in the Replace with box will replace with the literal characters \n, not
a hard line break.
The Find & Replace dialog has an option to search within formulas, values, or
notes. This option applies to any search, not just one using regular
expressions. Searching with the Formulas option for SUM would find a cell
containing the formula =SUM(A1:A6) as well as a cell containing the simple
text SUMMARY.
Searching for the regular expression ^$ will not find empty cells. This is
Finding cell contents using the regular expression .+ (or similar) and replacing
them with & effectively re-enters the cell contents without any formatting. This
technique can be used to remove formatting automatically applied by Calc
when importing data from the clipboard or from badly formatted files. For
example, to convert text strings consisting of digits into actual numbers, first
format the cells as numbers and then perform the search and replace.
See Chapter 7 (Using Formulas and Functions) for the use of regular expressions
within formulas.
68
Chapter
Creating Charts and
Graphs
Presenting information visually
Introduction
Charts and graphs are often powerful ways to convey information to the reader.
OpenOffice.org Calc offers a variety of chart and graph formats for your data.
Using Calc, you can customize charts and graphs to a considerable extent. Many of
these options enable you to present your information in the best and clearest manner.
For readers who are interested in effective ways to present information graphically,
two excellent introductions to the topic are William S. Clevelands The elements of
graphing data, 2nd edition, Hobart Press (1994) and Edward R. Tuftes The Visual
Display of Quantitative Information, 2nd edition, Graphics Press (2001).
Creating a chart
To demonstrate the process of making charts and graphs in Calc, we will use the
small table of data in Figure 63.
70
Next, open the Chart Wizard dialog using one of two methods.
Tip
Before choosing the Chart Wizard, place the cursor anywhere in the area
of the data. The Chart Wizard will then do a fairly good job of guessing
the range of the data. Just be careful that you have not included the title
of your chart.
71
Tip
Another way to plot any unconnected columns of data is to select the first data series
and then select the next series while holding down the Ctrl key. Or you can type the
columns in the text boxes. The columns must be separated by semi-colons. Thus, to
plot B3:B11 against G3:G11, type the selection range as B3:B11;G3:G11.
The two data series you are selecting must be in separate columns or rows.
Otherwise Calc will assume that you are adding to the same data series.
Click Next to deal with titles, legend and grids.
73
You can leave out the legend or include it and place it to the left, right, top or bottom.
To confirm your selections and complete the chart, click Finish.
Editing charts
After you have created a chart, you may find things you would like to change. Calc
provides tools for changing the chart type, chart elements, data ranges, fonts, colors
and many other options, through the Insert and Format menus, the right-click
(context) menu and the Chart toolbar.
Chart wall contains the graphic of the chart displaying the data.
Chart area is the area surrounding the chart graphic. The (optional) chart title
and the legend (key) are in the chart area.
74
The default 3D chart also has the chart floor, which is not available in 2D charts.
Chart title
Chart wall
Legend
Chart area
Axis labels
Chart floor
75
Data labels
Data labels put information about each data point on the chart. They can be very
useful for presenting detailed information, but you need to be careful to not create a
chart that is too cluttered to read.
Select the graph as described above and choose Insert > Data Labels. The options
are as follows.
Placement
Selects the placement of data labels relative to the objects.
Figure 77 on page 83 shows examples of values as text (neither Show value as
number nor Show value as percentage selected) and values as percentages, as well
as when data values are used as substitutes for legends or in conjunction with them.
Trend lines
When you have a scattered grouping of points in a graph, you may want to show the
relationship of the points. A trend line is what you need. Calc has a good selection of
regression types you can use for trend lines: linear, logarithm, exponential, and
power. Choose the type that comes closest to passing through all of the points.
To insert trend lines for all data series, double-click the chart to enter edit mode.
Choose Insert > Trend Lines, then select the type of trend line from None, Linear,
Logarithmic, Exponential, or Power. You can also choose whether to show the
equation for the trend line and the coefficient of determination (R 2).
To insert a trend line for a single data series, first select the data series in the chart,
and then right-click and choose Insert > Trend Line from the context menu. The
dialog for a single trend line is similar to the one below but has a second tab (Line),
where you can choose attributes (style, color, width, and transparency) of the line.
77
The trend line has the same color as the corresponding data series. To change the
line properties, select the trend line and choose Format Trend Line. This opens the
Line tab of the Trend Lines dialog.
To show the trend line equation, select the trend line in the chart, right-click to open
the context menu, and choose Insert Trend Line Equation.
When the chart is in edit mode, OpenOffice.org gives you the equation of the trend
line and the correlation coefficient. Click on the trend line to see the information in
the status bar. To show the equation and the correlation coefficient, select the line
and choose Insert R2 and Trend Line Equation.
For more details on the regression equations, see the topic Trend lines in charts in
the Help.
Y error bars
If you are presenting data that has a known possibility of error, such as social surveys
using a particular sampling method, or you want to show the measuring accuracy of
the tool you used, you may wish to show error bars on the chart. Select the chart and
choose Insert > Y Error Bars.
Several options are provided on the Error Bars dialog. You can only choose one
option at a time. You can also choose whether the error indicator shows both positive
and negative errors, or only positive or only negative.
Constant Value you can have separate positive and negative values.
Percentage choose the error as a percentage of the data points.
78
Variance shows error calculated on the size of the biggest and smallest
data points
Cell Range calculates the error based on cell ranges you select. The
Formatting charts
The Format menu has many options for formatting and fine-tuning the appearance of
your charts.
Double-click the chart so that it is enclosed by a gray border indicating edit mode;
then, select the chart element that you want to format. Choose Format from the
menu bar, or right-click to display a context menu relevant to the selected element.
The formatting choices are as follows.
Format Selection
Opens a dialog in which you can specify the area fill, borders, transparency,
characters, font effects, and other attributes of the selected element of the chart
(see page 85).
Position and Size
Opens a dialog (see page 88).
Arrangement
Provides two choices: Bring Forward and Send Backward, of which only one
may be active for some items. Use these choices to arrange overlapping data
series.
Title
Formats the titles of the chart and its axes.
Legend
Formats the location, borders, background, and type of the legend.
Axis
Formats the lines that create the chart as well as the font of the text that appears
on both the X and Y axes.
Grid
Formats the lines that create a grid for the chart.
Chart Wall, Chart Floor, Chart Area
These functions are described in the following sections.
Chart Type
Changes what kind of chart is displayed and whether it is two- or threedimensional.
Chapter 3 Creating Charts and Graphs
79
Data Ranges
Explained on page 72 (Figure 67 and Figure 68).
3D View
Formats 3D charts (see page 82).
Note
Chart Floor and 3D View are only available for a 3D chart. These
options are unavailable (grayed out) if a 2D chart is selected.
In most cases you need to select the exact element you want to format. Sometimes
this can be tricky to do with the mouse, if the chart has many elements, especially if
some of them are small or overlapping. If you have Tooltips turned on (in Tools >
Options > OpenOffice.org > General > Help, select Tips), then as you move the
mouse over each element, its name appears in the Tooltip. Once you have selected
one element, you can press Tab to move through the other elements until you find the
one you want. The name of the selected element appears in the Status Bar.
Until OOo 3.2.1, axis labels and axis titles were included in the
positioning rectangle of the chart. The space required for those labels
depends on many factors like scaling, font, font size, and so on. To
prevent the data plot itself from changing size and position, the labels are
no longer included in the diagram size, so you can set the position and
size of the plot area directly.
Note
80
Note
Tip
If your chart graphic is 3D, round red handles appear which control the
three-dimensional angle of the graphic. You cannot resize or reposition
the graphic while the round red handles are showing. With the round red
handles showing, Shift+Click to get the green resizing handles. You can
now resize and reposition your 3D chart graphic. See the following tip.
You can resize the chart graphic using its green resizing handles
(Shift+Click, then drag a corner handle to maintain the proportions).
However, you cannot resize the title or the key.
81
Changing colors
If you need a different color scheme from the default for the charts in all your
documents, go to Tools > Options > Charts > Default Colors, which has a much
wider range of colors to choose from. Changes made in this dialog affect the default
chart colors for any chart you make in future.
Formatting 3D charts
Use Format > 3D View to fine tune 3D charts. The 3D View dialog has three pages,
where you can change the perspective of the chart, determine whether the chart uses
the simple or realistic schemes or your own custom scheme, and the illumination that
controls where the shadows will fall.
Set all angles to 0 for a front view of the chart. Pie charts and donut charts are
shown as circles.
With Right-angled axes enabled, you can rotate the chart contents only in the X
and Y direction; that is, parallel to the chart borders.
82
An x value of 90, with y and z set to 0, provides a view from the top of the
chart. With x set to 90, the view is from the bottom of the chart.
The rotations are applied in the following order: x first, then y, and z last.
When shading is enabled and you rotate a chart, the lights are rotated as if
they are fixed to the chart.
The rotation axes always relate to the page, not to the charts axes. This is
different from some other chart programs.
Set the focus length in the box next to the Perspective option (it becomes
active when you select the option). 100% gives a perspective view where a far
edge in the chart looks approximately half as big as a near edge.
Appearance
Use the Appearance page to modify some aspects of a 3D charts appearance.
83
Illumination
Use the Illumination page (Figure 78) to set the light sources for the 3D view. Refer
to the Draw Guide for more details on setting the illumination.
Click any of the eight buttons to switch a directed light source on or off. By default,
the second light source is switched on. It is the first of seven normal, uniform light
sources. The first light source projects a specular light with highlights.
For the selected light source, you can then choose a color and intensity in the list just
below the eight buttons. The brightness values of all lights are added, so use dark
colors when you enable multiple lights.
84
85
86
87
To format the drawing objects, right-click and choose your changes from the context
menu.
Position is defined as a X,Y coordinate relative to a fixed point (the base point),
typically located at the upper left of the document. You can temporarily change this
base point to make positioning or dimensioning simpler (click on the spot
corresponding to the location of the base point in either of the two selection windows
on the right side of the dialogupper for positioning or lower for dimensioning).
The possible base point positions correspond to the handles on the selection frame
plus a central point. The change in position lasts only as long as you have the dialog
open; when you close this dialog, Calc resets the base point to the standard position.
Tip
The Keep ratio option is very useful. Select it to keep the ratio of width
to height fixed while you change the size of an object.
Either or both the size and position can be protected so that they cannot be
accidentally changed. Select the appropriate options.
Tip
Column charts
Column charts are commonly used for data that shows trends over time. They are
best for charts that have a relatively small number of data points. (For a larger time
series, a line chart would be better.) It is the default chart type, as it is one of the
most useful charts and the easiest to understand.
Bar charts
89
Bar charts are excellent for giving an immediate visual impact for data comparison in
cases when time is not an important factor, for example when comparing the
popularity of a few products in a marketplace.
The first chart in Figure 83 is achieved quite simply by using the chart wizard
with Insert > Grids, deselecting y-axis, and using Insert > Mean Value
Lines.
The second chart in the figure is the 3D option in the chart wizard with a
simple border and the 3D chart area twisted around.
The third chart in the figure is an attempt to get rid of the legend and put
labels showing the names of the companies on the axis instead. We also
changed the colors to a hatch pattern.
Pie charts
Pie charts are excellent when you need to compare proportions. For example, a pie
chart would be ideal if you needed to figure out comparisons of departmental
spending, what the department spent on different items or what different
departments spent. These charts work best with smaller numbers of values, no more
than about half a dozen. Any more than this and the visual impact starts to fade.
As the Chart Wizard guesses the series that you wish to include in your pie chart, you
might need to adjust this initially on the Wizards Data Ranges page if you know you
want a pie chart or by using the Format > Data Ranges > Data Series dialog.
You can do some interesting things with a pie chart, especially if you make it into a
3D chart. It can then be tilted, given shadows, and generally turned into a work of
art.
You can choose an option in the Chart Wizard to explode the pie chart, but this is an
all-or-nothing option. If your aim is to accentuate one piece of the pie, you can
separate out one piece by carefully highlighting it after you have finished with the
Chart Wizard, and dragging it out of the group. When you do this, you might need to
enlarge the chart area again to regain the original size of the pieces.
The first example is a 2D pie chart with one part of the pie exploded. To produce
this type of chart, first choose Insert > Legend and deselect Display legend.
Choose Insert > Data Labels and choose Show value as number. Then carefully
select the piece you wish to highlight, move the cursor to the edge of the piece and
click (the piece will have nine green highlight squares to mark it), and then drag it
90
out from the rest of the pieces. The pieces will decrease in size, so you need to
highlight the chart wall and drag it at a corner to increase the size.
The second example is a 3D pie chart with realistic schema and illumination. With
a completed 2D pie chart, choose Format > 3D view > Illumination where you can
change the direction of the light, the color of the ambient light, and the depth of the
shade. We also adjusted the 3D angle of the disc in the Perspective dialog on the
same set of tabs.
The chart updates as you make changes, so you can immediately see the effects.
If you want to separate out one of the pieces, click on it carefully; you should see a
wire frame highlight. Drag it out with the mouse and then, if necessary, increase the
size of the chart wall.
The third example is a 3D pie chart with different fill effects in each portion of the
pie. Choose Insert > Data labels and select Show value as percentage. Carefully
select each of the pieces so that it has a wire frame, then highlight and right-click to
get the object properties dialog. Choose the Area tab. For one of the pieces we chose
a bitmap effect, for another we selected a gradient feature and for the third we used
the Transparency tab and adjusted the transparency to 50%.
Donut charts
Donut charts are a variation on the pie chart. To create one, choose Pie in the Chart
Type dialog, and choose the third or fourth type of pie chart. For more variety,
consider selecting 3D Look.
91
Area charts
An area chart is a version of a line or column graph. It may be useful where you wish
to emphasize volume of change. Area charts have a greater visual impact than a line
chart, but the data you use will make a difference.
Figure 87: Area chartsthe good, the bad, and the ugly
As shown in Figure 87, an area chart is sometimes tricky to use. This may be one
good reason to use transparency values in an area chart. After setting up the basic
chart using the Chart Wizard, do the following:
Right-click on the y-axis and choose Delete Major Grid. As the data overlaps,
some of it is is lost behind the first data series. This is not what you want. A
better solution is shown in the highlighted chart below and is explained in the
next point.
After deselecting the y-axis grid, right-click on each data series in turn and
choose Format Data Series. On the Transparency tab, set Transparency to
50%. The transparency makes it easy to see the data hidden behind the first
data series. Now, right-click on the x-axis and choose Format Axis. On the
Label tab, choose Tile in the Order section and set the Text orientation to 55
degrees. This places the long labels at an angle.
To create the third variation, after doing the steps above, right-click and
choose Chart Type. Choose the 3D Look option and select Realistic from the
drop-down list. We also twisted the chart area around and gave the chart wall
92
a picture of the sky. As you can see, the legend turns into labels on the z-axis.
But overall, though it is visually more appealing, it is more difficult to see the
point you are trying to make with the data.
Other ways of visualizing the same data series are represented by the stacked area
chart or the percentage stacked area chart.
Line charts
A line chart is a time series with a progression. It is ideal for raw data, and useful for
charts with plentiful data that show trends or changes over time where you want to
emphasize continuity. On line charts, the x-axis is ideal to represent time series data.
Scatter or XY charts
Scatter charts are great for visualizing data that you have not had time to analyze,
and they may be the best for data when you have a constant value against which to
Chapter 3 Creating Charts and Graphs
93
compare other data. Examples of good scatter charts might include weather data,
reactions under different acidity levels, conditions at altitude or any data which
matches two series of numeric data. In contrast to line charts, the x-axis is to the left
of the right labels, which usually indicates a time series.
Scatter charts may surprise those unfamiliar with how they work. While constructing
the chart, if you choose Data Range > Data series in rows, the first row of data
represents the x-axis. The rest of the rows of data are then compared against the first
row data. Figure 90 shows a comparison of three currencies with the Japanese Yen.
Even though the table presents the monthly series, the chart does not. In fact the
Japanese Yen does not appear; it is merely used as the constant series that all the
other data series are compared against.
Bubble charts
A bubble chart is a variation of a scatter chart in which the data points are replaced
with bubbles. It shows the relations of three variables in two dimensions. Two
variables are used for the position on the X-axis and Y-axis, while the third is shown
as the relative size of each bubble. One or more data series can be included in a
single chart.
Bubble charts are often used to present financial data. The data series dialog for a
bubble chart has an entry to define the data range for the bubbles and their sizes.
94
Net charts
A net chart is similar to a polar or radar chart. It is useful for comparing data that is
not a time series but shows different circumstances, such as variables in a scientific
experiment or direction. The poles of the net chart are equivalent to the y-axes of
other charts. Generally, between three and eight axes are best; any more and this
type of chart becomes confusing. Before and after values can be plotted on the same
chart, or perhaps expected and real results, so that differences can be compared.
Figure 92 shows two types of net charts:
Figure 92: Two net diagrams showing totally fabricated data from totally fictional
experiments.
95
Other varieties of a net chart can be made to show the data series as stacked
numbers or stacked percentages. The series can also be filled with a color (Figure
93). Partial transparency is often best for showing all the series all at once.
Stock charts
A stock chart is a specialized column graph specifically for stocks and shares. You can
choose traditional lines, candlestick, and two-column type charts. The data required
for these charts is quite specialized, with series for opening price, closing price and
high and low prices. In this type of chart, the x-axis represents a time series.
When you set up a stock chart in the Chart Wizard, the Data Series dialog is very
important. You need to tell it which series represents the opening price, the closing
price, the high and low price of the stock, and so on.
97
Chapter
Using Styles and
Templates in Calc
Bringing uniformity to your spreadsheets
What is a template?
A template is a model that you use to create other documents. For example, you can
create a template for invoices that has your companys logo and address at the top of
the page. New spreadsheets created from this template will all have your companys
logo and address on the first page.
Templates can contain anything that regular documents can contain, such as text,
graphics, styles, and user-specific setup information such as measurement units,
language, the default printer, and toolbar and menu customization.
All documents in OpenOffice.org are based on templates. You can create, or download
and install, as many templates as you wish. If you do not specify a template when you
start a new a new spreadsheet, the new spreadsheet is based on the default template
for spreadsheets. If you have not specified a default template, OOo uses the blank
spreadsheet template that is installed with OOo. See Setting a default template on
page 113.
Cell styles include fonts, alignment, borders, background, number formats (for
example, currency, date, number), and cell protection.
Page styles include margins, headers and footers, borders and backgrounds,
and the sequence for printing sheets. The page size, orientation, and other
attributes of a page style apply only when a spreadsheet is printed; they are
not displayed onscreen.
99
Cell styles
Similar to paragraph styles in OOo Writer, cell styles are the most basic type of style
in Calc. You can apply a cell style to a cell and that cell will follow the formatting
rules of the style. Five cell styles are supplied with OOo: Default, Heading, Heading1,
Result, and Result2.
Initially, the styles are configured so that if you change the font family of Default,
then all of the other styles will change to match. We will discuss how to set this up in
Creating new (custom) styles on page 106. The five standard styles can be seen in
use in Figure 96.
Page styles
Page styles in Calc are applied to sheets. Although one sheet may print on several
pages (pieces of paper), only one page style can be applied to a sheet. If a
spreadsheet file contains more than one sheet, the different sheets can have different
page styles applied to them. So, for example, a spreadsheet might contain one sheet
to be printed in landscape orientation (using the Default page style) and another
sheet to be printed in portrait orientation (using the Report page style).
Two page styles are supplied with Calc: Default and Report. The major difference
between these two styles is that Report is portrait-oriented and Default is landscapeoriented. You can adjust many settings using page styles. You can also define as many
page styles as you wish.
Because spreadsheets are primarily used onscreen and not printed, Calc does not
display the page style on the screen. If you want a spreadsheet to fit on a certain
page size, you have to carefully control the column width and row height, with only
File > Page Preview to guide you.
Despite this limitation, its well worth defining page styles for any spreadsheets that
you are likely to print. Otherwise, if a need for printing does arise, you may lose time
to trial and error.
Accessing styles
The main way to access styles is through the Styles and Formatting window (shown in
Figure 97). You can open this window in several ways.
The Styles and Formatting window can be docked at the left or right of the main Calc
window. To dock or undock the window, hold down the Ctrl key and double-click a
gray part of the window next to the icons at the top.
The first button on the top left of the window,
3) Position the moving icon on the cell to be styled and click the mouse button.
4) To quit Fill Format mode, click the Fill Format mode icon again or close the
Styles and Formatting window.
Caution
102
To find out which page style is in use for a selected sheet, look in status bar.
Figure 99: Status bar showing location of page style information below
the sheet tabs.
Modifying styles
To modify a style, right-click on its name in the Styles and Formatting window and
choose Modify. Make the changes in the Style dialog and click OK to save the
changes.
You can also modify a current cell style by selecting an already formatted cell and
clicking the Update Style button on the top right hand corner of the Styles and
Formatting window.
Style organizer
Right click on the name of a style in the Styles and Formatting window and click
Modify to open a Style dialog similar to the one shown in Figure 100.
The Style dialog has several tabs. The Organizer tab, shown in Figure 100 for cell
styles, is found in all components of OOo. It provides basic information about the
style. The Organizer tab for page styles is similar to the one shown for cell styles.
103
Name
This is the styles name. You cannot change the name of a built-in style, but you
can change the name of a custom style.
Linked with
This option is only available for cell styles; page styles cannot be linked. If you link
cell styles, then when you change the base style (for example, by changing the
font from Times to Helvetica), all the linked styles will change as well. Sometimes
this is exactly what you want; other times you do not want the changes to apply to
all the linked styles. It pays to plan ahead.
For example, you can make a new style called red, in which the only change you
want to make is for the cell text to be red. In order to make sure that the rest of
the text characteristics are the same as the default style, you can link red with
default. Then, any changes you make to default will be automatically applied to
red.
Category
In Calc, the only option in this drop-down box is Custom styles.
Numbers
On the Numbers tab, you can control the behavior of the data in a cell with this style.
This includes specifying the type of data, the number of decimal places, and the
language.
Font
Use the Font tab to choose the font for the cells contents.
Font effects
The Font Effects tab offers more font options including underlining, strikethrough,
and color.
Alignment
Use the Alignment tab to set the horizontal and vertical alignment for the data in the
cells, and rotate the text.
Borders
Use the Borders tab to set the borders for the cells, along with a shadow.
Background
Use the Background tab to choose the background color for a cell.
104
Cell protection
Use the Cell Protection options to protect cells against certain types of editing.
Page
Use the Page tab to edit the overall appearance of the page and its layout. The
available options are shown in Figure 101.
105
Mirrored formats the pages as if you want to bind the printed pages like a book.
The first page of a document is assumed to be an odd page.
Layout settings: Format
This area specifies the page numbering style for this page style.
Layout settings: Table alignment
This option specifies the alignment options for the cells on a printed page, either
horizontal or vertical.
Borders
The Border and Background tabs for pages duplicate the tabs of the same name on
cell styles, and are over-ridden by the cell style or manual settings. You may choose
to ignore the Border and Background tabs altogether in page styles. Both tabs are
illustrated with helpful diagrams.
Similar to formatting a cell style, use the Borders tab to choose whether the page
should have borders, how large the borders should be, and how far the text will be
from the borders.
Background
Use this tab to specify the background for this page style. You can apply either a solid
color or a picture as a background.
Header
Use this tab to design and apply the header for this page style. For more detailed
instructions on how to format the header, see Chapter 6 (Printing, Exporting, and Emailing).
Footer
Use this tab to design and apply the footer for this page style. For more detailed
instructions on how to format the footer, see Chapter 6.
Sheet
By far the most important settings for Calc page styles are on the Sheet tab. Although
the Sheet tab includes an option that sets the first page option, most of its settings
involve exactly how your spreadsheet will print. See Chapter 6.
Note
106
New styles apply only to this document; they are not saved in the
template. To save new styles in a template, see Copying and moving
styles on page 107 and Creating a template on page 110.
107
2) In the Template Management dialog (Figure 103), set the lists at the bottom to
either Templates or Documents, as needed. The default is Templates on the left
and Documents on the right.
Tip
To copy styles from a file that is not open, click the File button. When
you return to this dialog, both lists show the selected file as well as all
the currently open documents.
3) Open the folders and find the templates from and to which you want to copy.
Double-click on the name of the template or document, and then double-click
the Styles icon to show the list of individual styles (Figure 104).
4) To copy a style, hold down the Ctrl key and drag the name of the style from
one list to the other.
5) Repeat for each style you want to copy. If the receiving template or document
has many styles, you may not see any change unless you scroll down in the list.
When you are finished, click Close.
Deleting styles
You cannot remove (delete) any of Calcs predefined styles, even if you are not using
them.
You can remove any user-defined (custom) styles; but before you do, you should make
sure the styles are not in use. If an unwanted style is in use, you will want to replace
it with a substitute style.
Replacing styles (and then deleting the unwanted ones) can be very useful if you are
dealing with a spreadsheet that has been worked on by several people.
To delete unwanted styles, right-click on them (one at a time) in the Styles and
Formatting window and click Delete on the pop-up menu. Choose Yes in the
confirmation pop-up.
109
4) Select the template that you want to use. You can preview the selected
template or view the templates properties:
5) Click Open. The Templates and Documents dialog closes and a new document
based on the selected template opens in Calc. You can then edit and save the
new document just as you would any other document.
Creating a template
You can create a template from a document:
1) Open a new or existing document of the type you want to make into a template
(text document, spreadsheet, drawing, presentation).
2) Add the content and styles that you want.
3) From the main menu, choose File > Templates > Save. The Templates dialog
opens .
4) In the New template field, type a name for the new template.
5) In the Categories list, click the category to which you want to assign the
template. The category you choose has no effect on the template itself; it is
simply the folder in which you save the template. Choosing an appropriate
folder (category) makes it easier to find the template when you want to use it.
You may wish to create a folder for Calc templates.
To learn more about template folders, see Organizing templates on page 115.
6) Click OK to save the new template.
Printer settings: which printer, single sided / double sided, and paper size, and
so on
Templates can also contain predefined text, saving you from having to type it every
time you create a new document. For example, an invoice template might contain
your companys name, address and logo.
You can also save menu and toolbar customizations in templates; see Chapter 14
(Setting up and Customizing Calc) for more information.
Editing a template
You can edit a templates styles and content, and then, if you wish, you can reapply
the templates styles to documents that were created from that template. (Note that
you can only reapply styles. You cannot reapply content.)
To edit a template:
1) From the main menu, choose File > Templates > Organize. The Template
Management dialog opens.
111
Caution
Note
If you choose Keep Old Styles in the message box shown in Figure 108,
that message will not appear again the next time you open the document
after changing the template it is based on. You will not get another
chance to update the styles from the template, although you can use the
macro given in the Note below to re-enable this feature.
Sub FixDocV3
' set UpdateFromTemplate
oDocSettings = ThisComponent.createInstance( _
"com.sun.star.document.Settings" )
oDocSettings.UpdateFromTemplate = True
End Sub 'FixDocV3
4) Click the Run BASIC icon, then close the Basic window.
5) Save the document.
Next time when you open this document you will have the update from
template feature back.
112
113
114
Organizing templates
OOo can only use templates that are in OOo template folders. You can create new
OOo template folders and use them to organize your templates, and import templates
into those folders. For example, you might have one template folder for report
templates and another for letter templates. You can also export templates.
To begin, choose File > Templates > Organize from the main menu. The Template
Management dialog opens.
Note
Moving a template
To move a template from one template folder to another template folder:
1) In the Template Management dialog, double-click the folder that contains the
template you want to move. A list of the templates contained in that folder
appears underneath the folder name.
2) Click the template that you want to move and drag it to the desired folder. If
you do not have the authority to delete templates from the source folder, this
action copies the template instead of moving it.
Deleting a template
You cannot delete templates supplied with OOo or installed using the Extension
Manager; you can only delete templates that you have created or imported.
115
To delete a template:
1) In the Template Management dialog, double-click the folder that contains the
template you want to delete. A list of the templates contained in that folder
appears underneath the folder name.
2) Click the template that you want to delete.
3) Click the Commands button and choose Delete from the drop-down menu. A
message box appears and asks you to confirm the deletion. Click Yes.
Importing a template
If the template that you want to use is in a different location, you must import it into
an OOo template folder.
To import a template into a template folder:
1) In the Template Management dialog, select the folder into which you want to
import the template.
2) Click the Commands button and choose Import Template from the dropdown menu. A standard file browser window opens.
3) Find and select the template that you want to import and click Open. The file
browser window closes and the template appears in the selected folder.
4) If you want, type a new name for the template, and then press Enter.
Exporting a template
To export a template from a template folder to another location:
1) In the Template Management dialog, double-click the folder that contains the
template you want to export. A list of the templates contained in that folder
appears underneath the folder name.
2) Click the template that you want to export.
3) Click the Commands button and choose Export Template from the dropdown menu. The Save As window opens.
4) Find the folder into which you want to export the template and click Save.
116
Chapter
Using Graphics in Calc
Graphics in Calc
Calc is often used to present data and make forecasts and predictions. Graphics can
turn an average document into a memorable one. Calc can import various vector (line
drawing) and raster (bitmap) file formats. The most commonly used graphic formats
are GIF, JPG, PNG, and BMP. See the Help for a full list of the formats OOo can
import.
Graphics in Calc are of three basic types:
Note
The term graphics refers to both pictures and drawing objects. Often
the word images is used when referring to pictures and other graphics
that are not drawing objects.
2) Choose Insert > Picture > From File from the menu bar, or click the Insert
Picture icon
on the Picture toolbar).
3) On the Insert Picture dialog, navigate to the file to be inserted, select it, and
click Open.
Note
The picture is inserted into Calc floating above the cells and anchored to
the cell in which the cursor was placed. See Positioning graphics on
page 133 for more about positioning and anchoring graphics.
Note
Your Insert Picture dialog may look quite different from the one shown
here, depending on your operating system and your choice in Tools >
Options > OpenOffice.org > General of whether to use the OOo Open
and Save dialogs.
119
Advantage Linking can reduce the size of the document when it is saved,
because the image file itself is not included. The file size is usually not a
problem on a modern computer with a reasonable amount of memory, unless
the document includes many large graphics files. Calc can handle quite large
files.
Advantage You can modify the image file separately without changing the
document because the link to the file remains valid, and the modified image
will appear when you next open the document. This can be a big advantage if
you (or someone else, perhaps a graphic artist) is updating images.
different computer, you must also send the image files, or the receiver will not
be able to see the linked images. You need to keep track of the location of the
images and make sure the recipient knows where to put them on another
machine, so the Calc document can find them. For example, you might keep
images in a subfolder named Images (under the folder containing the Writer
document); the recipient of the Calc file needs to put the images in a subfolder
with the same name (under the folder containing the Writer document).
Note
When inserting the same image several times in the document, it might
appear beneficial to create links. However, this is not necessary, as
OOo embeds only one copy of the image file in the document. (Deleting
one or more of the copies does not affect the others.)
120
Note
Caution
If the application from which the graphic was copied is closed before the
graphic is pasted into Calc, the image stored on the clipboard could be
lost from the clipboard.
121
The Gallery is available in all components of OOo. It does not come with many
graphics, but you can add your own pictures or find extensions containing more
graphics. The Gallery is explained in more detail in Chapter 11 (Graphics, the Gallery,
and Fontwork) in the Getting Started guide. For more about extensions, see Chapter
14 (Setting Up and Customizing Calc) in this book.
This section explains the basics of inserting a Gallery image into a Calc document.
1) To open the Gallery (Figure 112), click on the Gallery icon
(located in the
right side of the Standard toolbar) or choose Tools > Gallery from the menu
bar.
2) Navigate through the Gallery to find the desired picture.
3) To insert the picture, either right-click on the picture and choose Insert >
Copy or click and drag the picture from the Gallery into the Calc document.
By default, the Gallery is docked above the Calc workspace. To expand the Gallery,
position the pointer over the line that divides it from the top of the workspace. When
the pointer changes to parallel lines with arrows, click and drag downward. The
workspace resizes in response.
122
To close the Gallery, choose Tools > Gallery to uncheck the Gallery entry, or click on
the Gallery icon again.
Modifying images
When you insert a new image, you may need to modify it to suit the document. This
section describes the use of the Picture toolbar, resizing, cropping, and a workaround
for rotating a picture. Changes made in Calc do not affect the original picture,
whether it is embedded or linked.
Calc provides many tools for working with images. These tools are sufficient for most
peoples everyday requirements. However, for professional results it is generally
better to use an image manipulation program such as GIMP to modify images (for
example, to crop, resize, rotate, and change color values) and then insert the result
into Calc. GIMP is an open-source graphics program that can be downloaded from
http://www.gimp.org/downloads/.
123
124
Name
Behavior
From File
Filter
Graphics Mode
Provides several color modes in the dropdown list. See page 125.
Color
Transparency
Line
Area
Shadow
Crop
Anchor
Bring to Front
Send to Back
To Foreground /
Background
Alignment
Behavior
Default
Grayscale
Black / White
Watermark
Name
Behavior
Invert
Smooth
Sharpen
Remove
Noise
Solarization
Aging
Posterize
Pop Art
Charcoal
Sketch
Relief
125
Icon
Name
Behavior
Mosaic
Caution
Adjusting colors
Use the Color toolbar to adjust an images red, green, and blue
channels independently, as well as its brightness, contrast and
gamma.
Setting transparency
Modify the percentage value in the Transparency box
on
the Picture toolbar to make the image more transparent. This is
particularly useful when creating a watermark or when wrapping an
image in the background.
Cropping pictures
When you are only interested in a section of the image for the purpose of your
document, you may wish to crop (cut off) parts of it. The user interface in Calc for
cropping an image is not very friendly, so it may be a better choice to use a graphics
package.
Click the Crop icon
to open a dialog where you can select which portion of the
image you want to remove.
It is not possible to use the mouse to select the area to be cropped, as you can in
Draw. Instead, in the Crop dialog, specify how far from the top, bottom, left and right
borders of the image the crop should be, as illustrated in Figure 114. On the
thumbnail in the figure, notice that the cropped selection is highlighted with an inner
rectangle.
126
When Keep scale is selected, the size of the image also changes, so in this
example the width will be reduced by 3 cm.
When Keep image size is selected, the remaining part of the image is
enlarged (when you enter positive values for cropping) or shrunk (when you
enter negative values for cropping) so that the width and height of the image is
not changed.
Width and Height
The Width and Height fields under either Scale or Image size change as you enter
values in the Left, Right, Top, and Bottom fields. Use the thumbnail next to these
fields to determine the correct amount by which to crop.
The cropped shape is always a rectangle; more complex cropped shapes are not
possible in Calc. Instead, use a dedicated photo or image editing software for the job,
then import the image into Calc.
Note
If you crop an image in Calc, the picture itself is not changed. If you
export the document to HTML, the original image is exported, not the
cropped image.
127
Resizing an image
To resize an image.
1) Click the picture, if necessary, to show the green resizing handles.
2) Position the pointer over one of the green resizing handles. The pointer
changes shape giving a graphical representation of the direction of the
resizing.
3) Click and drag to resize the picture.
4) Release the mouse button when satisfied with the new size.
The corner handles resize both the width and the height of the graphic object
simultaneously, while the other four handles only resize one dimension at a time.
Tip
Rotating a picture
Calc does not provide a tool for rotating a picture, but you can use this workaround:
1) Open a new Draw or Impress document.
2) Insert the image you want to rotate.
3) Select the image, then in the Drawing toolbar (shown by default at the bottom
of the window in Impress and Draw), select the Rotate icon
.
4) Rotate the image as desired. Use the red handles at the corners of the picture
and move the mouse in the direction you wish to rotate. By default the picture
rotates around its center (indicated by a black crosshair), but you can change
the pivot point by moving the black crosshair to the desired rotation center.
Tip
5) Select the rotated picture by pressing Ctrl+A, then copy the image to the
clipboard with Ctrl+C.
6) Finish by going back to the Calc document, place the cursor where the image
is to be inserted, and press Ctrl+V.
128
Text
Opens a dialog where you can set the options for text that goes over a picture. To
write text over a graphic, click on the graphic to select it, and then press Enter. There
should be a cursor inside the graphic. Any text entered is part of the graphic, so if the
graphic is moved the text will move with it.
Original Size
Resets the dimensions of the image to the values when it was originally inserted into
the document.
Description
You can add metadata in the form of a title and description to the image. This
information is used by accessibility tools (such as screen reader software) and as ALT
(alternative) attributes if you export the document to HTML.
Name
You can add a custom name to be assigned to the image, to make it easier to find in
the Navigator.
129
Tip
Flip
Flips the image either horizontally or vertically.
Assign Macro
Adds programmable functionality to the image. Calc provides rich macro
functionality. Macros are introduced in Chapter 12 (Calc Macros).
Group
To group images:
1) Select one image, then hold down the Shift key and click in turn on each of the
others that you want to include in the group. The invisible bounding box
(with the 8 green handles) expands to include all the selected images.
2) With the images selected, choose Format > Group > Group from the menu
bar.
Or hover the mouse pointer over one of the images. When the pointer changes
shape from an arrow to a hand, right-click and choose Group > Group from
the pop-up menu.
Note
After images are grouped, the context menu provides other choices (Ungroup and
Edit Group) and the Format > Group menu includes Ungroup and Enter Group.
For more information about grouping, see the Draw Guide.
130
Name
Behavior
Select
Selects objects.
Line
Draws a line.
Rectangle
Ellipse
Freeform Line
Text
Callouts
Basic Shapes
Symbol Shapes
Block Arrows
Flowcharts
Callouts
Stars
Points
Fontwork Gallery
From File
Extrusion On/Off
To display other icons, click the down-arrow at the right-hand end of the toolbar,
select Visible Buttons, and then choose the tools you want to appear on the toolbar.
131
Icon
Name
Behavior
Polygon
Curve
Arc
Draws an arc.
Ellipse Pie
Circle Segment
Text Animation
If support for Asian languages has been enabled (in Tools > Options > Language
Settings > Languages), two more tools can be added to the Drawing toolbar:
Vertical Text and Vertical Callouts.
To use a drawing tool:
1) Click in the document where you want the drawing to be anchored. You can
change the anchor later, if necessary.
2) Select the tool from the Drawing toolbar (Figure 116). The mouse pointer
changes to a cross-hair pointer.
3) Move the cross-hair pointer to the place in the document where you want the
graphic to appear and then click-and-drag to create the drawing object.
Release the mouse button. (Some tools have other requirements; see the Help
or the Draw Guide for details.)
The selected drawing function remains active, so you can draw another object
of the same type.
4) To cancel the selected drawing function, press the Esc key or click on the
Select icon (the arrow) on the Drawing toolbar.
5) You can now change the properties (fill color, line type and weight, anchoring,
and others) of the drawing object using either the Drawing Object Properties
toolbar (Figure 117) or the choices and dialog boxes reached by right-clicking
on the drawing object.
132
These default properties are applied only to the current document and session. They
are is not retained when you close the document, and they do not apply to any other
document. The defaults apply to all the drawing objects except text objects.
To change the properties for an existing drawing object, select the object and
continue as described above.
Other tools and methods for modifying and positioning graphics are described in
Positioning graphics below.
1 Line
5 Line Color
9 Change Anchor
13 Alignment
2 Arrow Style
6 Area
10 Bring to Front
3 Line Style
11 Send to Back
4 Line Width
8 Rotate
12 To Foreground / To Background
Note
Positioning graphics
Graphics can be positioned in OOo Calc to work together and build more complex
features.
133
Arranging graphics
Graphics in a Calc document are maintained in a similar manner to a deck of cards.
As you add more images to the document, each image occupies a new layer at the top
of the stack. To arrange graphics, you tell Calc to change the order of layers in the
stack.
134
Anchoring graphics
Anchors tell a graphic where to stay in relation to other items.
Anchor to page
Anchoring a graphic to the page allows it to be positioned in a specific place on
the page. The graphic does not move when cells are added or deleted. This is
equivalent to an absolute reference. The graphic will always stay by cell B10 if
that is where it is placed.
Anchor to cell
Anchoring a graphic to a cell ensures that the graphic always stays with the
content it is originally anchored to. If a graphic is anchored to cell B10, and a new
row is inserted, the graphic will then be anchored to cell B11. This is equivalent to
a relative reference.
For example, in Figure 119 the normal Otto and Tux picture is anchored To Cell B10
(XXX shows where the picture is anchored). The inverse Otto and Tux picture is
anchored to the page.
135
Aligning graphics
You can align several graphics relative to each other. To do this:
1) Select all of the graphics to be aligned (Shift+click on each in turn). The
graphics will be surrounded by an invisible bounding box with 8 green
handles.
2) On the Picture toolbar, click on the Alignment icon and select one of the six
options.
Or, position the mouse pointer over any of the graphics. When the pointer
changes shape from an arrow to a hand, right-click and choose Alignment,
then select from the six options.
The six options include three for aligning the graphics horizontally (left, center, right)
and three for aligning the graphics vertically (top, center, bottom).
136
3) Use the tools and fields in the dialog (described below) to define the hotspots
and links necessary.
4) Click the Apply icon
Edit, Move, Insert, Delete Points: advanced editing tools to manipulate the
shape of a polygon hotspot. Select the Edit Points tool to activate the other
tools.
Active icon: toggles the status of a selected hotspot between active and
inactive.
Properties: sets the hyperlink properties and adds the Name attribute to the
hyperlink.
Below the toolbar, specify for the selected hotspot:
Address: the address pointed by the hyperlink. You can also point to an anchor
in a document; to do this, write the address in this format:
file:///<path>/document_name#anchor_name
Text: type the text that you want to be displayed when the mouse pointer is
moved over the hotspot.
Frame: where the target of the hyperlink will open: pick among _blank (opens
in a new browser window), _self (opens in the active browser window), _top or
_parent.
Tip
The value _self for the target frame will work just fine in the vast majority
of occasions. It is therefore not recommended to use the other choices
unless absolutely necessary.
137
Chapter
Printing, Exporting, and
E-mailing
Quick printing
Click the Print File Directly icon
printer defined for your computer.
Note
You can change the action of the Print File Directly icon to send the
document to the printer defined for the document instead of the default
printer for the computer. Choose Tools > Options > Load/Save >
General and select the Load printer settings with the document
option.
Controlling printing
For more control over printing, use the Print dialog (File > Print or Ctrl+P).
Note
To specify default printing settings for OOo, go to Tools > Options >
OpenOffice.org Print and Tools > Options > OpenOffice.org Calc
Print. See Chapter 14 (Setting Up and Customizing Calc) for details.
139
140
When printing more than 2 pages per sheet, you can choose the order in which
they are printing across and down the paper. The pictures above and below
show the difference.
3) In the Page sides section, select whether to print all pages or only some pages.
4) Click the Print button.
141
Caution
After printing, be sure to deselect the extra sheets. If you keep them
selected, the next time you enter data on one sheet, you enter data on
all the selected sheets. This might not be what you want.
Tip
You can check the print range by using File > Page Preview. OOo will
only display the cells in the print range.
Note
142
The additional print range will print as a separate page, even if both
ranges are on the same sheet.
143
Note
You do not need to select the entire range of the rows to be repeated;
simply select one cell in each row.
144
are equivalent) after the initial selection. Make sure that each group of cells is
separated with a semicolon.
5) Click OK.
Note
If the cell range name refers to more than one group of cells, it will not
appear in the drop-down list. You will need to type it in or highlight and
select it.
Page breaks
While defining a print range can be a powerful tool, it may sometimes be necessary to
manually adjust Calcs printout. To do this, you can use a manual break. A manual
break helps to ensure that your data prints properly. You can insert a horizontal page
break above, or a vertical page break to the left of, the active cell.
145
Row break
Selecting Row Break creates a page break above the selected cell. For example, if the
active cell is H15, then the break is created between rows 14 and 15.
Column break
Selecting Column Break creates a page break to the left of the selected cell. For
example, if the active cell is H15, then the break is created between columns G and H.
Tip
To see page break lines more easily on screen, you can change their
color. Choose Tools > Options > OpenOffice.org > Appearance and
scroll down to the Spreadsheet section.
Note
Multiple manual row and column breaks can exist on the same page.
When you want to remove them, you have to remove each one
individually. This may be confusing at times, because although there
may be a column break set on the page, when you go to Edit >
Manual Break, the Column break choice may not be available (grayed
out).
In order to remove the break, you have to be in the cell next to the
break. For example, if you set the column break while you are in H15,
you can not remove it if you are in cell D15. However, you can remove
it from any cell in column H.
146
The Sheet tab of the Page Style dialog, Format > Page > Sheet (Figure 130),
provides the following options.
Page Order
You can set the order in which pages print. This is especially useful in a large
document; for example, controlling the print order can save time if you have to
collate the document a certain way.
Where a sheet prints to more than one page of paper, it can be printed either by
column, where the first column of pages prints, and then the second column and so
on, or by row as shown in the graphic on the top right of the dialog in Figure 130.
147
Scale
Use the scale features to control the number of pages the data will print on.
smaller. For example, if a sheet would normally print out as four pages (two
high and two wide), a scaling of 50% would print as one page (both width and
height are halved).
Fit print range(s) on number of pagesdefines exactly how many pages the
printout will take up. This option will only reduce a printout, it will not enlarge
it. To enlarge a printout, the reduce/enlarge option must be used.
Fit print range(s) to width/heightdefines how high and wide the printout will
be, in pages.
148
From here you can also set the margins, the spacing, and height for the header or
footer. You can check the AutoFit height box to automatically adjust the height of
the header or footer.
Margin
Changing the size of the left or right margin adjusts how far the header or footer
is from that side of the page.
Spacing
Spacing affects how far above or below the sheet the header or footer will print.
So, if spacing is set to 1.00", then there will be 1 inch between the header or
footer and the sheet.
Height
Height affects how big the header or footer will be.
149
150
Exporting to PDF
Calc can export documents to PDF (Portable Document Format). This industrystandard file format is ideal for sending the file to someone else to view using Adobe
Reader or other PDF viewers.
Pages: To export a range of pages, use the format 3-6 (pages 3 to 6). To export
single pages, use the format 7;9;11 (pages 7, 9, and 11). You can also export a
combination of page ranges and single pages, by using a format like 36;8;10;12.
Reduce image resolution: Lower-DPI (dots per inch) images have lower
Note
151
Tagged PDF: Tagged PDF contains information about the structure of the
documents contents. This can help to display the document on devices with
different screens, and when using screen reader software. Some tags that are
exported are table of contents, hyperlinks, and controls. This option can
increase file sizes significantly.
152
Create PDF form - Submit format: Choose the format for submitting forms
from within the PDF file. This setting overrides the controls URL property that
you set in the document. There is only one common setting valid for the whole
PDF document: PDF (sends the whole document), FDF (sends the control
contents), HTML, and XML. Most often you will choose the PDF format.
153
Open in full screen mode: Causes the PDF viewer to open full-screen instead
of in a smaller window.
Display document title: Causes the PDF viewer to display the documents
title in the title bar.
User interface options section
Hide menubar: Causes the PDF viewer to hide the menu bar.
Transitions
Not available in Calc.
Bookmarks
Select how many heading levels are displayed as bookmarks, if Export bookmarks
is selected on the General page.
154
With an open password set, the PDF can only be opened with the password.
Once opened, there are no restrictions on what the user can do with the
document (for example, print, copy, or change it).
With a permissions password set, the PDF can be opened by anyone, but its
permissions can be restricted. See Figure 138.
With both the open password and permission password set, the PDF can only
be opened with the correct password, and its permissions can be restricted.
Note
Permissions settings are effective only if the users PDF viewer respects
the settings.
Figure 139 shows the dialog displayed when you click the Set open password
button on the Security page of the PDF Options dialog.
After you set a password for permissions, the other choices on the Security page
(shown in Figure 138) become available. These selections are self-explanatory.
Chapter 6 Printing, Exporting, and E-mailing
155
156
Exporting to XHTML
Calc can export spreadsheets to XHTML. Choose File > Export. On the Export
dialog, specify a file name for the exported document, then select the XHTML in the
File format list and click the Export button.
E-mailing spreadsheets
OOo provides several quick and easy ways to send spreadsheets as an e-mail
attachment in one of three formats: OpenDocument Spreadsheet (OOos default
format), Microsoft Excel, or PDF.
Note
Documents can only be sent from the OOo menu if a mail profile has
been set up.
157
must be kept secret, and a public key, which you add to your documents when you
sign them. You can get a certificate from a certification authority, which may be a
private company or a governmental institution.
When you apply a digital signature to a document, a checksum is computed from the
documents content plus your personal key. The checksum and your public key are
stored together with the document.
When someone later opens the document on any computer with a recent version of
OpenOffice.org, the program will compute the checksum again and compare it with
the stored checksum. If both are the same, the program will signal that you see the
original, unchanged document. In addition, the program can show you the public key
information from the certificate. You can compare this key with the public key that is
published on the web site of the certificate authority.
Whenever someone changes something in the document, this change breaks the
digital signature.
On Windows operating systems, the Windows features of validating a signature are
used. On Solaris and Linux systems, files that are supplied by Thunderbird, Mozilla or
Firefox are used. For a more detailed description of how to get and manage a
certificate, and signature validation, see Using Digital Signatures in the OOo Help.
To sign a document:
1) Choose File > Digital Signatures.
2) If you have not saved the document since the last change, a message box
appears. Click Yes to save the file.
3) After saving, you see the Digital Signatures dialog. Click Add to add a public
key to the document.
4) In the Select Certificate dialog, select your certificate and click OK.
5) You see again the Digital Signatures dialog, where you can add more
certificates if you want. Click OK to add the public key to the saved file.
A signed document shows an icon
to view the certificate.
158
Chapter
Using Formulas and
Functions
Introduction
In previous chapters, we have been entering one of two basic types of data into each
cell: numbers and text. However, we will not always know what the contents should
be. Often the contents of one cell depends on the contents of other cells. To handle
this situation, we use a third type of data: the formula. Formulas are equations using
numbers and variables to get a result. In a spreadsheet, the variables are cell
locations that hold the data needed for the equation to be completed.
A function is a predefined calculation entered in a cell to help you analyze or
manipulate data in a spreadsheet. All you have to do is add the arguments, and the
calculation is automatically made for you. Functions help you create the formulas
needed to get the results that you are looking for.
Setting up a spreadsheet
If you are setting up more than a simple one-worksheet system in Calc, it is worth
planning ahead a little. Avoid the following traps:
Lack of documentation
Lack of documentation is a very common failing. Many users prepare a simple
worksheet which then develops into something much more complicated over time.
Without documentation, the original purpose and methodology is often unclear and
difficult to decipher. In this case it is usually easier to start again from the beginning,
wasting the work done previously. If you insert comments in cells, and use labels and
headings, a spreadsheet can be later modified by you or others and much time and
effort will be saved.
160
Error-checking formulas
Adding up columns of data or selections of cells from a worksheet often results in
errors due to omitting cells, wrongly specifying a range, or double-counting cells. It is
useful to institute checks in your spreadsheets. For example, set up a spreadsheet to
calculate columns of figures, and use SUM to calculate the individual column totals.
You can check the result by including (in a non-printing column) a set of row totals
and adding these together. The two figuresrow total and column totalmust agree.
If they do not, you have an error somewhere.
Creating formulas
You can enter formulas in two ways, either directly into the cell itself, or at the input
line. Either way, you need to start a formula with one of the following symbols: =, +
or . Starting with anything else causes the formula to be treated as if it were text.
Operators in formulas
Each cell on the worksheet can be used as a data holder or a place for data
calculations. Entering data is accomplished simply by typing in the cell and moving to
the next cell or pressing Enter. With formulas, the equals sign indicates that the cell
will be used for a calculation. A mathematical calculation like 15 + 46 can be
accomplished as shown in Figure 141.
While the calculation on the left was accomplished in only one cell, the real power is
shown on the right where the data is placed in cells and the calculation is performed
using references back to the cells. In this case, cells B3 and B4 were the data
holders, with B5 the cell where the calculation was performed. Notice that the
Chapter 7 Using Formulas and Functions
161
formula was shown as =B3+B4. The plus sign indicates that the contents of cells B3
and B4 are to be added together and then have the result in the cell holding the
formula. All formulas build upon this concept. Other ways of entering formulas are
shown in Table 7.
These cell references allow formulas to use data from anywhere in the worksheet
being worked on or from any other worksheet in the workbook that is opened. If the
data needed was in different worksheets, they would be referenced by referring to
the name of the worksheet, for example =SUM(Sheet2.B12+Sheet3.A11).
Note
Calculation by Reference
162
Description
=A1+10
=A1*16%
=A1*A2
=ROUND(A1;1)
=EFFECTIVE(5%;12)
=B8-SUM(B10:B14)
=SUM(B8;SUM(B10:B14))
=SUM(B1:B65536)
=AVERAGE(BloodSugar)
Note
Functions can be identified in Table 7 with a word, for example ROUND, followed by
parentheses enclosing references or numbers.
It is also possible to establish ranges for inclusion by naming them using Insert >
Names, for example BloodSugar representing a range such as B3:B10. Logical
functions can also be performed as represented by the IF statement which results in
a conditional response based upon the data in the identified cell, for example
=IF(A2>=0;"Positive";"Negative")
A value of 3 in cell A2 would return the result Positive, 9 the result Negative.
Operator types
You can use the following operators in OpenOffice.org Calc: arithmetic, comparative,
descriptive, text, and reference.
163
Arithmetic operators
The addition, subtraction, multiplication and division operators return numerical
results. The Negation and Percent operators identify a characteristic of the number
found in the cell, for example -37. The example for Exponentiation illustrates how to
enter a number that is being multiplied by itself a certain number of times, for
example 23 = 2*2*2.
Table 8: Arithmetical operators
Operator
Name
Example
+ (Plus)
Addition
=1+1
(Minus)
Subtraction
=21
(Minus)
Negation
* (asterisk)
Multiplication
=2*2
/ (Slash)
Division
=10/5
% (Percent)
Percent
15%
^ (Caret)
Exponentiation
2^3
Comparative operators
Comparative operators are found in formulas that use the IF function and return
either a true or false answer; for example, =IF(B6>G12; 127; 0) which, loosely
translated, means if the contents of cell B6 are greater than the contents of cell G12,
then return the number 127, otherwise return the number 0.
A direct answer of TRUE or FALSE can be obtained by entering a formula such as
=B6>B12. If the numbers found in the referenced cells are accurately represented,
the answer TRUE is returned, otherwise FALSE is returned.
Table 9: Comparative operators
Operator
Name
Example
= (equal sign)
Equal
A1=B1
Greater than
A1>B1
Less than
A1<B1
A1>=B1
A1<=B1
<> (Inequality)
Inequality
A1<>B1
If cell A1 contains the numerical value 4 and cell B1 the numerical value 5, the above
examples would yield results of FALSE, FALSE, TRUE, FALSE, TRUE, and TRUE.
Text operators
It is common for users to place text in spreadsheets. To provide for variability in what
and how this type of data is displayed, text can be joined together in pieces coming
from different places on the spreadsheet. Figure 142 shows an example.
164
165
Reference operators
In its simplest form a reference refers to a single cell, but references can also refer to
a rectangle or cuboid range or a reference in a list of references. To build such
references you need reference operators.
166
An individual cell is identified by the column identifier (letter) located along the top
of the columns and a row identifier (number) found along the left-hand side of the
spreadsheet. On spreadsheets read from left to right, the upper left cell is A1.
Range operator
The range operator is written as colon. An expression using the range operator has
the following syntax:
(A2:B4):C9
Sheet1.A3:Sheet3.D4
When you enter B4:A2 or A4:B2 directly, then Calc will turn it to A2:B4. So the left
top cell of the range is left of the colon and the bottom right cell is right of the colon.
But if you name the cell B4 for example with _start and A2 with _end, you can use
_start:_end without any error.
Calc can not reference a whole column of unspecified length using A:A or a whole
row using 1:1 yet, as you might be familiar with in other spreadsheet programs.
167
Tip
168
Relative referencing
An example of a relative reference will illustrate the difference between a relative
reference and absolute reference using the spreadsheet from Figure 147.
1) Type the numbers 4 and 11 into cells C3 and C4 respectively of that
spreadsheet.
2) Copy the formula in cell B5 to cell C5. You can do this by using a simple copy
and paste or click and drag B5 to C5 as shown below. The formula in B5
calculates the sum of values in the two cells B3 and B4.
3) Click in cell C5. The formula bar shows =C3+C4 rather than =B3+B4 and the
value in C5 is 15, the sum of 4 and 11 which are the values in C3 and C4.
In cell B5 the references to cells B3 and B4 are relative references. This means that
Calc interprets the formula in B5, applies it to the cells in the B column, and puts the
result in the cell holding the formula. When you copied the formula to another cell,
the same procedure was used to calculate the value to put in that cell. This time the
formula in cell C5 referred to cells C3 and C4.
169
Absolute referencing
You may want to multiply a column of numbers by a fixed amount. A column of
figures might show amounts in US Dollars. To convert these amounts to Euros it is
necessary to multiply each dollar amount by the exchange rate. $US10.00 would be
multiplied by 0.75 to convert to Euros, in this case Eur7.50. The following example
shows how to input an exchange rate and use that rate to convert amounts in a
column form USD to Euros.
1) Input the exchange rate Eur:USD (0.75) in cell D1. Enter amounts (in USD)
into cells D2, D3 and D4, for example 10, 20, and 30.
2) In cell E2 type the formula =D2*D1. The result is 7.5, correctly shown.
3) Copy the formula in cell E2 to cell E3. The result is 200, clearly wrong! Calc
has copied the formula using relative addressing - the formula in E3 is =D3*D2
and not what we want which is =D3*D1.
4) In cell E2 edit the formula to be =D2*$D$1. Copy it to cells E3 and E4. The
results are now 15 and 22.5 which are correct.
Copying formula from E2 to E3 & changing the formula to read absolute reference
170
Explanation
D1
Relative, from cell E3 it is the cell one column to the left and two
rows above
$D$1
$D1
D$1
Partially absolute, from cell E3 it is the cell one column to the left
and in row 1
Hint
Knowledge of the use of relative and absolute references is essential if you want to
copy and paste formulas and to link spreadsheets.
Order of calculation
Order of calculation refers to the sequence in which numerical operations are
performed. Division and multiplication are performed before addition or subtraction.
There is a common tendency to expect calculations to be made from left to right as
the equation would be read in English. Calc evaluates the entire formula, then based
upon programming precedence breaks the formula down executing multiplication
and division operations before other operations. Therefore, when creating formulas
you should test your formula to make sure that the correct result is being obtained.
Following is an example of the order of calculation in operation.
Table 10 Order of Calculation
Left To Right Calculation
Ordered Calculation
1+3*2+3 = 11
=1+3*2+3 result 10
3*2=6, then 1 + 6 + 3 = 10
1+3*2+3 = 20
If you intend for the result to be either of the two possible solutions on the left, the
way to achieve these results would be to order the formula as:
((1+3) * 2)+3 = 11
Note
(1+3) * (2+3) = 20
171
172
Sheet containing
combined data for all
branches.
Figure 149: Combining data from several sheets into a single sheet
The spreadsheets have been set up with identical structures. The easiest way to do
this is to set up the first Branch spreadsheet, input data, format cells, and prepare
the formulas for the various sums of rows and columns.
1) On the worksheet tab, right-click and select Rename Sheet. Type Branch1.
Right-click on the tab again and select Move/Copy Sheet.
2) In the Move/Copy Sheet dialog, select the Copy option and select Sheet 2 in
the area Insert before. Click OK, right-click on the tab of the sheet Branch1_2
and rename it to Branch2. Repeat to produce the Branch3 and Combined
worksheets.
173
6) Click Yes. You have now copied the formulas into each cell while maintaining
the format you set up in the original worksheet. Of course, in this example you
would have to tidy the worksheet up by removing the zeros in the nonformatted rows.
Note
OOo default is to paste all the attributes of the original cell(s) - formats,
notes, objects, text strings and numbers.
The Function Wizard can also be used to accomplish the linking. Use of this Wizard is
described in detail in the section on Functions.
Understanding functions
Calc includes over 350 functions to help you analyze and reference data. Many of
these functions are for use with numbers, but many others are used with dates and
times, or even text. A function may be as simple as adding two numbers together, or
finding the average of a list of numbers. Alternatively, it may be as complex as
calculating the standard deviation of a sample, or a hyperbolic tangent of a number.
Typically, the name of a function is an abbreviated description of what the function
does. For instance, the FV function gives the future value of an investment, while
BIN2HEX converts a binary number to a hexadecimal number. By tradition, functions
are entered entirely in upper case letters, although Calc will read them correctly if
they are in lower or mixed case, too.
A few basic functions are somewhat similar to operators. Examples:
+
This operator adds two numbers together for a result. SUM() on the other hand
adds groups of contiguous ranges of numbers together.
This operator multiplies two numbers together for a result. PRODUCT() does the
same for multiplying that SUM() does for adding.
175
Each function has a number of arguments used in the calculations. These arguments
may or may not have their own name. Your task is to enter the arguments needed to
run the function. In some cases, the arguments have predefined choices, and you may
need to refer to the online help or Appendix B (Description of Functions) in this book
to understand them. More often, however, an argument is a value that you enter
manually, or one already entered in a cell or range of cells on the spreadsheet. In
Calc, you can enter values from other cells by typing in their name or range, or
unlike the case in some spreadsheetsby selecting cells with the mouse. If the values
in the cells change, then the result of the function is automatically updated.
For compatibility, functions and their arguments in Calc have almost identical names
to their counterparts in Microsoft Excel. However, both Excel and Calc have functions
that the other lacks. Occasionally, functions with the same names in Calc and Excel
have different arguments, or slightly different names for the same argumentneither
of which can be imported to the other. However, the majority of functions can be used
in both Calc and Excel without any change.
Note
OOo uses the semicolon as an argument list separator, unlike Excel which
uses a comma. This is a common mistake made by users accustomed to
entering Excel formulas.
Many arguments are a number. A Calc function can take up to thirty numbers as an
argument. That may not sound like much at first. However, when you realize that the
number can be not only a number or a single cell, but also an array or range of cells
that contain several or even hundreds of cells, then the apparent limitation vanishes.
Depending on the nature of the function, arguments may be entered as follows:
"text data"
"9"
A1
176
Nested functions
Functions can also be used as arguments within other functions. These are called
nested functions.
=SUM(2;PRODUCT(5;7))
To get an idea of what nested functions can do, imagine that you are designing a selfdirected learning module. During the module, students do three quizzes, and enter
the results in cells A1, A2, and A3. In A4, you can create a nested formula that begins
by averaging the results of the quizzes with the formula =AVERAGE(A1:A3). The
formula then uses the IF function to give the student feedback that depends upon the
average grade on the quizzes. The entire formula would read:
=IF(AVERAGE(A1:A3) >85; "Congratulations! You are ready to advance to
the next module"; "Failed. Please review the material again. If
necessary, contact your instructor for help")
Depending on the average, the student would receive the message for either
congratulations or failure.
Notice that the nested formula for the average does not require its own equal sign.
The one at the start of the equation is enough for both formulas.
If you are new to spreadsheets, the best way to think of functions is as a scripting
language. We've used simple examples to explain the concept more clearly, but,
through nesting of functions, a Calc formula can quickly become complex.
Note
Calc keeps the syntax of a formula displayed in a tool tip next to the
cell as a handy memory aid as you type.
177
Function Wizard
The most commonly used input method is the Function Wizard (Figure 155). To open
the Function Wizard, choose Insert > Function, or click the fx button on the
Function tool bar, or press Ctrl+F2. Once open, the Function Wizard provides the
same help features as the Function List, but adds fields in which you can see the
result of a completed function, as well as the result of any larger formula of which it
is part.
Select a category of functions to shorten the list, then scroll down through the named
functions and select the required one. When you select a function its description
appears on the right-hand side of the dialog. Double-click on the required function.
The Wizard now displays an area to the right where you can enter data manually in
text boxes or click the Shrink button
from the worksheet.
178
179
1
2
3
180
181
Error messages
The most basic tool is error messages. Error messages display in a formulas cell or
in the Function Wizard instead of the result.
An error message for a formula is usually a three-digit number from 501 to 527, or
sometimes an unhelpful piece of text such as NAME?, REF, or VALUE. The error
number appears in the cell, and a brief explanation of the error on the right side of
the status bar.
Most error messages indicate a problem with how the formula was input, although
several indicate that you have run up against a limitation of either Calc or its current
settings.
Error messages are not user-friendly, and may intimidate new users. However, they
are valuable clues to correcting mistakes. You can find detailed explanations of them
in the help, by searching for Error codes in OpenOffice.org Calc. A few of the most
common are shown in the following table.
182
NAME? (525)
REF (525)
VALUE (519)
The value for one of the arguments is not the type that the
argument requires. The value may be entered incorrectly; for
example, double-quotation marks may be missing around the value.
At other times, a cell or range used may have the wrong format,
such as text instead of numbers.
509
510
502
183
Note
To avoid the #VALUE and #REF! errors, give the cell B3 a name such as
TotalExpenses. In that way, the program will carry that name to each
succeeding formula being copied and remove the need to use the $ to
anchor the reference to the TotalExpenses cell.
The Detective
In a long or complicated spreadsheet, color coding becomes less useful. In these
cases, consider using the the submenu under Tools > Detective. The Detective is a
tool for checking which cells are used as arguments by a formula (precedents) and
which other formulas it is nested in (dependents), and tracking errors. It can also be
used for tracing errors, marking invalid data (that is, information in cells that is not
in the proper format for a functions argument), or even for removing precedents and
dependents.
184
To use the Detective, select a cell with a formula, then start the Detective. On the
spreadsheet, you will see lines ending in circles to indicate precedents, and lines
ending in arrows for dependents. The lines show the flow of information.
Use the Detective to assist in following the precedents referred to in a formula in a
cell. By tracing these precedents, you frequently can find the source of the errors.
Place the cursor in the cell in question and then choose Tools > Detective > Trace
Precedents from the menu bar or press Shift+F7. Figure 162 shows a simple
example of tracing precedents.
185
b) Source area highlighted in Blue, with arrow pointing to the calculation cell
(continued): Tracing precedents using the Detective
186
We are concerned that the number shown in Cell C3 is incorrectly stated. The cause
can be seen in the highlighted cells. In this case cell C16 contains both numeric data
as well as letters. Removing the letters resolves the problem in the calculation.
In other cases we must trace the error. Use the Trace Error function, found under
Tools > Detective > Trace Error, to find the cells that cause the error.
Examples of functions
For novices, functions are one of the most intimidating features of OpenOffice.org's
Calc. New users quickly learn that functions are an important feature of
spreadsheets, but there are almost four hundred, and many require input that
assumes specialized knowledge. Fortunately, Calc includes dozens of functions that
anyone can use.
Basic arithmetic
The simple arithmetic functions are addition, subtraction, multiplication, and division.
Except for subtraction, each of these operations has its own function:
187
Simple statistics
Another common use for spreadsheet functions is to pull useful information out of a
list, such as a series of test scores in a class, or a summary of earnings per quarter
for a company.
You can, of course, scan a list of figures if you want basic information such as the
highest or lowest entry or the average. The only trouble is, the longer the list, the
more time you waste and the more likely you are to miss what youre looking for.
Instead, it is usually quicker and more efficient to enter a function. Such reasons
explain the existence of a function like COUNT, which does no more than give the
total number of entries in the designated cell range.
Similarly, to find the highest or lowest entry, you can use MIN or MAX. For each of
these formulas, all arguments are either a range of cells, or a series of cells entered
individually.
Each also has a related function, MINA or MAXA, which performs the same function,
but treats a cell formatted for text as having a value of 0 (The same treatment of text
occurs in any variation of another function that adds an "A" to the end). Either
function gives the same result, and could be useful if you used a text notation to
indicate, for example, if any student were absent when a test was written, and you
wanted to check whether you needed to schedule a makeup exam.
For more flexibility in similar operations, you could use LARGE or SMALL, both of
which add a specialized argument of rank. If the rank is 1 used with LARGE, you get
the same result as you would with MAX. However, if the rank is 2, then the result is
the second largest result. Similarly, a rank of 2 used with SMALL gives you the
second smallest number. Both LARGE and SMALL are handy as a permanent control,
since, by changing the rank argument, you can quickly scan multiple results.
You would need to be an expert to want to find the Poisson Distribution of a sample,
or to find the skew or negative binomial of a distribution (and, if you are, you will find
functions in Calc for such things). However, for the rest of us, there are simpler
statistical functions that you can quickly learn to use.
In particular, if you need an average, you have a number to choose from. You can find
the arithmetical meansthat is, the result when you add all entries in a list then
divided by the number of entries by enter a range of numbers when using AVERAGE,
or AVERAGE A to include text entries and to give them a value of zero.
In addition, you can get other information about the data set:
MEDIAN: The entry that is exactly half way between the highest and lowest
number in a list.
RANK: The position of a given entry in the entire list, measured either from top
to bottom or bottom to top. You need to enter the cell address for the entry, the
range of entries, and the type of rank (0 for the rank from the highest, or 1 for
the rank from the bottom.
188
Some of these functions overlap; for example, MIN and MAX are both covered by
QUARTILE. In other cases, a custom sort or filter might give much the same result.
Which you use depends on your temperament and your needs. Some might prefer to
use MIN and MAX because they are easy to remember, while others might prefer
QUARTILE because it is more versatile.
Rounding methods
The most basic function for rounding numbers in Calc is ROUND. This function will
round off a number according to the usual rules of symmetric arithmetic rounding: a
decimal place of .4 or less gets rounded down, while one of .5 or more gets rounded
up. However, at times, you may not want to follow these rules. For instance, if you are
one of those contractors who bills a full hour for any fraction of an hour you work,
you would want to always round up so you didnt lose any money. Conversely, you
might choose to round down to give a slight discount to a long-established customer.
In these cases, you might prefer to use ROUNDUP or ROUNDDOWN, which, as their
names suggest, round a number to the nearest integer above or below it.
189
All three of these functions require the single argument of numberthe cell or
number to be rounded. Used with only this argument, all three functions round to the
nearest whole number, so that 46.5 would round to 47 with ROUND or ROUNDUP
and 46 with ROUNDDOWN. However, if you use the optional count argument, you
can specify the number of decimal places to include. For instance, if number was set
to 1, then 48.65 would round to 48.7 with ROUND or ROUNDUP and to 48.6 with
ROUNDDOWN.
As an alternative to ROUNDDOWN when working with decimals, you can use TRUNC
(short for truncate). It takes exactly the same arguments as ROUNDDOWN, so which
function you use is a matter of choice. If you aren't working with decimals, you might
choose to use INT (short for integer), which takes only the number argument.
Another option is the ODD and EVEN pair of functions. ODD rounds up to the nearest
odd number if what is entered in the number argument is a positive number, and
rounds down if it is a negative number, while EVEN does the same for an even
number.
Options are the CEILING and FLOOR functions. As you can guess from the names,
CEILING rounds up and FLOOR rounds down. For both functions, the number that
they round to is determined by the closest multiple of the number that you enter as
the significance argument. For instance, if your business insurance is billed by the
work week, the fact that you were only open three days one week would be irrelevant
to your costs; you would still be charged for an entire week, and therefore might
want to use CEILING in your monthly expenses.
Conversely, if you are building customized computers and completed 4.5 in a day,
your client would only be interested in the number ready to ship, so you might use
FLOOR in a report of your progress. If cell E1 contains the value 46.7,
=CEILING(E1;7) will return the value 49.
Besides number and significance, both CEILING and FLOOR include an optional
argument called mode, which takes a value of 0 or 1. If mode is set to 0, and both the
number and the significance are negative numbers, then the result of either function
is rounded up; if it is set to 1, and both the number and the significance are negative
numbers, then the results are rounded down. In other words, if the number is -11 and
the significance is -5, then the result is -10 when the mode is set to 0, but -15 when
set to 1.
However, if you are exchanging spreadsheets between Calc and MS Excel, remember
that the mode argument is not supported by Excel. If you want the answers to be
consistent between the two spreadsheets, set the mode in Calc to -1.
A function somewhat similar to CEILING and FLOOR is MROUND. Like CEILING
AND FLOOR, MROUND requires two arguments, although, somewhat confusingly,
the second one is called multiple rather than significance, even though the two are
identical. The difference between MROUND and CEILING and FLOOR is that
MROUND rounds up or down using symmetric arithmetic rounding. For example, if
the number is 77 and the multiple is 5, then MROUND gives a result of 75. However,
if the multiple is changed to 7, then MROUND's result becomes 77.
Once you become familiar with Calcs long, undifferentiated list of functions, you can
start to decide which is most useful for your purposes.
However, one last point is worth mentioning: If you are working with more than two
decimal places, don't be surprised if you dont see the same number of decimal places
on the spreadsheet as you do on the function wizard. If you dont, the reason is that
Tools > Options > OpenOffice.org Calc > Calculate > Decimal Places defaults
190
to 2. Change the number of decimal places, and, if necessary, uncheck the Precision
as shown box on the same page, and the spreadsheet will display as expected.
191
Advanced functions
As is common with other spreadsheet programs, OOo Calc can be enhanced by userdefined functions or add-ins. Setting up user-defined functions can be done either by
using the Basic IDE or by writing separate add-ins or extensions.
The basics of writing and running macros is covered in Chapter 12 (Calc Macros).
Macros can be linked to menus or toolbars for ease of operation or stored in template
modules to make the functions available in other documents.
Calc Add-ins are specialized office extensions which can extend the functionality of
OpenOffice.org with new built-in Calc functions. Writing Add-ins requires knowledge
of the C++ language, the OOo SDK, and is for experienced programmers. More
information is available on the OOo wiki page at
http://wiki.services.openoffice.org/wiki/Calc/Add-In/Simple_Calc_Add-In. A number of
extensions for Calc have been written and these can be found on the extensions site
at http://extensions.services.openoffice.org/. Refer to Chapter 14 (Setting up and
Customizing Calc) for more details.
192
Chapter
Using the DataPilot
This chapter is adapted from a German original written by Stefan Weigel and
translated into English by Sigrid Kronenberger. It is licensed under the
Creative Commons Attribution-Share Alike License, version 3.0.
Introduction
Many requests for software support are the result of using complicated formulas and
solutions to solve simple day to day problems. More efficient and effective solutions
use the DataPilot, a tool for combining, comparing, and analyzing large amounts of
data easily. Using the DataPilot, you can view different summaries of the source data,
display the details of areas of interest, and create reports, whether you are a
beginner, an intermediate or advanced user.
This chapter is divided into two sections:
194
extra columns; that is, you have to change the structure of the calculation
sheet. This is not only somewhat inefficient from a workflow point of view, but
it also raises some practical questions: How do references react if you add
more columns or rows to the sum formulas?
you want to add more months. A vertical layout might be a more efficient use
of space. How can the table be transposed? Do you have to enter everything
again?
subdivision for the different sales regions or a constraint of the sales for a
given employee? In these cases you again have to manually add all the sums
and create different tables in many variations.
Solution
The most important part of your task in the example is the addition of the Total sales
per month cells, which had to be done manually. To do this automatically with the
program, just get the data into Calc. You can enter the single numbers by hand or you
can import a file from your bookkeeping software. In any case we assume a
continuous table that keeps track of all sales in a somewhat primitive form.
195
You can create the sales volume overview by following these instructions:
1) Select the cell A1 (or any other single cell within the list).
2) Select Data > DataPilot > Start. On the Select Source dialog, choose
Current selection and click OK.
3) The DataPilot dialog (Figure 167) has four white layout areas and several
fields that look like buttons. These small fields are the titles of the different
columns of your list.
Move (drag and drop with the mouse) the date field into the Column
Fields area.
4) Click More, to see more options in the lower part of the dialog.
5) In the Results to drop-down list, select new sheet .
6) Click OK.
196
197
Advantages
1) No manual entering or adding of any values is necessary. There is less work
and fewer errors.
2) The layout is very flexible: months horizontal and categories vertical or vice
versa, in two mouse clicks.
3) Additional differentiating factors are immediately available.
4) Many types of evaluation are possible; for example, number or average instead
of sum, accumulated values, comparisons, and so on.
We will now demonstrate some of these advantages.
Starting with the result of Figure 170, use the mouse to drag the Date field under the
Category field, as shown in Figure 171.
198
To transpose the table completely, just drag the Category field above the area of the
displayed values, to cell C3 (see Figure 173). The result of this action is shown in
Figure 174.
199
You do not need the Region field in this case. Drag it out of the layout
area.
200
Example 2: Timekeeping
This example is often used by consultants and in several variations in user support.
The task is to provide a means for one or more users to keep track of working hours.
Note
A typical way of doing this is to create a spreadsheet per month and a sum sheet with
all the results of one year. For each employee, there is one file (see Figures 177 and
178 for examples of two pages from the file for one employee).
sheets that have to be copied from a raw template and adjusted for each
month, and a sheet with all the yearly sums with references to all the other
sheets. Users often search for a macro to make the creation easier.
The file shown contains only the data of one employee. How can you get all the
data for all the employees, so that you can have a summary of all the work
hours from all employees of a department or the whole company?
201
202
Solution
To use the DataPilot for this task, collect all the data into one single table. This can be
done either manually or by importing a file from an (electronic) timekeeping
machine.
In very simple cases, each employee takes care of their own working hours. If you
need calculations that cover several employees, departments, or the whole company,
just copy everything into one huge table (Figure 179).
Drag hours into the Data Fields area. Notice that it becomes Sum
hours.
4) Click More to show more options in the lower part of the dialog.
5) Choose new sheet for Results to.
6) Click OK.
203
2) Choose Data > Group and Outline > Group . On the Grouping dialog, leave
Start and End as Automatically; in the Group by section, choose Intervals
and Months. Click OK. The result is now grouped into months.
205
Select the cell A3 (or any other cell that contains a result of the DataPilot).
Choose Data > DataPilot > Start.
Double-click on Sum hours to open the Data Field dialog.
Click More, to see more options.
Select the cell A3 (or any other cell that contains a result of the DataPilot).
Choose Data > DataPilot > Start.
Double-click on Sum hours to open the Data Field dialog.
Click More, to see more options.
206
207
208
1:
2:
3:
4:
Hide
Date (DMY)
Standard
Hide
209
210
4) Click More to show more options in the lower part of the dialog.
5) Choose new sheet for Results to.
6) In this case we need to count the number of values, not their sum. Double-click
on Sum Date to open the Data Field dialog and select the function Count
(see Figure 192).
7) Click OK. As an intermediate result, you get a DataPilot table that has for
every time within the raw data a separate line.
211
Note
8) For grouping the rows, select the cell A4 or any other cell that contains a time.
9) Choose Data > Group and Outline > Group, select for the interval Hours
and click OK. The result is now grouped according to hours as shown in
Figure 195.
212
213
Rule
If you select more than one single cell before you start sorting, filtering or calling the
DataPilot, then the automatic list recognition is switched off. Calc assumes that the
list matches exactly the cells you have selected.
Rule
For sorting, filtering, or using the DataPilot, always select only one cell.
Rule
Calc lists must have the normal form; that is, they must have a simple
linear structure.
When entering the data, do not add outlines, groups, or summaries. This becomes
clear when we think about what we could have done wrong in our Sales list example
in the section Examples with step by step descriptions starting at page 194. Here
are some mistakes commonly made by inexperienced spreadsheet users:
1) You made several sheets, for example, a sheet for each group of articles.
Analyses are then possible only within each group. Analyses for several groups
would be a lot of work.
214
2) In the Sales list, instead of only one column for the amount, you made a
column for the amounts for each employee. The amounts then had to be
entered into the appropriate column. An analysis with the DataPilot would not
be possible any more. In contrast, one result of the DataPilot is that you can
get results for each employee if you have entered everything in one column.
3) You entered the amounts in chronological order. At the end of each month you
made a sum total. In this case, sorting the list for different criteria is not
possible because the DataPilot will treat the sum totals the same as any other
figure. Getting monthly results is one of the very fast and easy features of the
DataPilot.
Start
Start the DataPilot with Data > DataPilot > Start. If the list to be analyzed is in a
spreadsheet table, select only one cell within this list. Calc recognizes and selects the
list automatically for use with the DataPilot.
Data source
There are three possibile data sources for the DataPilot: a Calc spreadsheet, an
external data source that has to be registered in OpenOffice.org, or access to an
OLAP system (not available at this time).
215
Calc spreadsheet
The simplest and most often used case is analyzing a list in a Calc spreadsheet. The
list might be updated regularly or the data might be imported from a different
application.
For example, a huge list can be copied from a different application and pasted into
Calc. The behavior of Calc while inserting the data depends on the format of the data.
If the data is in a common spreadsheet format, it is copied directly into Calc.
However, if the data is in plain text, the Text Import dialog appears; see Figure 188 in
this chapter and Chapter 1 (Introducing Calc) for more more information.
Calc can import data from a huge number of foreign data formats, for example from
other spreadsheets (Excel, Lotus 1, 2, 3), from databases (like dBase), and from
simple text files including CSV formats.
The drawback of copying or importing foreign data is that it will not update
automatically if there are changes in the source file. With a Calc file you were
previously limited to 65,535 rows but this has been expanded to one million rows.
Basic layout
In the DataPilot (Figure 198) are four white areas that show the layout of the result.
Beside these white areas are buttons with the names of the fields in your data source.
To choose a layout, drag and drop the field buttons into the white areas.
The Data Fields area in the middle must contain at least one field. Advanced users
can use more than one field here. For the data field an aggregate function is used.
For example, if you move the sales field into the Data Fields area, it appears there as
Sum sales.
216
More options
To expand the DataPilot and show more options, click More.
217
Selection from
Shows the range of cells used in the DataPilot.
Results to
Results to defines where your result will be shown. If you do not enter anything,
the DataPilot will put your result below the list that contains your data. This could
result in overwriting any data that is already in that location. To avoid overwriting
data, you can leave Results to as undefined and enter a cell reference to tell
the DataPilot where to show the results.1 However, a generally better approach is
to use - new sheet to add a new sheet to the spreadsheet file and place the
results there.
Ignore empty rows
If the source data is not in the recommended form, this option tells the DataPilot
to ignore empty rows.
Identify categories
If the source data has missing entries in a list and does not meet the
recommended data structure (see Figure 200), the DataPilot adds it to the listed
category above it. If this option is not chosen, then the DataPilot inserts (empty)
(see Figure 202).
In this case the word - undefined is misleading because the output position is in fact
defined.
218
Data fields
In the Options dialog of a data field you can select the Sum function for accumulating
the values from your data source. In many cases you will need the sum function, but
other functions (like standard distribution or a counting function) are also available.
For example, the counting function can be useful for non-numerical data fields.
On the Data Field dialog, click More to see more options.
219
Base field
Base element
Analysis
Normal
Difference
from
Selection of a field
from the data
source of the
DataPilot (for
example, employee)
Selection of an
element from the
selected base field
(for example,
Brigitte)
Result as difference to
the result of the base
element (for example,
Sales volume of the
employees as
difference of the sales
volume of Brigitte)
% of
Selection of a field
from the data
source of the
DataPilot (for
example, employee)
Selection of an
element from the
selected base field
(for example,
Brigitte)
220
Type
Base field
Base element
Analysis
% difference
from
Selection of a field
from the data
source of the
DataPilot (for
example, employee)
Selection of an
element from the
selected base field
(for example.
Brigitte)
Result as relative
difference to the result
of the base element
(for example, Sales
volume of the
employees as relative
difference of the sales
volume of Brigitte)
Running
total in
Selection of a field
from the data
source of the
DataPilot (for
example, date)
Result as a continuing
sum (for example,
Continuing sum of the
sales volume for days
or months)
% of row
% of column
% of total
Index
221
Figure 205: Division of the regions for employees (two row fields) without partial sums
Figure 206: Division of the regions for employees with partial sums (by region)
222
Choose the option Automatically to use the aggregate function for the partial
results that can also be used for the data fields (see above). To set up the aggregate
function for the partial results independently from the overall settings of the
DataPilot, choose User-defined.
223
Page fields
The Options dialog for page fields is the same as for row and column fields, even
though it appears to be useless to have the same settings as described for the row
and column fields. With the flexibility of the DataPilot you can switch the different
fields between pages, columns or rows. The fields keep the settings that you made for
them. The page field has the same properties as a row or column field. These settings
only take effect when you use the field not as page field but as row or column field.
224
Note
Before you can group, you have to produce a DataPilot with ungrouped
data. The time needed for creating a DataPilot depends mostly on the
number of columns and rows and not on the size of the basic data.
Through grouping you can produce the DataPilot with a small number of
rows and columns. The DataPilot can contain a lot of categories,
depending on your data source.
Choose Data > Group and Outline > Group from the menu bar or press F12; you
get the following dialog.
225
Tip
For grouping the output of the DataPilot in calendar weeks, choose the
beginning date on a Sunday or Monday and enter the grouping interval
(Number of Days) as 7.
226
For grouping of non scalar categories, select in the result of the DataPilot all the
individual field values that you want to put in the one group.
Tip
You can select several non-contiguous cells in one step by pressing and
holding the Control key while left-clicking with the mouse.
Given the input data shown in Figure 214, execute the Data Pilot with Department in
the Row Field and Sum (Sick Days) in the Data Field. The output should look like that
in Figure 215. Select with the mouse the Departments Accounting, Purchasing and
Sales.
Choose the Data > Group and Outline > Group from the Menu bar or press F12.
The output should now look like that in Figure 216. Repeat this for all groups that
you want to create from the different categories (Select Assembly, Production and
Warehouse and Group again. The output should look like Figure 217.
You can change the automatically given names for the groups and the newly created
group field by editing the name in the input field (for example changing 'Group2' to
'Technical'). The DataPilot will remember these settings, even if you change the
layout later on. For the following pictures, the dialog was called again (with a rightclick, Start) and by selecting the icon Department 2, then Options, and finally from
the preferences menu Automatic was selected. This generated the partial sum
results shown in Figure 218. Double-clicking Group 1 and Technical collapses the
entries, as shown in Figure 219.
227
Note
229
Figure 222: Before the drill down for the category golfing
Since there are more possibilities for subdivision, a dialog appears so you can
choose your setting.
230
To hide the details again, double-click on the cell golfing or choose Data >
Group and Outline > Hide Details.
The DataPilot remembers your selection (in our example the field employee),
so that for the next drill down for a category in the field region the dialog does
not appear. To remove the selection employee, open the DataPilot dialog by
right-clicking and choosing Start, then delete the unwanted selection in the
row or column field.
2) The active cell is a value of the data field.
In this case drill down means a listing of all data entries of the data source that
aggregates to this value.
Double-click on the cell with the value $18,741 from Figure 222. You now have
a new list of all data sets that are included in this value. This list is shown in a
new sheet.
Figure 225: New table sheet after the drilldown for a value
in a data field
Filtering
To limit the DataPilot analysis to a subset of the information that is contained in the
data basis, you can filter with the DataPilot.
Note
To do this, click Filter on the top left side above the results.
Figure 226: Filter field in the upper left area of the DataPilot
In the Filter dialog, you can define up to 3 filter options that are used in the same
way as Calcs default filter.
Chapter 8 Using the DataPilot
231
Note
Even if they are not called a filter, page fields are a practical way to filter
the results. The advantage is that the filtering criteria used are clearly
visible.
Cell formatting
The cells in the results area of the DataPilot are automatically formatted in a simple
format by Calc. You can change this formatting using all the tools in Calc, but note
that if you make any change in the design of the DataPilot or any updates, the
formatting will return to the format applied automatically by Calc.
For the number format in the data field, Calc uses the number format that is used in
the corresponding cell in the source list. In most cases, this is useful (for example, if
the values are in the currency format, then the corresponding cell in the result area
is also formatted as currency). However, if the result is a fraction or a percentage,
the DataPilot does not recognize that this might be a problem; such results must
either be without a unit or be displayed as a percentage. Although you can correct
the number format manually, the correction stays in effect only until the next update.
232
You could, for example, list all the sales values per day and additionally give the
number of entries per day. To do this, put both the sales field and the date field into
the Data Fields area. For the date field, choose the Count option for the aggregate
function (see Figure 228).
Since every entry has a specific date, this field will give you the number of entries for
each date. If you group the values per month, you get an overview with the sales
value and the number of closed sales for each category and month (see Figure 229).
233
When using multiple data fields, the DataPilot result area contains a field called Data
to allow for manipulating the existing data fields. You can move this field just like any
other row or column field by using drag and drop. This is an easy way to achieve
different structures for the results (see Figures 230 and 231; drag and drop the Data
field onto the date field label, or onto the category field label).
Figure 230: Layout option for presenting the sums and numbers
of the sales values
Figure 231: Another layout option for presenting the sums and numbers of the sales
values
If you want to put the different data fields in different columns and your DataPilot
does not contain another column field or you sort the different data fields in different
rows and dont have another row field, then it is useful to disable the view of the row
or column sums. Just drag the category field label up to the Filter area.
234
235
Figure 235: Multiple identical fields for sales value, that have been created as
duplicates within your source.
Shortcuts
If you use the DataPilot very often, you might find the frequent use of the menu paths
(Data > DataPilot > Start and Data > Group and Outline > Group) inconvenient.
For grouping, a shortcut is already defined: F12. For starting the DataPilot, you can
define your own keyboard shortcut. If you prefer to have toolbar icons instead of
keyboard shortcuts, you can create a user-defined symbol and add it to either your
own custom made toolbar or the Standard toolbar.
For an explanation how to create keyboard shortcuts or add icons to toolbars, see
Chapter 14 (Setting Up and Customizing Calc).
Function GETPIVOTDATA
The function GETPIVOTDATA can be used with formulas in Calc if you want to reuse
the results from the DataPilot elsewhere in your spreadsheet.
Difficulty
Normally you create a reference to a value by entering the address of the cell that
contains the value. For example, the formula =C6*2 creates a reference to cell C6 and
returns the doubled value.
If this cell is located in the results area of the DataPilot, it contains the result that
was calculated by referencing specific categories of the row and column fields. In
Figure 236, the cell C6 contains the sum of the sales values of the employee Hans in
the category Sailing. The formula in the cell C12 uses this value.
236
Figure 237: The value that you really want to use can be found now
in a different location.
The function GETPIVOTDATA allows you to have a reference to a value inside the
DataPilot by using the specific identifying categories for this value.
Syntax
The syntax has two variations:
GETPIVOTDATA(target field, DataPilot; [ Field name / Element; ... ])
GETPIVOTDATA(DataPilot; specification)
237
=GETPIVOTDATA("sales
value";A1;"employee";"Hans";"category";"sailing")
239
Chapter
Data Analysis
Using Scenarios, Goal Seek, Solver, others
Introduction
Once you are familiar with functions and formulas, the next step is to learn how to
use Calc's automated processes to quickly perform useful analysis of your data.
Calc includes several tools to help you manipulate the information in your
spreadsheets, ranging from features for copying and reusing data, to creating
subtotals automatically, to varying information to help you find the answers you need.
These tools are divided between the Tools and Data menus.
If you are a newcomer to spreadsheets, these tools can be overwhelming at first.
However, they become simpler if you remember that they all depend on input from
either a cell or a range of cells that contain the data with which you are working.
You can always enter the cells or range manually, but in many cases it is easier to
select the cells with the mouse. Click the Shrink/Maximize icon beside a field to
temporarily reduce the size of the tools window, so you can see the spreadsheet
underneath and select the cells required.
Sometimes, you may have to experiment to find out which data goes into which field,
but then you can set a selection of options, many of which can be ignored in any
given case. Just keep the basic purpose of each tool in mind, and you should have
little trouble with Calcs function tools.
You dont need to learn them, especially if your spreadsheet use is simple, but as your
manipulation of data becomes more sophisticated, they can save time in making
calculations, especially as you start to deal with hypothetical situations. Just as
importantly, they can allow you to preserve your work and to share it with other
peopleor yourself at a later session.
One function tool not mentioned here are DataPilots (also known as pivot tables), but
they are a topic that is sufficiently complex that it requires a separate chapter. (See
Chapter 8.)
Consolidating data
Data > Consolidate provides a way to combine data from two or more ranges of
cells into a new range while running one of several functions (such as Sum or
Average) on the data. During consolidation, the contents of cells from several sheets
can be combined into one place.
1) Open the document containing the cell ranges to be consolidated.
2) Choose Data > Consolidate to open the Consolidate dialog. Figure 240 shows
this dialog after making the changes described below.
3) The Source data range list contains any existing named ranges (created
using Data > Define Range) so you can quickly select one to consolidate with
other areas.
4) If the source range is not named, click in the field to the right of the drop-down
list and either type a reference for the first source data range or use the mouse
to select the range on the sheet. (You may need to move the Consolidate dialog
or click on the Shrink icon to reach the required cells.)
5) Click Add. The selected range is added to the Consolidation ranges list.
6) Select additional ranges and click Add after each selection.
241
Caution
242
Select Link to source data to insert formulas that generate the results
into the target range, rather than the actual results (the default action). If
you link the data, any values subsequently modified in the source range
are automatically updated in the target range.
The corresponding cell references in the target range are inserted in
consecutive rows, which are automatically ordered and then hidden
from view. Only the final result, based on the selected function, is
displayed.
Under Consolidate by, select either Row labels or Column labels if the
cells of the source data range are not to be consolidated corresponding to
the identical position of the cell in the range, but instead according to a
matching row label or column label. To consolidate by row labels or
column labels, the label must be contained in the selected source ranges.
The text in the labels must be identical, so that rows or columns can be
accurately matched. If the row or column label of one source data range
does not match any that exist in other source data ranges, it is added to
the target range as a new row or column.
Creating subtotals
SUBTOTAL is a function listed under the Mathematical category when you use the
Function Wizard (Insert > Function). Because of its usefulness, the function has a
graphical interface accessible from Data > Subtotals.
As the name suggests, SUBTOTAL totals data arranged in an arraythat is, a group
of cells with labels for columns. Using the Subtotals dialog, you can select up to three
arrays, then choose a statistical function to apply to them. When you click OK, Calc
adds subtotal and grand total rows to the selected arrays, using the Result and
Result2 cell styles to differentiate those entries. By default, matching items
throughout your array will be gathered together as a single group above a subtotal.
To insert subtotal values into a sheet:
1) Ensure that the columns have labels.
2) Select the range of cells that you want to calculate subtotals for, and then
choose Data > Subtotals.
3) In the Subtotals dialog (Figure 241), in the Group by list, select the column by
which the subtotals need to be grouped. A subtotal will be calculated for each
distinct value in this column.
4) In the Calculate subtotals for box, select the columns containing the values
that you want to create subtotals for. If the contents of the selected columns
change later, the subtotals are automatically recalculated.
5) In the Use function box, select the function that you want to use to calculate
the subtotals.
6) Click OK.
If you use more than one group, then you can also arrange the subtotals according to
choices made on the dialogs Options page (Figure 242), including ascending and
descending order or using one of the predefined custom sorts defined in Tools >
Options > OpenOffice.org Calc > Sort Lists.
243
244
Creating scenarios
Tools > Scenarios opens a dialog with options for creating a scenario.
To create a new scenario:
1) Select the cells that contain the values that will change between scenarios. To
select multiple ranges, hold down the Ctrl key as you click. You must select at
least two cells.
2) Choose Tools > Scenarios.
3) On the Create Scenario dialog (Figure 243), enter a name for the new
scenario. Its best to use a name that clearly identifies the scenario, not the
default name as shown in the illustration. This name is displayed in the
Navigator and in the title bar of the border around the scenario on the sheet
itself.
245
4) Optionally add some information to the Comment box. The example shows the
default comment. This information is displayed in the Navigator when you click
the Scenarios icon and select the desired scenario.
5) Optionally select or deselect the options in the Settings section. See page 246
for more information about these options.
6) Click OK to close the dialog. The new scenario is automatically activated.
You can create several scenarios for any given range of cells.
Settings
The lower portion of the Create Scenario dialog contains several options. The default
settings (as shown in Figure 243) are likely to be suitable in most situations.
Display border
Places a border around the range of cells that your scenario alters. To choose the
color of the border, use the field to the right of this option. The border has a title
bar displaying the name of the active scenario. Click the arrow button to the right
of the scenario name to open a drop-down list of all the scenarios that have been
defined for the cells within the border. You can choose any of the scenarios from
this list at any time.
Copy back
Copies any changes you make to the values of scenario cells back into the active
scenario. If you do not select this option, the saved scenario values are never
changed when you make changes. The actual behavior of the Copy back setting
depends on the cell protection, the sheet protection, and the Prevent changes
setting (see Table 11 on page 247).
Caution
If you are viewing a scenario which has Copy back enabled and then
create a new scenario by changing the values and selecting Tools >
Scenarios, you also inadvertently overwrite the values in the first
scenario.
This is easily avoided if you leave the current values alone, create a new
scenario with Copy back enabled, and then change the values only when
you are viewing the new scenario.
Changing scenarios
Scenarios have two aspects that can be altered independently:
The extent to which either of these aspects can be changed is dependent upon both
the existing properties of the scenario and the current protection state of the sheet
and cells.
Table 11: Prevent changes behavior for scenario cell value changes
Settings
Change allowed
Sheet protection ON
247
248
Note
249
Note
Before you choose the Data > Multiple Operations option, be sure to
select not only your list of alternative values but also the adjacent cells
into which the results should be placed.
In the Formulas field of the Multiple Operations dialog, enter the cell reference to the
formula that you wish to use.
The arrangement of your alternative values dictates how you should complete the
rest of the dialog. If you have listed them in a single column, you should complete the
field for Column input cell. If they are along a single row, complete the Row input cell
field. You may also use both in more advanced cases. Both single and double-variable
versions are explained below.
The above can be explained best by examples. Cell references correspond to those in
the following figures.
Lets say you produce toys that you sell for $10 each (cell B1). Each toy costs $2 to
make (cell B2), in addition to which you have fixed costs of $10,000 per year (cell
B3). How much profit will you make in a year if you sell a particular number of toys?
Tip
250
You may find it easier to mark the required reference in the sheet if you
click the Shrink icon to reduce the Multiple operations dialog to the size
of the input field. The icon then changes to the Maximize icon; click it to
restore the dialog to its original size.
251
252
Caution
Beware of entering the cell reference of a variable into the wrong field.
The Row input cell field should contain not the cell reference of the
variable which changes down the rows of your results table, but that of
the variable whose alternative values have been entered along a single
row.
253
4) Set the cursor in the Row input cell field and click cell B1. This means that B1,
the selling price, is the horizontally entered variable (with the values 8, 10, 15
and 20).
5) Set the cursor in the Column input cell field and click cell B4. This means that
B4, the quantity, is the vertically entered variable.
6) Click OK. The profits for the different selling prices are now shown in the
range E2:H11.
254
Enter each of the values mentioned above into adjacent cells (for Capital, C, an
arbitrary value like $100,000 or it can be left blank; for number of years, n, 1; for
interest rate, i, 7.5%). Enter the formula to calculate the interest, I, in another cell.
Instead of C, n, and i, use the reference to the cell with the corresponding value. In
our example (Figure 249), this would be =B1*B2*B3.
1) Place the cursor in the formula cell (B4), and choose Tools > Goal Seek.
2) In the Goal Seek dialog, the correct cell is already entered in the Formula cell
field.
3) Place the cursor in the Variable cell field. In the sheet, click in the cell that
contains the value to be changed, in this example it is B1.
4) Enter the desired result of the formula in the Target value field. In this
example, the value is 15000. Figure 251 shows the cells and fields.
255
Solver example
Lets say you have $10,000 that you want to invest in two mutual funds for one year.
Fund X is a low risk fund with 8% interest rate and Fund Y is a higher risk fund with
12% interest rate. How much money should be invested in each fund to earn a total
interest of $1000?
To find the answer using Solver:
1) Enter labels and data:
Column labels: interest earned, amount invested, interest rate, and time
period, in cells B1 thru E1.
Time period: 1, in cells E2 and E3.
Total amount invested: 10000, in cell C4.
256
In cell C3, enter the formula C4C2 (total amount amount invested in
Fund X) as the amount invested in Fund Y.
In cells B2 and B3, enter the formula for calculating the interest earned
(see Figure 253).
In cell B4, enter the formula B2+B3 as the total interest earned.
257
9) Click OK. A dialog appears informing you that the Solving successfully
finished. Click Keep Result to enter the result in the cell with the variable
value. The result is shown in Figure 255.
Note
258
10
Chapter
Linking Calc Data
Sharing data in and out of Calc
Note
For users with experience using Microsoft Excel, a Calc sheet is called
either a sheet or worksheet in Excel. What Excel calls a workbook, Calc
calls a spreadsheet (the whole document).
Identifying sheets
When you open a new spreadsheet it has, by default, three sheets named Sheet1,
Sheet2, and Sheet3. Sheets in Calc are managed using tabs at the bottom of the
spreadsheet, as shown below.
Renaming sheets
Sheets can be renamed at any time. To give a sheet a more meaningful name:
Enter the name in the name box when you create the sheet, or
Double click on the sheet tab, or
Right-click on a sheet tab, select Rename Sheet from the pop-up menu and
replace the existing name.
260
Note
261
To insert just one sheet, choose whether before or after then currently selected sheet,
give it a new name if desired, and click OK. The new sheet will be selected and
visible in the line of sheet tabs.
In our example, we need 6 sheets (one for each of the 5 accounts and one as a
summary sheet), so we will add 3 more. We also want to name each of these sheets
for the account they represent: Summary, Checking Account, Savings Account, Credit
Card 1, Credit Card 2, and Car Loan.
We have two choices: insert 3 new sheets and rename all 6 sheets afterwards; or
rename the existing sheets, then insert the 3 new sheets one at a time, renaming
each new sheet during the insert step.
To insert sheets and rename afterwards:
1) In the Insert Sheet dialog, choose the position for the new sheets (in this
example, we use After current sheet).
2) Choose New sheet and 3 as the No. of sheets. (Three sheets are already
provided by default.) Because you are inserting more than one sheet, the
Name box is not available.
3) Click OK to insert the sheets.
4) For the next steps, see Renaming sheets on page 260.
To insert sheets and name them at the same time:
1) Rename the existing sheets Summary, Checking Account, and Savings Account,
as described in Renaming sheets on page 260.
2) In the Insert Sheet dialog, choose the position for the first new sheet.
3) Choose New sheet and 1 as the No. of sheets. The Name box is now available.
4) In the Name box, type a name for this new sheet, for example Credit Card 1.
5) Click OK to insert the sheet.
6) Repeat steps 14 for each new sheet, giving them the names Credit Card 2 and
Car Loan.
Your sheet tab area should now look like this.
262
Tip
For a shortcut to inserting a sheet from another file, choose Insert >
Sheet from file from the menu bar. The Insert Sheet dialog opens with
the From file option preselected, and then the Insert dialog opens on top
of it.
The above method adds a sheet from another file as an embedded object it is
contained within the document and is independent of the original sheet. If you prefer,
select the Link option to insert the external sheet as a link instead as a copy. This is
one of several ways to include live data from another spreadsheet. (See also
Linking to external data on page 270.) The links can be updated manually to show
the current contents of the external file; or, depending on the options you have
selected in Tools > Options > OpenOffice.org Calc > General > Updating,
whenever the file is opened.
If the sheet is contained in an already open spreadsheet you can use the Move/Copy
command in the other spreadsheet to copy (or move) a sheet to another document.
263
Balance column. We want to place the reference for the checking account balance in
cell B3.
Note
The sheet name is in single quotes because it contains a space, and the
mandatory period (.) always falls outside any quotes.
So, you can fill in the Savings Account cell reference by just typing it in. Assuming
that the balance is in the same cell (F3) in the Savings Account sheet, the cell
reference should be =Savings Account.F3 (see Figure 266).
265
266
Note
The reference for a file has three forward slashes /// and the reference
for a hyperlink has two forward slashes //. The format of the path and file
name depends on the operating system in use.
If a cell with a reference in it shows #REF it may mean that the link is no
longer valid. Check the location of the file and amend the reference to
the correct path and name.
Note
Make sure that the folder structure on your computer is the same as the
file structure on your web server if you save your links as relative to the
file system and you are going to upload pages to the Internet.
Tip
When you rest the mouse pointer on a hyperlink, a help tip displays the
absolute reference, since OOo uses absolute path names internally. The
complete path and address can only be seen when you view the result of
the HTML export (saving the spreadsheet as an HTML file), by loading
the HTML file as Text, or by opening it with a text editor.
267
Creating hyperlinks
When you type text that can be used as a hyperlink (such as a website address or
URL), Calc formats it automatically, creating the hyperlink and applying to the text a
color and background shading. If this does not happen, you can enable this feature
using Tools > AutoCorrect Options > Options and selecting URL Recognition.
Tips
You can also insert and modify links using the Hyperlink dialog. To display the dialog,
click the Hyperlink icon
on the Standard toolbar or choose Insert > Hyperlink
from the menu bar. To turn existing text into a link, highlight it before opening the
dialog.
On the left side, select one of the four categories of hyperlinks:
Internet: the hyperlink points to a web address, normally starting with http://
Mail & News: the hyperlink opens an email message that is pre-addressed to
a particular recipient.
For a Mail and News hyperlink, specify whether it is a mail or news link, the receiver
address and for email, also the subject.
For a Document hyperlink, specify the document path (the Open File button opens a
file browser); leave this blank if you want to link to a target in the same spreadsheet.
Optionally specify the target in the document (for example a specific sheet). Click on
the Target in document icon to open the Navigator where you can select the target,
or if you know the name of the target, you can type it into the box.
For a New Document hyperlink, specify whether to edit the newly created document
immediately (Edit now) or just create it (Edit later), and enter the file name and the
type of document to create (text, spreadsheet, etc.). The Select path button opens a
directory picker dialog.
The Further settings section in the bottom right of the dialog is common to all the
hyperlink categories, although some choices are more relevant to specific types of
links.
Set the value of Frame to determine how the hyperlink will open. This applies
to documents that open in a Web browser.
Text specifies the text that will be visible to the user. If you do not enter
anything here, Calc will use the full URL or path as the link text. Note that if
the link is relative and you move the file, this text will not change, though the
target will.
Events button: this button will be activated to allow Calc to react to events for
which the user has written some code (macro). This function is not covered in
this chapter.
A hyperlink button is a type of form control. As with all form controls, it
can be anchored or positioned by right-clicking on the button in design
mode. More information about forms can be found in Chapter 15 of the
Writer Guide.
Note
For the button to work , the spreadsheet must not be in design mode. To
toggle design mode on and off, view the Form Controls toolbar (View >
Toolbars > Form Controls) and click the Design Mode On/Off button
. See Chapter 15 of the Writer Guide, Using forms in Writer, for more
information on forms and their use in documents.
269
Editing hyperlinks
To edit an existing link, place the cursor anywhere in the link and click the Hyperlink
icon
on the Standard toolbar or select Edit > Hyperlink from the menu bar. The
Hyperlink dialog (Figure 269) opens. If the Hyperlink is in button form, the
spreadsheet must have Design Mode on in order to edit the Hyperlink. Make your
changes and click Apply. If you need to edit several hyperlinks, you can leave the
Hyperlink dialog open until you have edited all of them. Be sure to click Apply after
each one. When you are finished, click Close.
Removing hyperlinks
You can remove the clickable link from hyperlink textleaving just the textby rightclicking on the link and selecting Default Formatting. This option is also available
from the Format menu. You may then need to re-apply some formatting in order for it
to match the rest of your document.
To erase the link text or button from the document completely, select it and press the
Backspace or Delete key.
270
Figure 271: Selecting a table or range in a source document from the Web
1) The Available tables/ranges list remains empty until you press Enter
after typing the URL of the source. If you select the source document
using the [] button, then pressing Enter is not required.
Notes
2) The OK button remains unavailable (grayed out) until you select one
or more tables/ranges in the list. You can hold down the Ctrl key
while clicking on tables/ranges to select more than one.
3) No images are imported.
271
Figure 272: Opening a file using the Web Page Query filter
6) In the Navigator, select the Insert as Link drag mode, as shown in Figure
273.
7) Select the required range or table and drag it from the Navigator into the
target document, to the cell where you want the upper left-hand cell of the
data range to be.
272
Figure 275: Using the Name box to find a data range name
273
274
275
3) Click Next. Type the path to the database file or click Browse and use the
Open dialog to navigate to and select the database file before clicking Open.
4) Click Next. Select Yes, register the database for me, but clear the checkbox
marked Open the database for editing.
5) Click Finish. Name and save the database in the location of your choice. Note:
changes made to the *.odb do not affect the original dBASE file.
Once a data source has been registered, it can be used by any OOo component (for
example Calc).
276
Click the gray box to the left of the row you want to select if only selecting
one row. That row is highlighted.
To select multiple adjacent rows, hold down the Shift key while clicking
the gray box of the rows you need.
To select multiple separate rows, hold down the Control key while
selecting the rows. The selected rows are highlighted.
To select all the rows, click the gray box in the upper left corner. All rows
are highlighted.
277
7) Click the arrows on the Form Navigation toolbar to view the different records
of the table. The number in the Record box changes as you move through the
records. The data in the fields changes to correspond to the data for that
particular record number. You can also search for a specific record, sort and
filter records, and do other tasks using this toolbar.
Embedding spreadsheets
Spreadsheets can be embedded in other OOo files. This is often used in Writer or
Impress documents so that Calc data can be used in a text document. You can embed
the spreadsheet as either an OLE or DDE object. The difference between a DDE
object and a Linked OLE object is that a Linked OLE object can be edited from the
document in which it is added as a link, but a DDE object cannot.
For example, if a Calc spreadsheet is pasted into a Writer document as a DDE object,
then the spreadsheet cannot be edited in the Writer document. But if the original
Calc spreadsheet is updated, the changes are automatically made in the Writer
document. If the spreadsheet is inserted as a Linked OLE object into the Writer
document, then the spreadsheet can be edited in the Writer as well as in the Calc
document and both documents will remain in sync with each other.
278
Note
Further objects is only available if you are using the Windows operating
system.
Note
279
280
Note
You can only edit one copy of a spreadsheet at a time. If you have a linked
OLE spreadsheet object in an open Writer document and then open the
same spreadsheet in Calc, the Calc spreadsheet will be a read-only copy.
In Calc, select the cells that you want to make the DDE link to.
Copy them: Edit > Copy or Ctrl+C.
Go to the place in the spreadsheet where you want the link to be.
Select Edit > Paste Special.
When the Paste Special dialog opens, select the Link option on the bottom left
of the dialog (Figure 285). Click OK.
The cells now reference the copied data, and the formula bar shows a reference
beginning with {=DDE.
If you now edit the original cells, the linked cells will update.
281
Figure 286: Paste Special dialog in Writer, with DDE link selected
282
11
Chapter
Sharing and Reviewing
Documents
Introduction
This chapter covers methods for editing shared documents: sharing (collaboration),
recording changes, adding comments, reviewing changes, merging and comparing
documents, and saving and using document versions. Basic editing techniques are
discussed in Chapter 2 (Entering, Editing, and Formatting Data).
in unshared mode, you need to save the shared document using another name or
path. This creates a copy of the spreadsheet that is not shared.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Define Range
Sort
Subtotals
Validity
Multiple Operations
Consolidate
Group and Outline (all)
DataPilot (all)
If the document was not modified and saved by another user since you opened
it, the document is saved.
If the document was modified and saved by another user since you opened it,
one of the following events will occur:
If the changes do not conflict, the document is saved, the message below
appears, and any cells modified by the other user are shown with a red
border.
285
If the changes conflict, the Resolve Conflicts dialog is shown. You must
decide for each conflict which version to keep, yours or the other persons.
When all conflicts are resolved, the document is saved. While you are
resolving the conflicts, no other user can save the shared document.
If another user is trying to save the shared document and resolve conflicts, you
see a message that the shared spreadsheet file is locked due to a merge-in in
progress. You can choose to cancel the Save command for now, or retry saving
later.
When you successfully save a shared spreadsheet, the document shows the latest
version of all changes saved by all users.
Recording changes
You can use several methods to record and then view changes that you or others
make to a document.
You can use change marks to show added material, deleted material, and
changes to formatting. Later, you or another person can review the document
and accept or reject each change.
If you are not using file sharing, you can make changes to a copy of the
You can save versions that are stored as part of the original file. See page 295.
Reviewers can leave comments in the document, either attached to specific changes
or standalone.
286
Note
287
Looking over the figures, you see a few places where money could be saved:
To make these changes, use the record changes feature in Calc. To start recording
changes:
1) Open the Budget Spreadsheet.
2) Select Edit > Changes > Record from the menu bar.
3) Begin editing the document.
A colored border, with a dot in the upper left-hand corner, appears around a cell
where changes were made (Figure 291). Other reviewers then quickly know which
cells were edited. A deleted column or row is marked by a heavy colored bar.
Tip
Some changes, for example cell formatting, are not recorded and marked.
Tip
To change the color that indicates changes, select Tools > Options >
OpenOffice.org Calc > Changes.
When you finish editing the document, you can send it to your coach.
You may want to explain your rationale for the changes. You can share your insight in
two ways: by adding comments to the changes you made, or by adding general
comments to the spreadsheet.
288
Tip
You can step through your changes one at a time using the left and right
arrows on the right hand side of the Comment dialog, and add comments
to each change. The title bar for the Comment dialog shows the cell and
the change you are commenting on.
After you have added a comment to a changed cell, you can see it by hovering the
mouse pointer over the cell, as shown in Figure 293.
289
Tip
You can view your comments one at a time using the left and right arrows
located on the right hand side of the Comment dialog. You do not need to
click OK after editing each comment; you can save them all at once when
youre done editing.
Tip
You can change the colors Calc uses for comments by selecting Tools >
Options > OpenOffice.org > Appearance.
To view the comment you just added, hover the mouse pointer over the cell that has a
comment; the comment appears, as shown below.
290
Editing comments
You can edit and format the text of a comment, just as you do for any other text.
1) Right-click on the cell containing the comment marker, and choose Show
comment from the pop-up menu.
2) Select the comment, then double-click on it. The cursor changes to the usual
blinking text-entry cursor, and the Formatting toolbar changes to show text
attributes.
3) When done, click outside the comment to deselect it. To hide the comment
again, right-click on the cell and deselect Show Comment on the pop-up
menu.
Formatting comments
You can change the background color, border style, transparency, and other
attributes of a comment.
1) Right-click on the cell containing the comment marker, and choose Show
comment from the pop-up menu.
2) Click on the comment itself. The Formatting toolbar changes to show many of
the comment formatting options. These are the same as the options for
formatting graphics; see Chapter 5 (Using Graphics in Calc) for more
information.
You can also right-click on the comment to see a menu of choices, some of
which lead to dialogs in which you can fine-tune the formatting; these dialogs
are also discussed in Chapter 5.
3) When done, click outside the comment to deselect it. To hide the comment
again, right-click on the cell and deselect Show Comment on the pop-up
menu.
Reviewing changes
At this point, we are going to change our perspective from the point of view of the
team sponsor to that of the coach, so we can see how to review and accept or reject
the changes to the document the coach originally wrote.
Chapter 11 Sharing and Reviewing Documents
291
You are the coach of a youth baseball team and you submitted a potential
budget created in Calc to your team sponsor.
Your sponsor has reviewed the document using the record changes feature
of Calc. Now you want to review those changes and accept or reject the
counter proposal.
Because the sponsor recorded changes in Calc, you can easily see what
changes were made and decide how to act.
Viewing changes
Calc gives you tremendous control over what changes you see when reviewing a
document. To change the available filters, select Edit > Changes > Show. The
dialog shown in Figure 297 opens.
Range Only changes made in a specific range of cells are displayed. This is
especially useful if you have a large spreadsheet and only want to review a
part of it.
Comment Searches the content of the comments and only displays changes
which have comments that match the search criteria.
292
You can also access the filter control in the Accept or Reject Changes
dialog shown in Figure 298. Click the Filter tab to get a set of options
similar to those shown in Figure 299.
OpenOffice.org 3.3 Calc Guide
293
Merging documents
You submitted your budget proposal to your sponsor, but you sent it
to one of your assistant coaches as well. Both of them returned their
revised budget to you at the same time.
You could review each document and the changes separately, but to
save time, you want to see both of their revisions simultaneously.
The processes discussed to this point are effective when you have one reviewer at a
time. Sometimes, however, multiple reviewers all return edited versions of a
document at the same time. In this case, it may be quicker to review all of these
changes at once, rather than one review at a time. For this purpose, you can merge
documents in Calc.
To merge documents, all of the edited documents need to have recorded changes in
them.
1)
2)
3)
4)
294
Comparing documents
Sometimes when sharing documents, reviewers may forget to record the changes
they make. This is not a problem with Calc, because Calc can find the changes by
comparing documents.
In order to compare documents you need to have the original document and the one
that is edited. To compare them:
1) Open the edited document that you want to compare with the original
document.
2) Select Edit > Compare Document.
3) An open document dialog appears. Select the original document and click
Insert.
Calc finds and marks the changes as follows:
All data that occurs in the edited document but not in the original is identified
as inserted.
All data that is in your original document but is not in the edited document is
identified as deleted.
Saving versions
Most documents go through many drafts. It is often useful to save new versions of a
document. You can do this by saving a copy of the document (under a different name)
after each revision, or by using Calcs version feature.
Caution
295
Now when you save the file, both versions are saved in the same file. From this point
you can:
Open an old version Select the version and click the Open button and a readonly copy of a previous version opens.
Review the comments Select a version and click the Show button to display
the full comments made by yourself or other reviewers.
Note
The new file is bigger in size, as two spreadsheets are effectively saved
together into one file.
297
12
Chapter
Calc Macros
Introduction
A macro is a saved sequence of commands or keystrokes that are stored for later use.
An example of a simple macro is one that types your address. The OpenOffice.org
(OOo) macro language is very flexible, allowing automation of both simple and
complex tasks. Macros are especially useful to repeat a task the same way over and
over again. This chapter briefly discusses common problems related to macro
programming using Calc.
299
300
1 My Macros
2 OpenOffice.org Macros
3 Open documents
7 Current document
8 Expand/collapse list
11) Click OK to create a new module named Module1. Select the newly created
Module1, type PasteMultiply in the Macro name box at the upper left, and
click Save. (See Figure 309.)
301
303
*****
Sub Main
End Sub
Function NumberFive()
NumberFive = 5
End Function
305
Tip
Function names are not case sensitive. In Figure 315, you can enter
=NumberFive() and Calc clearly shows =NUMBERFIVE().
Save the Calc document, close it, and open it again. Depending on your settings in
Tools > Options > OpenOffice.org > Security > Macro Security, Calc will
display the warning shown in Figure 316 or the one shown in Figure 317. You will
need to click Enable Macros, or Calc will not allow any macros to be run inside the
document. If you do not expect a document to contain a macro, it is safer to click
Disable Macros in case the macro is a virus.
306
If you choose to disable macros, then when the document loads, Calc can no longer
find the function.
307
Tip
Passing one argument is as easy as passing two: add another argument to the
function definition (see Listing 6). When calling a function with two arguments,
separate the arguments with a semicolon; for example, =TestMax(3; -4).
Listing 6. TestMax accepts two arguments and returns the larger of the two.
Function TestMax(x, y)
If x >= y Then
TestMax = x
Else
TestMax = y
End If
End Function
309
Tip
Tip
Sorting
Consider sorting the data in Figure 320. First, sort on column B descending and then
column A ascending.
311
Conclusion
This chapter provides a brief overview on how to create libraries and modules, using
the macro recorder, using macros as Calc functions, and writing your own macros
without the macro recorder. Each topic deserves at least one chapter, and writing
your own macros for Calc could easily fill an entire book. In other words, this is just
the beginning of what you can learn!
312
13
Chapter
Calc as a Simple Database
A guide for users and macro programmers
Introduction
A Calc document is a very capable database, providing sufficient functionality to
satisfy the needs of many users. This chapter presents the capabilities of a Calc
document that make it suitable as a database tool. Where applicable, the functionality
is explained using both the GUI (Graphical User Interface) and macros.
Note
Although this document was initially created for macro programmers, the
content should be accessible to all users. If you do not use macros, then
skip those portions that deal with macros. On the other hand, if you want
to learn more about macros, be certain to check out the book
OpenOffice.org Macros Explained.
Name
Test 1
Test 2
Quiz 1
Quiz 2
Average
Grade
Andy
95
93
93
92
93.25
Betty
87
92
65
73
79.25
Bob
95
93
93
92
93.25
Brandy
45
65
92
85
71.75
Frank
95
93
85
92
91.25
Fred
87
92
65
73
79.25
Ilsub
70
85
97
79
82.75
James
45
65
97
85
73
10
Lisa
100
97
100
93
97.5
11
Michelle
100
97
100
65
90.5
12
Ravi
87
92
86
93
89.5
13
Sal
45
65
100
92
75.5
14
Ted
100
97
100
85
95.5
15
Tom
70
85
93
65
78.25
16
Whil
70
85
93
97
86.25
314
Tip
Named range
The most common usage of a named range is, as its name implies, to associate a
range of cells to a meaningful name. For example, create a range named Scores, and
then use the following equation: =SUM(Scores). To create a named range, select the
range to define. Use Insert > Names > Define to open the Define Names dialog.
Use the Define Names dialog to add and modify one named range at a time.
315
In a macro, a named range is accessed, created, and deleted using the NamedRanges
property of a Calc document. Use the methods hasByName(name) and
getByName(name) to verify and retrieve a named range. The method
getElementNames() returns an array containing the names of all named ranges. The
NamedRanges object supports the method addNewByname, which accepts four
arguments; the name, content, position, and type. The macro in Listing 10 creates a
named range, if it does not exist, that references a range of cells.
Listing 10. Create a named range that references $Sheet1.$B$3:$D$6.
Sub AddNamedRange()
Dim oRange
' The created range.
Dim oRanges
' All named ranges.
Dim sName$
' Name of the named range to create.
Dim oCell
' Cell object.
Dim s$
sName$ = "MyNRange"
oRanges = ThisComponent.NamedRanges
If NOT oRanges.hasByName(sName$) Then
REM Obtain the cell address by obtaining the cell
REM and then extracting the address from the cell.
Dim oCellAddress As new com.sun.star.table.CellAddress
oCellAddress.Sheet = 0
'The first sheet.
oCellAddress.Column = 1
'Column B.
oCellAddress.Row = 2
'Row 3.
REM The first argument is the range name.
REM The second argument is the formula or expression to use.
REM The second argument is usually a string that
REM defines a range.
REM The third argument specifies the base address for
REM relative cell references.
REM The fourth argument is a set of flags that define
REM how the range is used, but most ranges use 0.
REM The fourth argument uses values from the
REM NamedRangeFlag constants (see Table 13).
s$ = "$Sheet1.$B$3:$D$6"
oRanges.addNewByName(sName$, s$, oCellAddress, 0)
End If
REM Get a range using the created named range.
oRange = ThisComponent.NamedRanges.getByName(sName$)
REM Print the string contained in cell $Sheet1.$B$3
oCell = oRange.getReferredCells().getCellByPosition(0,0)
Print oCell.getString()
End Sub
316
The method addNewByname() accepts four arguments; the name, content, position,
and type. The fourth argument to the method addNewByName() is a combination of
flags that specify how the named range will be used (see Table 13). The most
common value is 0, which is not a defined constant value.
Table 13. com.sun.star.sheet.NamedRangeFlag constants.
Value
Name
Description
FILTER_CRITERIA
PRINT_AREA
COLUMN_HEADER
ROW_HEADER
The third argument, a cell address, acts as the base address for cells referenced in a
relative way. If the cell range is not specified as an absolute address, the referenced
range will be different based on where in the spreadsheet the range is used. The
relative behavior is illustrated in Listing 11, which also illustrates another usage of a
named rangedefining an equation. The macro in Listing 11 creates the named
range AddLeft, which refers to the equation A3+B3 with C3 as the reference cell. The
cells A3 and B3 are the two cells directly to the left of C3, so, the equation
=AddLeft() calculates the sum of the two cells directly to the left of the cell that
contains the equation. Changing the reference cell to C4, which is below A3 and B3,
causes the AddLeft equation to calculate the sum of the two cells that are to the left
on the previous row.
Listing 11. Create the AddLeft named range.
Sub AddNamedFunction()
Dim oSheet
'Sheet that contains the named range.
Dim oCellAddress
'Address for relative references.
Dim oRanges
'The NamedRanges property.
Dim oRange
'Single cell range.
Dim sName As String 'Name of the equation to create.
sName = "AddLeft"
oRanges = ThisComponent.NamedRanges
If NOT oRanges.hasByName(sName) Then
oSheet = ThisComponent.getSheets().getByIndex(0)
oRange = oSheet.getCellRangeByName("C3")
oCellAddress = oRange.getCellAddress()
oRanges.addNewByName(sName, "A3+B3", oCellAddress, 0)
End If
End Sub
Tip
Listing 11 illustrates two capabilities that are not widely known. A named
range can define a function. Also, the third argument acts as the base
address for cells referenced in a relative way.
317
Select the range containing the headers and the data and then use Insert > Names
> Create to open the Create Names dialog (see Figure 322), which allows you to
simultaneously create multiple named ranges based on the top row, bottom row, right
column or left column. If you choose to create ranges based on the top row, one
named range is created for each column headerthe header is not included in the
named range. Although the header is not included in the range, the text in the header
is used to name the range.
Name
Description
TOP
BOTTOM
RIGHT
LEFT
318
Caution
Database range
Although a database range can be used as a regular named range, a database range
also defines a range of cells in a spreadsheet to be used as a database. Each row in a
range corresponds to a record and each cell corresponds to a field. You can sort,
group, search, and perform calculations on the range as if it were a database.
A database range provides behavior that is useful when performing database related
activities. For example, you can mark the first row as headings. To create, modify, or
delete a database range, use Data > Define Range to open the Define Data Range
dialog (see Figure 323). When you first define a range, the Modify button shown in
the example is labeled New.
319
Sorting
The sorting mechanism in a Calc document rearranges the data in the sheet. The first
step in sorting data is to select the data that you want to sort. To sort the data in
Table 23, select the cells from A1 to G16if you include the column headers, indicate
this in the sort dialog (see Figure 325). Use Data > Sort to open the Sort dialog (see
Figure 324). You can sort by up to three columns or rows at a time.
320
Click on the Options tab (see Figure 325) to set the sort options. Check the Range
contains column labels checkbox to prevent column headers from being sorted
with the rest of the data. The Sort by list box in Figure 324 displays the columns
using the column headers if the Range contains column labels checkbox in Figure
325 is checked. If the Range contains column labels checkbox is not checked,
however, then the columns are identified by their column name; Column A, for
example.
Normally, sorting the data causes the existing data to be replaced by the newly sorted
data. The Copy sort results to checkbox, however, causes the selected data to be
left unchanged and a copy of the sorted data is copied to the specified location. You
can either directly enter a target address (Sheet3.A1, for example) or select a
predefined range.
Check the Custom sort order checkbox to sort based on a predefined list of values.
To set your own predefined lists, use Tools > Options > OpenOffice.org Calc >
Sort Lists and then enter your own sort lists. Predefined sort lists are useful for
sorting lists of data that should not be sorted alphabetically or numerically. For
example, sorting days based on their name.
Caution
321
Filters
Use filters to limit the visible rows in a spreadsheet. Generic filters, common to all
sorts of data manipulations, are automatically provided by the auto filter capability.
You can also define your own filters.
Caution
After applying a filter, some rows are visible and some rows are not. If
you select multiple rows in one operation, you will also select the
invisible rows contained between the selected visible rows. Operations,
such as delete, act on all of the selected rows. To avoid this problem,
you must individually select each of the filtered rows using the control
key.
Auto filters
Use auto filters to quickly create easily accessible filters found to be commonly used
in many different types of applications. After creating an auto filter for a specific
column, a combo box is added to the column. The combo box provides quick access to
each of the auto filter types.
The Top 10 auto filter displays the ten rows with the largest value. If the value
70 is in the top ten values, then all rows containing the value 70 in the filtered
column are displayed. In other words, more than ten rows may be displayed.
An auto filter entry is created for each unique entry in the column.
To create an auto filter, first select the columns to filter. For example, using the data
in Table 23, select data in columns B and C. If you do not select the title rows, Calc
asks if the title row or the current row should be used. Although you can place the
auto filter in any row, only the rows below the auto filter are filtered. Use Data >
Filter > AutoFilter to insert the auto filter combo box in the appropriate cell.
Finally, use the drop-down arrow to choose an appropriate auto filter (see Figure
326).
322
Standard filters
Use Data > Filter > Standard Filter to open Standard Filter dialog (see Figure
327) and limit the view based on 1 to 3 filter conditions. Use Data > Filter >
Remove Filter to turn off the filter.
323
.Field = 5
REM Compare using a numeric or a string?
.IsNumeric = True
REM The NumericValue property is used
REM because .IsNumeric = True from above.
.NumericValue = 80
REM If IsNumeric was False, then the
REM StringValue property would be used.
REM .StringValue = "what ever"
REM Valid operators include EMPTY, NOT_EMPTY, EQUAL,
REM NOT_EQUAL, GREATER, GREATER_EQUAL, LESS,
REM LESS_EQUAL, TOP_VALUES, TOP_PERCENT,
REM BOTTOM_VALUES, and BOTTOM_PERCENT
.Operator = com.sun.star.sheet.FilterOperator.GREATER_EQUAL
End With
REM The filter descriptor supports the following
REM properties: IsCaseSensitive, SkipDuplicates,
REM UseRegularExpressions,
REM SaveOutputPosition, Orientation, ContainsHeader,
REM CopyOutputData, OutputPosition, and MaxFieldCount.
oFilterDesc.setFilterFields(oFields())
oFilterDesc.ContainsHeader = True
oSheet.filter(oFilterDesc)
End Sub
When a filter is applied to a sheet, it replaces any existing filter for the sheet. Setting
an empty filter in a sheet will therefore remove all filters for that sheet (see Listing
15).
Listing 15. Remove the current sheet filter.
Sub RemoveSheetFilter()
Dim oSheet
' Sheet to filter.
Dim oFilterDesc
' Filter descriptor.
oSheet = ThisComponent.getSheets().getByIndex(0)
oFilterDesc = oSheet.createFilterDescriptor(True)
oSheet.filter(oFilterDesc)
End Sub
Listing 16 demonstrates a more advanced filter that filters two columns and uses
regular expressions. Some unexpected behavior occurred while working with Listing
16. Although you can create a filter descriptor using any sheet cell range, the filter
applies to the entire sheet.
Chapter 13 Calc as a Simple Database
325
Advanced filters
An advanced filter supports up to eight filter conditions, as opposed to the three
supported by the simple filter. The criteria for an advanced filter is stored in a sheet.
The first step in creating an advanced filter is entering the filter criteria into the
spreadsheet.
1) Select an empty space in the Calc document. The empty space may reside in
any sheet in any location in the Calc document.
326
2) Duplicate the column headings from the area to be filtered into the area that
will contain the filter criteria.
3) Enter the filter criteria underneath the column headings (see Table 24). The
criterion in each column of a row is connected with AND. The criteria from
each row are connected with OR.
Table 15. Example advanced filter criteria
Name
="Andy"
Test 1
Test 2
Quiz 1
Quiz 2
Average
Grade
>80
<80
Tip
Define named ranges to reference your advanced filter criteria and any
destination ranges for filtered data (see Figure 321). Each appropriately
configured named range is available in drop down list boxes in the
Advanced Filter dialog (see Figure 328).
After creating one or more sets of filter criteria, apply an advanced filter as follows:
1) Select the sheet ranges that contain the data to filter.
2) Use Data > Filter > Advanced Filter to open the Advanced Filter dialog (see
Figure 328).
3) Select the range containing the filter criteria and any other relevant options.
4) Click OK.
Applying an advanced filter using a macro is simple (see Listing 17). The cell range
containing the filter criteria is used to create a filter descriptor, which is then used to
filter the range containing the data.
Figure 328. Apply an advanced filter using a previously defined named range.
Listing 17. Use an advanced filter.
Sub UseAnAdvancedFilter()
Dim oSheet
'A sheet from the Calc document.
Dim oRanges
'The NamedRanges property.
327
328
Comment
ContainsHeader
CopyOutputData
IsCaseSensitive
Orientation
Specifies if columns
(com.sun.star.table.TableOrientation.COLUMNS) or rows
(com.sun.star.table.TableOrientation.ROWS) are filtered.
OutputPosition
SaveOutputPosition
SkipDuplicates
UseRegularExpression
s
329
Description
AVERAGE
Return the average. Ignore empty cells and cells that contain
text.
AVERAGEA
Return the average. The value of text is 0 and empty cells are
ignored.
COUNT
COUNTA
COUNTBLANK
COUNTIF
HLOOKUP
Search for a specific value across the columns in the first row of
an array. Return the value from a different row in the same
column.
INDEX
INDIRECT
LOOKUP
MATCH
MAX
MAXA
MIN
MINA
MEDIAN
MODE
Return the most common value in a data set. If there are several
values with the same frequency, it returns the smallest value. An
error occurs when a value doesnt appear twice.
OFFSET
PRODUCT
330
Function
Description
STDEV
STDEVA
STDEVP
STDEVPA
SUBTOTAL
SUM
SUMIF
Calculate the sum for the cells that meet the search criteria.
VAR
VARA
VARP
VARPA
VLOOKUP
Search for a specific value across the rows in the first column of
an array. Returns the value from a different column in the same
row.
Most of the functions in Table 17 require no explanation, either because they are well
understood (SUM, for example) or because if you need to use them then you know
what they are (STDEV, for example). Unfortunately, some of the more useful functions
are infrequently used because they are not well understood.
331
Table 18. Examples of search criteria for the COUNTIF and SUMIF functions.
Criteria Type
Function
Result
Description
Number
=COUNTIF(B1:C16; 95)
Text
=COUNTIF(B1:C16; "95")
Expression
=COUNTIF(B1:C16; ">95")
Expression
=COUNTIF(B1:C16; 2*45+5)
Regular
expression
=COUNTIF(B1:C16; "9.*")
12
Reference a
cell
=COUNTIF(B1:C16; B3)
Finds a number or
number and text
depending on the data
type in cell B3.
Regular
expression
=SUMIF(A1:A16; "B.*";
B1:B16)
227
Function
AVERAGE
COUNT
COUNTA
MAX
MIN
PRODUCT
STDEV
STDEVP
SUM
10
VAR
11
VARP
332
Tip
Do not forget that the SUBTOTAL function ignores cells that use the
SUBTOTAL function. Say you have a spreadsheet that tracks investments.
The retirement investments are grouped together with a subtotal. The
same is true of regular investments. You can use a single subtotal that
includes the entire range without worrying about the subtotal cells.
333
The data is arranged in rows and you want to return data from the same row.
For example, student names with test and quiz scores to the right of the
students name.
The data is arranged in columns and you want to return data from the same
column. For example, student names with test and quiz scores underneath the
students name.
LOOKUP(search_value; search_range)
LOOKUP(search_value; search_range; return_range)
The search value is the same as HLOOKUP and VLOOKUP. The search range,
however, must be a single row or a single column; for example, A7:A12 (values in
column A) or C5:Q5 (values in row 5). If the return_range is omitted, the matched
value is returned. Using LOOKUP without a return range is the same as using
HLOOKUP or VLOOKUP with a column index of 1.
The return range must be a single row or column containing the same number of
elements as the search range. If the search value is found in the fourth cell in the
search range, then the value in the fourth cell in the return range is returned. The
return range can have a different orientation than the search range. In other words,
the search range can be a row and the return range may be a column.
Use LOOKUP when:
=MATCH(search_value; search_range)
=MATCH(search_value; search_range; search_type)
334
The search value and search range are the same as for LOOKUP. The final argument,
search type, controls how the search is performed. A search type of 1, sorted in
ascending order, is the default. A search type of -1 indicates that the list is sorted in
descending order. A search type of 0 indicates that the list is not sorted. Regular
expressions can only be used on an unsorted list.
Use MATCH when:
You need an index into the range rather than the value.
The search data is in descending order and the data is large enough that the
Examples
Consider the data in Table 23. Each students information is stored in a single row.
Write a formula to return the average grade for Fred. The problem can be restated as
Search column A in the range A1:G16 for Fred and return the value in column F
(column F is the sixth column). The obvious solution is
=VLOOKUP("Fred"; A2:G16; 6). Equally obvious is
=LOOKUP("Fred"; A2:A16; F2:F16).
It is common for the first row in a range to contain column headers. All of the search
functions check the first row to see if there is a match and then ignore it if it does not
contain a match, in case the first row is a header.
What if the column heading Average is known, but not the column containing the
average? Find the column containing Average rather than hard coding the value 6. A
slight modification using MATCH to find the column yields
=VLOOKUP("Fred"; A2:G16; MATCH("Average"; A1:G1; 0)); notice that the
heading is not sorted. As an exercise, use HLOOKUP to find Average and then
MATCH to find the row containing Fred.
As a final example, write a formula to assign grades based on a students average
score. Assume that a score less than 51 is an F, less than 61 is an E, less than 71 is a
D, less than 81 is a C, less than 91 is a B, and 91 to 100 is an A. Assume that the
values in Table 20 are in Sheet2.
Table 20. Associate scores to a grade.
Score
Grade
51
61
71
81
91
335
ADDRESS(row; column)
ADDRESS(row; column; abs)
ADDRESS(row; column; abs; sheet)
The row and column are integer values where ADDRESS(1; 1) returns $A$1. The abs
argument specifies which portion is considered absolute and which portion is
considered relative (see Table 21); an absolute address is specified using the $
character. The sheet is included as part of the address only if the sheet argument is
used. The sheet argument is treated as a string. Using
ADDRESS(MATCH("Bob";A1:A5 ; 0); 2) with the data in Table 20 returns $B$2.
Tip
Calc supports numerous powerful functions that are not discussed here.
For example, the ROW, COLUMN, ROWS, and COLUMNS statements are
not discussed; a curious person would investigate these functions.
Description
Comment
INDIRECT("A2")
INDIRECT(G1)
SUM(INDIRECT("B1:B5"))
INDIRECT(ADDRESS(2; 1))
point. The second and third arguments specify the number of rows and columns to
move from the reference point; in other words, where the new range starts. The
OFFSET function has the following syntax:
If the height or width are missing, they default to 1. If the height is present, then a
range reference is returned rather than a cell reference. Using values from Table 23,
Listing 19 uses OFFSET to obtain the quiz scores for the student named Bob.
Listing 19. Complex example of OFFSET.
Description
MATCH("Bob";A1:A16; 0)
ADDRESS(4; 4)
Return $D$4.
INDIRECT("$D$4")
OFFSET($D$4; 0; 0; 1; 2)
SUM(D4:E4)
337
Description
MATCH("Bob";A1:A16; 0)-1
OFFSET(A1; 3; 3; 1; 2)
SUM(D4:E4)
Tip
The first argument to OFFSET can be a range so you can use a defined
range name.
Description
INDEX(reference)
INDEX(reference; row)
INDEX(reference; row;
column)
INDEX(reference; row;
column; range)
The INDEX function can return an entire range, a row, or a single column (see Table
25). The ability to index based on the start of the reference range provides some
interesting uses. Using the values shown in Table 23, Listing 21 finds and returns
Bobs quiz scores. Table 26 contains a listing of each function used in Listing 21.
Listing 21. Return Bobs quiz scores.
Description
MATCH("Bob";A2:A16; 0)
INDEX(A2:A16; 3)
OFFSET(A4:G4; 0; 3; 1; 2)
SUM(D4:E4)
338
Tip
Returns
=INDEX(B2:G2; 1; 2)
93
=INDEX(B5:G5; 1; 2)
65
=INDEX((B2:G2;B5:G5); 1; 2)
93
=INDEX((B2:G2;B5:G5); 1; 2; 1)
93
=INDEX((B2:G2;B5:G5); 1; 2; 2)
65
Database-specific functions
Although every Calc function can be used for database manipulation, the functions in
Table 28 are specifically designed for use as a database. The descriptions in Table 28
use the following terms interchangeably: row and record, cell and field, and database
and all rows.
Table 28. Database functions in a Calc document.
Function
Description
DAVERAGE
Return the average of all fields that matches the search criteria.
DCOUNT
Count the number of records containing numeric data that match the
search criteria.
DCOUNTA
Count the number of records containing text data that match the
search criteria.
DGET
DMAX
DMIN
DPRODUCT
Return the product of the fields that matches the search criteria.
DSTDEV
Calculate the standard deviation using the fields that match the
search criteria. The fields are treated as a sample.
DSTDEVP
Calculate the standard deviation using the fields that match the
search criteria. The fields are treated as the entire population.
DSUM
Return the sum of all fields that matches the search criteria.
DVAR
Calculate the variance using the fields that match the search criteria.
The fields are treated as a sample.
339
Function
Description
DVARP
Conclusion
A Calc document provides sufficient database functionality to satisfy the needs of
most people. The infrequently used database functions, such as OFFSET and INDEX,
are worth the time to learn and they can save yourself time in the long run.
340
14
Chapter
Setting up and
Customizing Calc
Introduction
This chapter describes some common customizations that you may wish to do. In
addition to selecting options from those provided, you can customize menus, toolbars,
and keyboard shortcuts, add new menus and toolbars, and assign macros to events.
However, you cannot customize context (right-click) menus.
Other customizations are made easy by extensions that you can install from the
OpenOffice.org website or from other providers.
Note
Note
342
The Back button has the same effect on all pages of the Options dialog. It
resets the options to the values that were in place when you opened
OpenOffice.org.
Print options
Set the print options to suit your default printer and your most common printing
method. You can change these settings at any time, either through this dialog or
during the printing process (by clicking the Options button on the Print dialog).
In the Options dialog, click OpenOffice.org > Print.
See Chapter 6 (Printing, Exporting, and E-mailing) for more about the options on this
page.
Color options
On the OpenOffice.org Colors page, you can specify colors to use in OOo
documents. You can select a color from a color table, edit an existing color, and
define new colors. These colors are stored in your color palette and are then available
in all components of OOo.
343
Security options
Use the OpenOffice.org Security page to choose security options for saving
documents and for opening documents that contain macros.
344
Figure 331: Choosing security options for opening and saving documents
Security options and warnings
If you record changes, save multiple versions, or include hidden information or
notes in your documents, and you do not want some of the recipients to see that
information, you can set warnings to remind you to remove this information, or
you can have OOo remove some information automatically. Note that (unless
removed) much of this information is retained in a file whether the file is in
OpenOffice.orgs default OpenDocument format, or has been saved to other
formats, including PDF.
Click the Options button to open a separate dialog with specific choices (Figure
332).
Macro security
Click the Macro Security button to open the Macro Security dialog (not shown
here), where you can adjust the security level for executing macros and specify
trusted sources.
345
Appearance options
On the OpenOffice.org Appearance page, you can specify which items are visible
and the colors used to display various items.
346
347
features may be lost. Two notable examples are cross-references to headings and
the formatting of numbered lists. If you plan to share documents with people who
are still using older versions of OpenOffice.org, save the document using ODF
version 1.0/1.1.
Size optimization for ODF format
OpenOffice.org documents are XML files. When you select this option, OOo writes
the XML data without indents and line breaks. If you want to be able to read the
XML files in a text editor in a structured form, deselect this option.
Document type
If you routinely share documents with users of Microsoft Excel, you might want to
change the Always save as attribute for spreadsheets to one of the Excel formats.
Note
Although OOo can open files in the .xlsx format produced by Microsoft
Office 2007, it cannot save in this format. This capability is planned for
a future release.
If you choose Save original Basic code, the macros will not work in
OpenOffice.org but are retained if you save the file into Microsoft Office
format.
If you choose Load Basic code to edit, the changed code is saved in an
OpenOffice.org document but is not retained if you save into an Microsoft
Office format.
If you are importing a Microsoft Excel file containing VBA code, you can select
the option Executable code. Whereas normally the code is preserved but
rendered inactive (if you inspect it with the StarBasic IDE you will notice that
it is all commented), with this option the code is ready to be executed.
348
349
If you want the macro to run automatically when the HTML document is opened,
choose Tools > Customize > Events. See Chapter 12 (Calc Macros) for more
information.
Export - Display warning
When the OpenOffice.org Basic option (see above) is not selected, the Display
warning option becomes available. If the Display warning option is selected,
then when exporting to HTML a warning is shown that OpenOffice.org Basic
macros will be lost.
350
Metrics section
Choose the unit of measurement used in spreadsheets and the default tab stops
distance.
Updating section
Choose whether to update links when opening a document always, only on request,
or never. Regardless of this setting, you can manually update links at any time. You
might want to avoid updating links when opening documents if they often contain
many charts or linked graphics that would slow down loading.
351
352
Display section
Select various options for the screen display.
Formulas
Specifies whether to show formulas instead of results in the cells.
Zero values
Specifies whether to show numbers with the value of 0.
Comment indicator
Specifies that a small rectangle is shown in the top right corner of the cell when a
comment exists for that cell. The text of the comment is shown when you hover
the pointer over the cell, if tips are enabled under Tools > Options >
OpenOffice.org > General.
To display a comment permanently, right-click on the cell and select Show
comment from the pop-up menu.
Value highlighting
Select this option to highlight all values in the sheet. Text is highlighted in black;
numbers in blue; and formulas, logical values, dates, and so on, in green.
When this command is active, any colors assigned in the document are not
displayed.
Anchor
Specifies whether the anchor icon is displayed when an inserted object, such as a
graphic, is selected.
353
Text overflow
If a cell contains text that is wider than the width of the cell, the text is displayed
over empty neighboring cells in the same row. If there is no empty neighboring
cell, a small triangle at the cell border indicates that the text continues.
Show references in color
Specifies that each reference is highlighted in color in the formula. The cell range
is also enclosed by a colored border as soon as the cell containing the reference is
selected for editing.
Objects section
Specifies whether to display or hide objects in three object groups: objects and
graphics; charts; and drawing objects.
Window section
Specifies whether some elements are visible onscreen: column/row headers,
horizontal scrollbar, vertical scrollbar, sheet tabs, and outline symbols.
If the Sheet tabs option is not selected, you can only switch between the sheets by
using the Navigator.
Note that there is a slider between the horizontal scrollbar and the sheet tabs that
may be set to one end.
Zoom section
Select the Synchronize sheets option to apply any selected zoom factor to all sheets
in the spreadsheet. If this option is not selected, separate zoom factors can be
applied to individual sheets.
Calculate options
In the Options dialog, choose OpenOffice.org Calc > Calculate.
Use this page to define the calculation settings for spreadsheets.
Date section
Select the start date for the internal conversion from days to numbers.
12/30/1899 (default)
Sets 12/30/1899 as day zero.
01/01/1900 (StarCalc 1.0)
Sets 1/1/1900 as day zero. Use this setting for StarCalc 1.0 spreadsheets
containing date entries.
01/01/1904
Sets 1/1/1904 as day zero. Use this setting for spreadsheets that are imported in a
foreign format.
Other options
Specify a variety of options relevant to spreadsheet calculation.
Case sensitive
Specifies whether to distinguish between upper and lower case in texts when
comparing cell contents. The EXACT text function is always case-sensitive,
independent of the settings in this dialog.
Decimal places
Defines the number of decimals to be displayed for numbers with the Standard
number format. The numbers are displayed as rounded numbers, but are not
saved as rounded numbers.
Precision as shown
Specifies whether to make calculations using the rounded values displayed in the
sheet. Charts will be shown with the displayed values. If this option is not
selected, the displayed numbers are rounded, but they are calculated internally
using the non-rounded number.
Search criteria = and <> must apply to whole cells
Specifies that the search criteria you set for the Calc database functions must
match the whole cell exactly. When this option is selected, Calc behaves exactly
like Microsftf Excel when searching cells in the database functions.
355
This search:
win
win.*
.*win
.*win.*
If this option is not selected, the win search pattern acts like .*win.* the search
pattern can be at any position within the cell when searching with the Calc
database functions.
Enable regular expressions in formulas
Specifies that regular expressions are enabled when searching and also for
character string comparisons. This relates to the database functions, and to
VLOOKUP, HLOOKUP and SEARCH.
Automatically find column and row labels
Specifies that you can use the text in any cell as a label for the column below the
text or the row to the right of the text. The text must consist of at least one word
and must not contain any operators.
Example: Cell E5 contains the text Europe. Below, in cell E6, is the value 100 and
in cell E7 the value 200. If the Automatically find column and row labels
option is selected, you can write the following formula in cell A1: =SUM(Europe).
356
Changes options
In the Options dialog, choose OpenOffice.org Calc > Changes.
Grid options
The Grid page defines the grid settings for spreadsheets. Using a grid helps you
determine the exact position of any charts or other objects you may add to a
spreadsheet. You can also set this grid in line with the snap grid.
If you have activated the snap grid but wish to move or create individual objects
without snap positions, you can press the Ctrl key to deactivate the snap grid for as
long as needed.
In the Options dialog, choose OpenOffice.org Calc > Grid.
357
Grid section
Snap to grid activates the snap function.
Visible grid displays grid points on the screen. These points are not printed.
Resolution section
Here you can set the unit of distance for the spacing between horizontal and vertical
grid points and subdivisions (intermediate points) of the grid.
Synchronize axes changes the current grid settings symmetrically.
Print options
In the Options dialog, choose OpenOffice.org Calc > Print. See Chapter 6
(Printing, Exporting, and E-mailing) for more about the options on this page.
359
5) To customize the selected menu, click on the Menu or Modify buttons. You
can also add commands to a menu by clicking on the Add button. These
actions are described in the following sections. Use the up and down arrows
next to the Entries list to move the selected menu item to a different position.
6) When you have finished making all your changes, click OK to save them.
are easily identified in the Entries list by a small black triangle on the right hand side
of the name.
In addition to renaming, you can specify a keyboard shortcut that allows you to select
a menu command when you press Alt+ an underlined letter in a menu command.
1) Select a menu or menu entry.
2) Click the Menu button and select Rename.
3) Add a tilde (~) in front of the letter that you want to use as an accelerator. For
example, to select the Save All command by pressing Alt+V, enter Sa~ve All.
361
To begin, select the menu or submenu in the Menu list near the top of the Customize
page, then select the entry in the Entries list under Menu Content. Click the Modify
button and choose the required action from the drop-down list of actions.
Most of the actions should be self-explanatory. Begin a group adds a separator line
after the highlighted entry.
Customizing toolbars
You can customize toolbars in several ways, including choosing which icons are
visible and locking the position of a docked toolbar, as described in Chapter 1
(Introducing OpenOffice.org) of the Getting Started guide. This section describes how
to create new toolbars and add other icons (commands) to the list of those available
on a toolbar.
To get to the toolbar customization dialog, do any of the following:
On the toolbar, click the arrow at the end of the toolbar and choose Customize
Toolbar.
Choose View > Toolbars > Customize from the menu bar.
Choose Tools > Customize from the menu bar and pick the Toolbars page
(Figure 349).
362
To customize toolbars:
1) In the Save In drop-down list, choose whether to save this changed toolbar for
Calc or for a selected document.
2) In the section OpenOffice.org Calc Toolbars, select from the Toolbar dropdown list the toolbar that you want to customize.
3) You can create a new toolbar by clicking on the New button, or customize
existing toolbars by clicking on the Toolbar or Modify buttons, and add
commands to a toolbar by clicking on the Add button. These actions are
described below.
4) When you have finished making all your changes, click OK to save them.
The new toolbar now appears on the list of toolbars in the Customize dialog. After
creating a new toolbar, you need to add some commands to it, as described below.
363
To choose an icon for a command, select the command and click Modify > Change
icon. On the Change Icon dialog (Figure 350), scroll through the available icons,
select one, and click OK to assign it to the command.
To use a custom icon, create it in a graphics program and import it into OOo by
clicking the Import button on the Change Icon dialog. Custom icons must be 16 x 16
or 26 x 26 pixels in size and cannot contain more than 256 colors.
Caution
To adapt shortcut keys to your needs, use the Customize dialog, as described below.
1) Select Tools > Customize > Keyboard. The Keyboard page of the Customize
dialog opens.
2) To have the shortcut key assignment available only with Calc, select Calc in
the upper right corner of the page; otherwise select OpenOffice.org to make
it available to every component.
3) Next select the required function from the Category and Function lists.
364
4) Now select the desired shortcut keys in the Shortcut keys list and click the
Modify button at the upper right.
5) Click OK to accept the change. Now the chosen shortcut keys will execute the
function chosen in step 3 above whenever they are pressed.
Note
All existing shortcut keys for the currently selected Function are listed in
the Keys selection box. If the Keys list is empty, it indicates that the
chosen key combination is free for use. If it were not, and you wanted to
reassign a shortcut key combination that is already in use, you must first
delete the existing key.
Shortcut keys that are greyed-out in the listing on the Customize dialog,
such as F1 and F10, are not available for reassignment.
365
3) Choose the category of style. (This example uses a cell style, but you can also
choose page styles.) The Function list now displays the names of the available
styles for the selected category. The example shows OOos predefined cell
styles.
4) To assign Ctrl+3 to be the shortcut key combination for the Heading style,
select Heading in the Function list, and then click Modify. Ctrl+3 now appears
in the Keys list on the right, and Heading appears next to Ctrl+3 in the
Shortcut keys box at the top.
5) Make any other required changes, and then click OK to save these settings
and close the dialog.
366
Some extensions are free of charge; others are available for a fee. Check the
descriptions to see what licenses and fees apply to the ones that interest you.
Installing extensions
To install an extension, follow these steps:
1) Download an extension and save it anywhere on your computer.
2) In OOo, select Tools > Extension Manager from the menu bar. In the
Extension Manager dialog (Figure 352), click Add.
3) A file browser window opens. Find and select the extension you want to install
and click Open. The extension begins installing. You may be asked to accept a
license agreement.
4) When the installation is complete, the extension is listed in the Extension
Manager dialog.
Tip
To get extensions that are listed in the repository, you can open the
Extension Manager and click the Get more extensions here link. You do
not need to download them separately as in step 1 above.
Note
367
Using extensions
This section describes a few of the extensions to Calc. In each case, you need to
install the extension as described in the previous section.
Professional Template Pack II
Provides more than 120 templates for Writer, Calc, and Impress. Available in
several languages. After you have installed this extension, you will find the
templates under File > New > Templates and Documents.
Solver for Nonlinear Programming
Calc ships with a solver engine for linear programming only. This extension adds
more solvers, which are capable of handling nonlinear problems as well as linear
ones:
368
Appendix
Keyboard Shortcuts
Introduction
You can use Calc without a pointing device such as a mouse or trackball, by using its
built-in keyboard shortcuts.
OOo has a general set of keyboard shortcuts, available in all components, and a
component-specific set directly related to the work of that component.
For help with OOos keyboard shortcuts or using OOo with a keyboard only, search
the OOo online help using the shortcut or accessibility keywords.
In addition to using the built-in keyboard shortcuts listed in this Appendix, you can
define your own. See Chapter 14 (Setting Up and Customizing Calc) for instructions.
Formatting and editing shortcuts are described in Chapter 2 (Entering, Editing, and
Formatting Data).
Effect
Ctrl+Home
Moves the cursor to the first cell in the sheet (cell A1).
Ctrl+End
Moves the cursor to the last cell on the sheet that contains
data.
Home
End
Ctrl+Left Arrow
Moves the cursor to the left edge of the current data range. If
the column to the left of the cell that contains the cursor is
empty, the cursor moves to the next column to the left that
contains data.
Ctrl+Right Arrow
Moves the cursor to the right edge of the current data range.
If the column to the right of the cell that contains the cursor is
empty, the cursor moves to the next column to the right that
contains data.
Ctrl+Up Arrow
Moves the cursor to the top edge of the current data range. If
the row above the cell that contains the cursor is empty, the
cursor moves up to the next row that contains data.
Ctrl+Down Arrow
Ctrl+Shift+Arrow
Selects all cells containing data from the current cell to the
end of the continuous range of data cells, in the direction of
the arrow pressed. If used to select rows and columns
together, a rectangular cell range is selected.
Ctrl+Page Up
370
Shortcut Keys
Effect
Ctrl+Page Down
Page Up
Page Down
Alt+Page Up
Alt+Page Down
Shift+Ctrl+Page Up
Shift+Ctrl+Page
Down
Ctrl+*
Ctrl+/
Selects the matrix formula range that contains the cursor. The
/ key is the division sign on the numeric key pad.
Enter in a
selected range
Effect
F1
Shift+F1
Ctrl+F1
F2
Switches to Edit mode and places the cursor at the end of the
contents of the current cell. If the cursor is in an input box in a
dialog that has a minimize button, the dialog is hidden and the
input box remains visible. Press F2 again to show the whole
dialog.
Ctrl+F2
Shift+Ctrl+F2
Moves the cursor to the input line where you can enter a
formula for the current cell.
Ctrl+F3
371
Shortcut Keys
Effect
F4
Shift+F4
F5
Shift+F5
Traces dependents.
Shift+Ctrl+F5
F7
Ctrl+F7
Shift+F7
Traces precedents.
F8
Ctrl+F8
F9
Ctrl+F9
F11
Opens the Styles and Formatting window where you can apply
a formatting style to the contents of the cell or to the current
sheet.
Shift+F11
Shift+Ctrl+F11
F12
Ctrl+F12
Effect
Alt+Down Arrow
Alt+Up Arrow
Alt+Right Arrow
Alt+Left Arrow
Alt+Shift+Arrow
Key
372
Note
The shortcuts listed in Table 29 do not work under any Linux desktop
tested. If you would like to have the functionality described in this table,
you must create custom key sequences as explained in Chapter 14
(Setting Up and Customizing Calc).
Note
The shortcut keys shown in Table 29 do not use the number keys on the
number pad. They use the number keys above the letter keys on the
main keyboard.
Effect
Ctrl+Shift+1
Ctrl+Shift+2
Ctrl+Shift+3
Ctrl+Shift+4
Ctrl+Shift+5
Ctrl+Shift+6
Standard format
373
DataPilot shortcuts
Table 33: DataPilot shortcut keys
Shortcut Keys
Effect
Tab
Shift+Tab
Up arrow
Down arrow
Moves the focus down one item in the current dialog area.
Left arrow
Moves the focus one item to the left in the current dialog area.
Right arrow
Moves the focus one item to the right in the current dialog
area.
Home
End
Alt+R
Alt+C
Alt+D
Ctrl+Up Arrow
Ctrl+Down Arrow
Ctrl+Left Arrow
Ctrl+Right Arrow
Ctrl+Home
Ctrl+End
Alt+O
Delete
374
Appendix
Description of Functions
Note
Functions whose names end with _ADD are provided for compatibility with
Microsoft Excel functions. They return the same results as the
corresponding functions in Excel (without the suffix), which though they
may be correct, are not based on international standards.
Mathematical functions
Table 34: Mathematical functions
Syntax
Description
ABS(number)
ACOS(number)
ACOSH(number)
376
Syntax
Description
ACOT(number)
ACOTH(number)
ASIN(number)
ASINH(number)
ATAN(number)
ATAN2(number_x;
number_y)
ATANH(number)
CEILING(number;
significance; mode)
COMBIN(count_1; count_2)
COMBINA(count_1;
count_2)
CONVERT(value; "text";
"text")
COS(number)
COSH(number)
COT(number)
COTH(number)
377
Syntax
Description
COUNTBLANK(range)
COUNTIF(range; criteria)
DEGREES(number)
EVEN(number)
EXP(number)
FACT(number)
FLOOR(number;
significance; mode)
GCD(numbers)
GCD_ADD(numbers)
INT(number)
ISEVEN(value)
ISODD(value)
LCM(integer_1;
integer_2; ... integer_30)
LCM_ADD(numbers)
LN(number)
378
Syntax
Description
LOG(number; base)
LOG10(number)
MOD(dividend; divisor)
MROUND(number;
multiple)
MULTINOMIAL
(number(s))
ODD(number)
PI()
POWER(base; power)
PRODUCT(number 1 to 30)
QUOTIENT(numerator;
denominator)
RADIANS(number)
RAND()
RANDBETWEEN (bottom;
top)
ROUND(number; count)
379
Syntax
Description
ROUNDDOWN(number;
count)
ROUNDUP(number; count)
SERIESSUM(x; n; m;
coefficients)
SIGN(number)
SIN(number)
SINH(number)
SQRT(number)
SQRTPI(number)
SUBTOTAL(function;
range)
SUM(number_1; number_2;
... number_30)
SUMIF(range; criteria;
sum_range)
380
Syntax
Description
SUMSQ(number_1;
number_2; ... number_30)
TAN(number)
TANH(number)
TRUNC(number; count)
If you enter it as 3.25, the function will treat it as a 325% interest rate.
Accounting systems vary in the number of days in a month or a year used in
calculations. The following table gives the integers used for the basis parameter
used in some of the financial analysis functions.
381
Calculation
0 or missing
Description
ACCRINT(issue; first_interest;
settlement; rate; par;
frequency; basis)
ACCRINTM(issue; settlement;
rate; par; basis)
AMORDEGRC(cost;
date_purchased; first_period;
salvage; period; rate; basis)
382
Syntax
Description
AMORLINC(cost;
date_purchased; first_period;
salvage; period; rate; basis)
COUPDAYBS(settlement;
maturity; frequency; basis)
COUPDAYS(settlement;
maturity; frequency; basis)
COUPDAYSNC(settlement;
maturity; frequency; basis)
COUPNCD(settlement;
maturity; frequency; basis)
COUPNUM(settlement;
maturity; frequency; basis)
383
Syntax
Description
COUPPCD(settlement;
maturity; frequency; basis)
CUMIPMT_ADD(rate; NPER;
PV; start_period; end_period;
type)
CUMPRINC_ADD(rate; NPER;
PV; start_period; end_period;
type)
384
Syntax
Description
DISC(settlement; maturity;
price; redemption; basis)
DOLLARDE(fractional _dollar;
fraction)
DOLLARFR(decimal _dollar;
fraction)
385
Syntax
Description
DURATION_ADD (settlement;
maturity; coupon; yield;
frequency; basis)
EFFECT_ADD(nominal _rate;
Npery)
EFFECTIVE(NOM; P)
FVSCHEDULE(principal;
schedule)
INTRATE(settlement;
maturity; investment;
redemption; basis)
386
Syntax
Description
IRR(values; guess)
ISPMT(rate; period;
total_periods; invest)
MDURATION(settlement;
maturity; coupon; yield;
frequency; basis)
MIRR(values; investment;
reinvest_rate)
NOMINAL(effective_rate;
Npery)
387
Syntax
Description
NOMINAL_ADD(effective_rate
; Npery)
NPV(Rate; value_1;
value_2; ... value_30)
ODDFPRICE(settlement;
maturity; issue; first_coupon;
rate; yield; redemption;
frequency; basis)
ODDFYIELD(settlement;
maturity; issue; first_coupon;
rate; price; redemption;
frequency; basis)
ODDLPRICE(settlement;
maturity; last_interest; rate;
yield; redemption; frequency;
basis)
388
Syntax
Description
ODDLYIELD(settlement;
maturity; last_interest; rate;
price; redemption; frequency;
basis)
PRICE(settlement; maturity;
rate; yield; redemption;
frequency; basis)
PRICEDISC(settlement;
maturity; discount;
redemption; basis)
389
Syntax
Description
PRICEMAT(settlement;
maturity; issue; rate; yield;
basis)
RECEIVED(settlement;
maturity; investment;
discount; basis)
390
Syntax
Description
TBILLEQ(settlement;
maturity; discount)
TBILLPRICE(settlement;
maturity; discount)
TBILLYIELD(settlement;
maturity; price)
391
Syntax
Description
YIELD(settlement; maturity;
rate; price; redemption;
frequency; basis)
YIELDDISC(settlement;
maturity; price; redemption;
basis)
YIELDMAT(settlement;
maturity; issue; rate; price;
basis)
392
Description
AVEDEV(number1;
number2; ... number_30)
AVERAGE(number_1;
number_2; ... number_30)
AVERAGEA(value_1;
value_2; ... value_30)
BETADIST(number; alpha;
beta; start; end)
BETAINV(number; alpha;
beta; start; end)
393
Syntax
Description
CHIDIST(number;
degrees_freedom)
CHIINV(number;
degrees_freedom)
CHITEST(data_B; data_E)
CONFIDENCE(alpha; STDEV;
size)
CORREL(data_1; data_2)
COVAR(data_1; data_2)
394
Syntax
Description
DEVSQ(number_1;
number_2; ... number_30)
EXPONDIST(number;
lambda; C)
FDIST(number;
degrees_freedom_1;
degrees_freedom_2)
FINV(number;
degrees_freedom_1;
degrees_freedom_2)
FISHER(number)
FISHERINV(number)
FORECAST(value; data_Y;
data_X)
FTEST(data_1; data_2)
GAMMADIST(number; alpha;
beta; C)
395
Syntax
Description
GAMMAINV(number; alpha;
beta)
GAMMALN(number)
GAUSS(number)
GEOMEAN(number_1;
number_2; ... number_30)
HARMEAN(number_1;
number_2; ... number_30)
HYPGEOMDIST(X; n_sample;
successes; n_population)
INTERCEPT(data_Y; data_X)
KURT(number_1;
number_2; ... number_30)
LARGE(data; rank_c)
LOGINV(number; mean;
STDEV)
396
Syntax
Description
LOGNORMDIST(number;
mean; STDEV)
MEDIAN(number_1;
number_2; ... number_30)
MODE(number_1;
number_2; ... number_30)
NEGBINOMDIST(X; R; SP)
NORMDIST(number; mean;
STDEV; C)
NORMINV(number; mean;
STDEV)
NORMSDIST(number)
NORMSINV(number)
397
Syntax
Description
PEARSON(data_1; data_2)
PERCENTILE(data; alpha)
PERCENTRANK(data; value)
PERMUT(count_1; count_2)
PERMUTATIONA(count_1;
count_2)
PHI(number)
POISSON(number; mean; C)
QUARTILE(data; type)
RSQ(data_Y; data_X)
SKEW(number_1;
number_2; ... number_30)
398
Syntax
Description
SLOPE(data_Y; data_X)
SMALL(data; rank_c)
STANDARDIZE(number;
mean; STDEV)
STDEV(number_1; number_2;
... number_30)
STDEVP(number_1;
number_2; ... number_30)
STEYX(data_Y; data_X)
TDIST(number;
degrees_freedom; mode)
TINV(number;
degrees_freedom)
TRIMMEAN(data; alpha)
399
Syntax
Description
Returns the probability associated with a Students tTest. Data_1 is the dependent array or range of data
for the first record. Data_2 is the dependent array or
range of data for the second record. Mode = 1
calculates the one-tailed test, Mode = 2 the twotailed test. Type of t-test to perform: paired (1), equal
variance (homoscedastic) (2), or unequal variance
(heteroscedastic) (3).
VARP(Number_1;
number_2; ... number_30)
VARPA(value_1; value_2; ..
.value_30)
WEIBULL(number; alpha;
beta; C)
400
Caution
Description
DATEVALUE("Text")
DAY(number)
DAYS(date_2; date_1)
DAYS360(date_1; date_2;
type)
DAYSINMONTH(date)
DAYSINYEAR(date)
EASTERSUNDAY(integer)
401
Syntax
Description
EDATE(start_date; months)
EOMONTH(start_date;
months)
HOUR(number)
ISLEAPYEAR(date)
MINUTE(number)
MONTH(number)
MONTHS(start_date;
end_date; type)
NETWORKDAYS(start _date;
end_date; holidays)
NOW()
SECOND(number)
TIMEVALUE(text)
402
Syntax
Description
TODAY()
WEEKDAY(number; type)
WEEKNUM(number; mode)
WEEKNUM_ADD(date;
return_type)
WEEKS(start_date; end_date;
type)
WEEKSINYEAR(date)
WORKDAY(start_date; days;
holidays)
YEAR(number)
YEARFRAC(start_date;
end_date; basis)
YEARS(tart_date; end_date;
type)
403
Logical functions
Use the logical functions to test values and produce results based on the result of the
test. These functions are conditional and provide the ability to write longer formulas
based on input or output.
Table 39: Logical functions
Syntax
Description
AND(logical_value_1;
logical_value_2;
...logical_value_30)
FALSE()
IF(test; then_value;
otherwise_value)
NOT(logical_value)
OR(logical_value_1;
logical_value_2;
...logical_value_30)
TRUE()
404
Informational functions
These functions provide information (or feedback) regarding the results of a test for a
specific condition, or a test for the type of data or content a cell contains.
Table 40: Informational functions
Syntax
Description
CELL(info_type; reference)
CURRENT()
FORMULA(reference)
ISBLANK(value)
ISERR(value)
ISERROR(value)
ISEVEN_ADD(number)
ISFORMULA(reference)
405
Syntax
Description
ISLOGICAL(value)
ISNA(value)
ISNONTEXT(value)
ISNUMBER(value)
ISODD_ADD(number)
ISREF(value)
ISTEXT(value)
N(value)
NA()
TYPE(value)
406
Database functions
This section deals with functions used with data organized as one row of data for one
record. The Database category should not be confused with the Base database
component in OpenOffice.org. A Calc database is simple a range of cells that
comprises a block of related data where each row contains a separate record. There
is no connection between a database in OpenOffice.org and the Database category in
OOo Calc.
The database functions use the following common arguments:
Note
Description
DAVERAGE(database;
database_field;
search_criteria)
DCOUNT(database;
database_field;
search_criteria)
DCOUNTA(database;
database_field;
search_criteria)
DGET(database;
database_field;
search_criteria)
407
Syntax
Description
DMAX(database;
database_field;
search_criteria)
DMIN(database;
database_field;
search_criteria)
DPRODUCT(database;
database_field;
search_criteria)
DSTDEV(database;
database_field;
search_criteria)
DSTDEVP(database;
database_field;
search_criteria)
DSUM(database;
database_field;
search_criteria)
DVAR(database;
database_field;
search_criteria)
DVARP(database;
database_field;
search_criteria)
Array functions
Table 42: Array functions
Syntax
Description
FREQUENCY(data;
classes)
Calculates the frequency distribution in a one-columnarray. The default value supply and the number of
intervals or classes are used to count how many values
are omitted on the single intervals. Data is the array of,
or reference to, the set of values to be counted. Classes
is the array of the class set.
408
Syntax
Description
GROWTH(data_Y; data_X;
new_data_X;
function_type)
LINEST(data_Y; data_X;
linear_type; stats)
LOGEST(data_Y; data_X;
function_type; stats)
MDETERM(array)
MINVERSE(array)
MMULT(array; array)
MUNIT(dimensions)
SUMPRODUCT(array 1;
array 2; ...array 30)
SUMX2MY2(array_X;
array_Y)
409
Syntax
Description
SUMX2PY2(array_X;
array_Y)
SUMXMY2(array_X;
array_Y)
TRANSPOSE(array)
TREND(data_Y; data_X;
new_data_X; linear_Type)
Spreadsheet functions
Use spreadsheet functions to search and address cell ranges and provide feedback
regarding the contents of a cell or range of cells. You can use functions such as
HYPERLINK() and DDE() to connect to other documents or data sources.
Table 43: Spreadsheet functions
Syntax
Description
AREAS(reference)
410
Syntax
Description
COLUMN(reference)
COLUMNS(array)
ERRORTYPE(reference)
HLOOKUP(search_criteria;
array; index; sorted)
HYPERLINK(URL) or
HYPERLINK(URL; cell_text)
411
Syntax
Description
INDIRECT(reference)
LOOKUP(search_criterion;
search_vector; result_vector)
MATCH(search_criterion;
lookup_array; type)
412
Syntax
Description
OFFSET(reference; rows;
columns; height; width)
ROW(reference)
ROWS(array)
SHEET(reference)
SHEETS(reference)
413
Syntax
Description
VLOOKUP(search_criterion;
array; index; sort_order)
Text functions
Use Calcs text functions to search and manipulate text strings or character codes.
Table 44: Text functions
Syntax
Description
ARABIC(text)
BASE(number; radix;
[minimum_length])
CHAR(number)
CLEAN(text)
CODE(text)
CONCATENATE(text_1;
text_2; ...; text_30)
414
Syntax
Description
DECIMAL(text; radix)
DOLLAR(value; decimals)
EXACT(text_1; text_2)
FIND(find_text; text;
position)
FIXED(number; decimals;
no_thousands_separator)
LEFT(text; number)
LEN(text)
415
Syntax
Description
LOWER(text)
PROPER(text)
REPLACE(text; position;
length; new_text)
REPT(text; number)
RIGHT(text; number)
ROMAN(number; mode)
ROT13(text)
416
Syntax
Description
SEARCH(find_text; text;
position)
SUBSTITUTE(text;
search_text; new text;
occurrence)
T(value)
TEXT(number; format)
TRIM(text)
UPPER(text)
VALUE(text)
Add-in functions
Table 45: Add-in functions
Syntax
Description
BESSELI(x; n)
417
Syntax
Description
BESSELJ(x; n)
BESSELK(x; n)
BESSELY(x; n)
BIN2DEC(number)
BIN2HEX(number; places)
BIN2OCT(number; places)
COMPLEX(real_num; i_num;
suffix)
CONVERT_ADD(number;
from_unit; to_unit)
DEC2BIN(number; places)
DEC2HEX(number; places)
DEC2OCT(number; places)
DELTA(number_1; number_2)
ERF(lower_limit; upper_limit)
418
Syntax
Description
ERFC(lower_limit)
FACTDOUBLE(number)
GESTEP(number; step)
HEX2BIN(number; places)
HEX2DEC(number)
HEX2OCT(number; places)
IMABS(complex_number)
IMAGINARY(complex _number)
IMARGUMENT(complex
_number)
IMCONJUGATE(complex
_number)
IMCOS(complex_number)
IMDIV(numerator;
denominator)
IMEXP(complex_number)
IMLN(complex_number)
419
Syntax
Description
IMLOG10(complex _number)
IMLOG2(complex _number)
IMPOWER(complex _number;
number)
IMPRODUCT(complex _number;
complex_number_1; ...)
IMREAL(complex _number)
IMSIN(complex_number)
IMSQRT(complex_number)
IMSUB(complex_number_1;
complex_number_2)
IMSUM(complex_number;
complex_number_1; ...)
OCT2BIN(number; places)
OCT2DEC(number)
OCT2HEX(number; places)
420
Appendix
Calc Error Codes
422
Code
###
N/A
Err502
502
#NUM!
503
#VALUE
519
The formula within the cell returns a value that does not
correspond to the definition of the formula or functions
used. This error could also mean that the cell referenced
by the formula contains text instead of a number.
#REF!
524
The formula within the cell uses a reference that does not
exist. Either a column or row description name could not
be resolved, or the column, row, or sheet that contains a
referenced cell is missing.
#NAME?
525
#DIV/0!
532
423
Note
Code
Message
501
Invalid character
502
Invalid argument
503
Invalid floating
point operation
(cell displays
#NUM!)
504
Parameter list
error
505
Internal syntax
error
Not used.
506
Invalid semicolon
Not used.
507
Pair missing
Not used.
508
Pair missing
509
Missing operator
510
Missing variable
511
Missing variable
512
Formula overflow
424
Code
Message
513
String overflow
514
Internal overflow
515
Internal syntax
error
Not used.
516
Internal syntax
error
517
Internal syntax
error
518
Internal syntax
error
519
No result (cell
displays #VALUE)
520
Internal syntax
error
521
Internal syntax
error
No result.
522
Circular reference
523
The calculation
procedure does
not converge
524
Invalid references
(cell displays
#REF!)
525
526
Internal syntax
error
527
Internal overflow
425
Code
Message
528
531
Not used.
532
Division by zero
426
Index
3
3D chart
appearance 83
area chart 92
bar chart 90
choosing type 72
elements 74
formatting 82
illumination 84
pie chart 90
resizing 81
rotating interactively 84
rotation and perspective 82
A
absolute reference 170
advanced functions 192
anchor, visible 353
anchoring of objects 135
appearance of chart 83
appearance options 346
Apply Style list 14, 102
area chart 92
arguments 376
arguments in functions 176
arithmetic operators 164
array functions 408
arrow keys
navigating within spreadsheets 27
assign styles to shortcut keys 102
auto filters 322
AutoCorrect 46
AutoCorrect options 358
AutoInput 46
automatic changes, deactivating 46
automatic date conversion 46
automatic saving 22
axes labels 72
B
background
cell styles 104
bar chart 89
Base
editing data sources 277
borders
cell styles 104
bubble chart 94
C
Calc options
calculate 354
case sensitive 355
Index
changes 357
dates 355
grid 357
grid lines, viewing 353
guides while moving 353
handles 353
input settings 351
iterative references 355
page breaks, visible 353
screen display 353
sort lists 356
unit of measurement 351
updating links 351
Zoom 354
calculation options 354
calculation order 171
calculations
linking sheets 172
case sensitive sorting 65
cell alignment and orientation 57
cell protection 105
cell styles
alignment options 104
applying 101
background 104
border options 104
description 99, 100
Fill Format mode 101
font effects 104
font options 104
linked with 104
numbers 104
cells
description 10, 16
focus 26
hiding and showing 62
information on status bar 18
range 29
selecting 29
validating contents 50
changes
accepting or rejecting 293
adding comments 288
editing comments 289
options 357
recording 287
reviewing 291
viewing 292
chart
appearance 83
area 74
changing background 81
colors 82
creating 70
427
data labels 86
data labels 76
editing 74
elements 74
formatting 79, 82
graphic background 82
grids 73
mean value lines 78
moving elements 80
perspective 82
Position and Size dialog 88
resizing and moving 88
rotating interactively 84
rotation 82
titles 73
trend lines 77
types 89
Y error bars 78
chart elements 74
chart type 72, 74
chart wall 74
Chart Wizard 71
collaboration 284
color coding for input 184
color options 343
Color toolbar 126
column and line chart 97
column chart 89
columns
deleting 32
freezing 35
hiding and showing 62
inserting 32
selecting 30
comma separated values (CSV) 21, 24
comments
adding 290
editing 291
finding 291
formatting 291
comments on changes
adding 288
editing 289
comparative operators 164
comparing documents 295
concatenation operator 168
consolidating data 241
create document from template 109
creating new spreadsheets 18
cropping 126
CSV files 21, 24
custom sort order 65
customizing
Enter key 28
keyboard shortcuts 364
menus 359
toolbars 362
428
D
dashes, entering 45
data analysis
consolidating data 241
DataPilot 194
Goal Seek 254
introduction 241
Multiple Operations tool 249
scenarios 245
Solver 256
subtotals 243
data entry
keyboard 44
speeding up 46
data labels 86
data ranges 72
data series 73
data source
data to text 277
editing 276
editing using Base 277
linking 274
registering 274
using in OOo documents 277
viewing 276
data to text 277
database functions 407
database range 319
DataPilot
cell formatting 232
change layout 224
data fields 219
data sources 215
dialog 216
examples of use 194
filter 231
GETPIVOTDATA 236
group date or time values 226
group rows or columns 224
group scalar values 225
group without intervals 226
multiple data fields 232
page fields 224
preconditions 214
refresh 232
row or column fields 221
shortcuts 236
sort results 228
starting 215
DataPilot Tools 368
date functions 401
dates and times, entering 45
DDE link
description 281
in Calc 281
in Writer 282
default template 113
OpenOffice.org 3.3 Calc Guide
deleting
columns and rows 32
sheets 33
Detective 184
digital rights management (DRM) 155
digital signature 158
digital signature
status bar indicator 17
docking/floating windows 13
documents
comparing 295
merging 294
drag and drop 119
drag mode 40
drawing object properties 132
Drawing Object Properties toolbar 132
drawing objects
grouping 133
properties 132
resizing 133
Drawing toolbar 132
drawing tools 130
Dynamic Data Exchange (DDE) 281
E
e-mailing
several recipients 157
Writer document as attachment 157
editing data
changing part of the data in a cell 52
removing data from a cell 52
replacing all data in a cell 52
en and em dashes 45
Enter key 28
EPS images in PDF 151
Err:503 Division by zero 183
error codes
common messages 424
displayed within cells 423
introduction 422
error messages 182, 187
error-checking formulas 161
errors, finding and fixing 182
EuroOffice Solver 258
export directly as PDF 151
exporting to PDF 151
Extension Manager 113
extensions
DataPilot Tools 368
installing 367
introduction 366
Professional Template Pack 368
Solver for Nonlinear Programming 368
External Data dialog 270
F
FDF 153
Index
features 10
file sharing options 344
Fill Format mode 101
fill series
adding 47
defining 48
Fill tool 46
filled net or radar chart 96
filtering 322
filters
advanced 326
auto 322
standard 323
financial analysis functions 381
find and replace
cell styles 67
formulas or values 67
regular expressions 67
text 67
wildcards 67
fixed values 160
floating toolbars 12
focus 26
formatting
charts 79
data labels 86
symbols 87
formatting
autoformatting 59
cell background 58
cell borders 58
conditional 60
themes 60
formatting data
font 56
font effects 56
manual line breaks 54
multiple lines of text 53
numbers 55
shrinking text to fit cell 54
wrapping 53
Formatting toolbar 14
formula bar 15
formulas
absolute reference 170
breaking into parts 182
calculation examples 161
concatenation operator 168
definition 160
intersection operator 168
operator types 163
operators in 161
range operator 167
relative reference 169
strategies for creating 180
using the Basic editor to create 182
Function List 177
Function Wizard 15, 178
429
functions
add-in 417
ADDRESS 336
arguments 176, 309, 376
array 408
basic arithmetic 187
CEILING 190
CONCATENATE 165
COUNTIF 331
database 330, 407
date and time 401
date formats 381
definition 160
description 160
entering 161
examples 187
financial analysis 381
FLOOR 190
HLOOKUP 334
INDEX 338
INDIRECT 336
informational 405
logical 404
LOOKUP 334
macros 303
MATCH 334
mathematical 376
MROUND 190
nested 177
OFFSET 336
overview 175
ROUND 189
ROUNDDOWN 189
ROUNDUP 189
simple statistics 188
spreadsheet 410
statistical analysis 393
structure 176
SUBTOTAL 332
SUMIF 331
terminology 376
text 414
VLOOKUP 333
Gallery
Hide/Show button 122
opening 122
Goal Seek 254
graphic filters 125
graphics
adding 118
anchoring 135
arrangement 134
linking 120
positioning 133
resizing 128
transparency 126
430
H
headers and footers 106
Hide/Show button 122
hiding and showing data 61
HTML compatibility 349
hyperlinks
absolute 267
creating 268
Ctrl-click to activate 345
editing 270
relative 267
removing 270
I
illumination of chart 84
image map 136
images
adding 118
context menu 128
cropping 126
embedding 120
inserting from file 118
inserting from the clipboard 121
inserting from the Gallery 121
linking 120
modifying 123
resizing 128
rotating 128
informational functions 405
input settings options 351
insert mode 17
Insert Picture dialog 118
inserting
columns and rows 32
sheets 33
interest rates 381
intersection operator 168
navigation 370
resetting to default values 366
saving to a file 366
selection 370
L
layout settings
format 106
page layout 105
table alignment 106
line chart 93
linking to external data
External Data dialog 270
find required range 273
Navigator 271
load Basic code to edit 348
load/save options 347
logical functions 404
M
macro recorder 299
macro security options 345
macros 366
macros
accessing cells directly 310
arguments 308
arguments in functions 309
as Calc functions 303
introduction 299
organizing 303
recording 299
sorting data 311
main window, description 10
manual line breaks 54
margins 105
mathematical functions 376
menu bar 11
menu font, customizing 358
menus
adding commands 361
creating 360
customizing 359
modifying 360
modifying entries 361
merging documents 294
Microsoft Excel 23
Microsoft Office file conversion 349
moving from sheet to sheet 28
Multiple Operations tool 249
multiple sheets
introduction 260
setting up 260
N
named range 315
navigating within spreadsheets
cell reference 26
Index
focus 26
keyboard 27
methods 26
Navigator 26, 38
scenarios 248
nested functions 177
net chart 95
nonlinear programming solver 258
numbers as text 44
numbers, data entry 44
O
Object Linking and Embedding (OLE) 278
ODF plugin (Sun) 22
OLE object
linked 281
non-linked 280
other (Windows) 279
OpenDocument Format 347
opening spreadsheets 20
order of calculation 171
outline group controls 62
overlining 56
OXT extension 113
P
page breaks, visible 353
page style on status bar 17
page styles
applying 102
background 106
borders 106
description 99, 100
options 105
sheet settings 106
paper format 105
password protection 24
password-protect PDF 155
PDF
blank page export 153
digital rights management (DRM) 155
embed standard fonts 153
encrypt 155
EPS 151
export documents to 151
form 153
image compression and resolution 151
initial view selection 153
pages to export 151
password-protect 155
security settings 155
tagged 152
user interface settings 154
PDF Options dialog 151
PDF/A-1 152
picture context menu 128
Picture toolbar 123
431
pictures
linking 120
resizing 128
transparency 126
pie chart 90
Position and Size dialog 88
Position and Size of graphics 129
precision 355
prepare document for review 287
print file directly 139
print options 343
printer metrics 352
printing
choosing what to print 139
general options 140
multiple pages per sheet 140
page orientation 140
selecting what to print 141
Professional Template Pack 368
Properties dialog 41
protect a document 287
selecting 30
T
tear-off toolbars 12
template
associate spreadsheet with different
template 114
create spreadsheet from 109
delete 115
delete folder 115
description 99
edit 111
export 116
Extension Manager 113
Index
folder 115
import 116
move 115
organize 115
reset default 114
set custom template as default 114
update document styles from 112
text functions 414
text operators 164
text overflow 354
text, data entry 44
time functions 401
title bar 11
toolbars 12
adding commands 363
choosing icons for commands 363
creating 363
description 12
tooltip 12
track changes 286
transparency 126
U
underlining 56
unsaved changes indicator 17
URL Recognition 268
user data options 343
user interface, customizing 358
V
validating cell contents 50
value highlighting 353
VBA properties load/save options 348
versions
saving 295
viewing Calc 34
viewing data
filtering 63
hiding and showing 61
outline group controls 62
visible grid 358
W
wildcards 67
X
XML 348
XY chart 93
Y
Y error bars 78
Z
zoom
dialog 34
slider 18
433
434