GS5005 GettingStartedWithCalc
GS5005 GettingStartedWithCalc
Chapter 5
Getting Started with Calc
Using Spreadsheets in LibreOffice
Copyright
This document is Copyright © 2010–2016 by the LibreOffice Documentation Team. Contributors
are 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/4.0/), version 4.0 or later.
All trademarks within this guide belong to their legitimate owners.
Contributors
Jean Hollis Weber Peter Schofield David Michel
Hazel Russman Ron Faile Jr. Martin Saffron
John A Smith
Feedback
Please direct any comments or suggestions about this document to the Documentation Team’s
mailing list: [email protected]
Note: Everything you send to a mailing list, including your email address and any other personal
information that is written in the message, is publicly archived and cannot be deleted.
Acknowledgments
This chapter is based on Chapter 5 of Getting Started with OpenOffice.org 3.3. The contributors to
that chapter are:
Richard Barnes Richard Detwiler John Kane
Peter Kupfer Joe Sellman Jean Hollis Weber
Linda Worthington Michele Zarri
Note
If you want to use macros written in Microsoft Excel using the VBA macro code in
LibreOffice, you must first edit the code in the LibreOffice Basic IDE editor. See
Chapter 13 Getting Started with Macros and Calc Guide Chapter 12 Calc Macros.
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.
• File – contains commands that apply to the entire document; for example Open, Save,
Wizards, Export as PDF, Print, Digital Signatures and so on.
• Edit – contains commands for editing the document; for example Undo, Copy, Changes,
Fill, Plug-in and so on.
• View – contains commands for modifying how the Calc user interface looks; for example
Toolbars, Column & Row Headers, Full Screen, Zoom and so on.
• Insert – contains commands for inserting elements into a spreadsheet; for example Cells,
Rows, Columns, Sheets, Picture and so on.
• Format – contains commands for modifying the layout of a spreadsheet; for example Cells,
Page, Styles and Formatting, Alignment and so on.
• Tools – contains various functions to help you check and customize your spreadsheet, for
example Spelling, Share Document, Gallery, Macros and so on.
• Data – contains commands for manipulating data in your spreadsheet; for example Define
Range, Sort, Consolidate and so on.
• Window – contains commands for the display window; for example New Window, Split and
so on.
• Help – contains links to the help system included with the software and other
miscellaneous functions; for example Help, License Information, Check for Updates and so
on.
Formula bar
The Formula Bar is located at the top of the sheet in the Calc workspace. The Formula Bar is
permanently docked in this position and cannot be used as a floating toolbar. If the Formula Bar is
not visible, go to View on the Menu bar and select Formula Bar.
Going from left to right and referring to Figure 2, the Formula Bar consists of the following:
• Name Box – gives the current active cell reference using a combination of a letter and
number, for example A1. The letter indicates the column and the number indicates the row
of the selected cell.
• Function Wizard – opens a dialog from which you can search through a list of
available functions. This can be very useful because it also shows how the functions are
formatted.
• Sum – clicking on the Sum icon totals the numbers in the cells above the selected cell
and then places the total in the selected cell. If there are no numbers above the selected
cell, then the cells to the left are totaled.
• Function – clicking on the Function icon inserts an equals (=) sign into the selected cell
and the Input line, allowing a formula to be entered.
• Input line – displays the contents of the selected cell (data, formula, or function) and allows
you to edit the cell contents.
• You can also edit the contents of a cell directly in the cell itself by double-clicking on the
cell. When you enter new data into a cell, the Sum and Function icons change to Cancel
and Accept icons .
Note
In a spreadsheet the term “function” covers much more than just mathematical
functions. See the Calc Guide Chapter 7 Using Formulas and Functions for more
information.
Individual cells
The main section of the workspace in Calc displays the cells in the form of a grid. Each cell is
formed by the intersection of one column and one row in the spreadsheet.
At the top of the columns and the left end of the rows are a series of header boxes containing
letters and numbers. The column headers use an alpha character starting at A and go on to the
right. The row headers use a numerical character starting at 1 and go down.
These column and row headers form the cell references that appear in the Name Box on the
Formula Bar (Figure 2). If the headers are not visible on your spreadsheet, go to View on the Menu
bar and select Column & Row Headers.
Sheet tabs
In Calc you can have more than one sheet in a spreadsheet. At the bottom of the grid of cells in a
spreadsheet are sheet tabs indicating how many sheets there are in your spreadsheet. Clicking on
a tab enables access to each individual sheet and displays that sheet. An active sheet is indicated
with a white tab (default Calc setup). You can also select multiple sheets by holding down the Ctrl
key while you click on the sheet tabs.
To change the default name for a sheet (Sheet1, Sheet2, and so on), right-click on a sheet tab and
select Rename Sheet from the context menu. A dialog opens, in which you can type a new name
for the sheet. Click OK when finished to close the dialog.
To change the color of a sheet tab, right-click on the tab and select Tab Color from the context
menu to open the Tab Color dialog (Figure 3). Select your color and click OK when finished to
close the dialog. To add new colors to this color palette, see Chapter 14 Customizing LibreOffice
for more information.
Status bar
The Calc status bar (Figure 4) provides information about the spreadsheet as well as quick and
convenient ways to change some of its features. Most of the fields are similar to those in other
components of LibreOffice; see Chapter 1 Introducing LibreOffice in this guide and the Calc Guide
Chapter 1 Introducing Calc for more information.
Sidebar
The Calc Sidebar (View > Sidebar) is located on the right side of the window. It is a mixture of
toolbar and dialog and consists of five decks: Properties, Styles and Formatting, Gallery,
Navigator, and Functions. Each deck has a corresponding icon on the Tab panel to the right of the
sidebar, allowing you to switch between them.
The various options for importing CSV files into a Calc spreadsheet are as follows:
• Import
– Character Set – specifies the character set to be used in the imported file.
– Language – determines how the number strings are imported.
If Language is set to Default for CSV import, Calc will use the globally set language. If
Language is set to a specific language, that language will be used when importing
numbers.
– From Row – specifies the row where you want to start the import. The rows are visible
in the preview window at the bottom of the dialog.
Saving spreadsheets
To save a spreadsheet, see Chapter 1 Introducing LibreOffice for more details on how to save files
manually or automatically. Calc can also save spreadsheets in a range of formats and also export
spreadsheets to PDF, HTML and XHTML file formats; see the Calc Guide Chapter 6 Printing,
Exporting, and E-mailing for more information.
Saving spreadsheets | 13
6) Click Save.
7) Each time you click Save, the Confirm File Format dialog opens (Figure 8). Click Use
[xxx] Format to continue saving in your selected spreadsheet format or click Use ODF
Format to save the spreadsheet in Calc ODS format.
8) If you select Text CSV format (*.csv) for your spreadsheet, the Export Text File dialog
(Figure 9) opens allowing you to select the character set, field delimiter, text delimiter and
so on to be used for your CSV file.
Tip
To have Calc save documents by default in a file format other than the default ODF
format, go to Tools > Options > Load/Save > General. In Default file format and
ODF settings > Document type, select Spreadsheet, then in Always save as, select
your preferred file format.
Cell navigation
When a cell is selected or in focus, the cell borders are emphasized. When a group of cells is
selected, the cell area is colored. The color of the cell border emphasis and the color of a group of
selected cells depends on the operating system being used and how you have set up LibreOffice.
• Using the Navigator – click on the Navigator icon on the Standard toolbar or press
the F5 key to open the Navigator dialog (Figure 10) or click the Navigator Tab button in
the open Sidebar. Type the cell reference into the Column and Row fields and press the
Enter key.
• Using the Enter key – pressing Enter moves the cell focus down in a column to the next
row. Pressing Shift+Enter moves the focus up in a column to the next row.
• Using the Tab key – pressing Tab moves the cell focus right in a row to the next column.
Pressing Shift+Tab moves the focus to the left in a row to the next column.
• Using the arrow keys – pressing the arrow keys on the keyboard moves the cell focus in
the direction of the arrow pressed.
Sheet navigation
Each sheet in a spreadsheet is independent of the other sheets in a spreadsheet, though
references can be linked from one sheet to another sheet. There are three ways to navigate
between different sheets in a spreadsheet.
• Using the Navigator – when the Navigator is open (Figure 10), double-clicking on any of
the listed sheets selects the sheet.
Note
When you insert a new sheet into your spreadsheet, Calc automatically uses the next
number in the numeric sequence as a name. Depending on which sheet is open when
you insert a new sheet, and the method you use to insert a new sheet, the new sheet
may not be in numerical order. It is recommended to rename sheets in your
spreadsheet to make them more recognizable.
Keyboard navigation
Pressing a key or a combination of keys allows you to navigate a spreadsheet using the keyboard.
A key combination is where you press more than one key together, for example Ctrl+Home key
combination to move to cell A1. Table 1 lists the keys and key combinations you can use for
spreadsheet navigation in Calc.
Selecting cells
Single cell
Left-click in the cell. You can verify your selection by looking in the Name Box on the Formula Bar
(Figure 2 on page 8).
Tip
You can also select a contiguous range of cells by first clicking in the Selection mode
field on the Status Bar (Figure 4 on page 10) and selecting Extending selection
before clicking in the opposite corner of the range of cells. Make sure to change back
to Standard selection or you may find yourself extending a cell selection
unintentionally.
Tip
You can also directly select a range of cells using the Name Box. Click into the Name
Box on the Formula Bar (Figure 2 on page 8). To select a range of cells, enter the cell
reference for the upper left-hand 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.
Entire sheet
To select the entire sheet, click on the small box between the column headers and the row headers
(Figure 14), or use the key combination Ctrl+A to select the entire sheet, or go to Edit on the Menu
bar and select Select All.
Single sheet
Click on the sheet tab for the sheet you want to select. The tab for the selected sheet becomes
white (default Calc setup).
All sheets
Right-click a sheet tab and choose Select All Sheets from the context menu.
Note
When you insert a column, it is inserted to the left of the highlighted column. When you
insert a row, it is inserted above the highlighted row.
When you insert columns or rows, the cells take the formatting of the corresponding
cells in the next column to left or the row above.
Alternatively:
1) Click in the column or header to select the column or row.
2) Go to Edit on the Menu bar and select Delete Cells or right-click and select Delete
Columns or Delete Rows from the context menu.
Caution
When you move or copy to another spreadsheet or a new spreadsheet, a conflict may
occur with formulas linked to other sheets in the previous location.
Deleting sheets
To delete a single sheet, right-click on the sheet tab you want to delete and select Delete Sheet
from the context menu, or go to Edit > Sheet > Delete from on the Menu bar. Click Yes to confirm
the deletion.
Renaming sheets
By default, the name for each new sheet added is SheetX, where X is the number of the next sheet
to be added. While this works for a small spreadsheet with only a few sheets, it can become
difficult to identify sheets when a spreadsheet contains many sheets.
You can rename a sheet using one of the following methods:
• Enter the name in the Name text box when you create the sheet using the Insert Sheet
dialog (Figure 16 on page 22).
• Right-click on a sheet tab and select Rename Sheet from the context menu to replace the
existing name with a different one.
• Double-click on a sheet tab to open the Rename Sheet dialog.
Note
Sheet names must start with either a letter or a number; other characters including
spaces are not allowed. Apart from the first character of the sheet name, permitted
characters are letters, numbers, spaces, and the underscore character. Attempting to
rename a sheet with an invalid name will produce an error message.
Viewing Calc
Unfreezing
To unfreeze rows or columns, go to Window on the Menu bar and uncheck Freeze. The heavier
lines indicating freezing will disappear.
Viewing Calc | 25
Splitting horizontally and vertically
1) Click in the cell that is immediately below the rows where you want to split the screen
horizontally and immediately to the right of the columns where you want to split the screen
vertically.
2) Go to Window on the Menu bar and select Split. Heavy black lines appear between the
rows or columns indicating where the split has been placed.
Numbers
Click in the cell and type in a number using the number keys on either the main keyboard or
numeric keypad. By default, numbers are right aligned in a cell.
Minus numbers
To enter a negative number, either type a minus (–) sign in front of the number or enclose the
number in parentheses (), for example (1234). The result for both methods of entry will be the
same, for example -1234.
Leading zeroes
To retain a minimum number of integer characters in a cell when entering numbers in order to
retain the number format, for example 1234 and 0012, leading zeros have to be added using one
of the following methods:
2) Make sure the Numbers tab is selected then select Number in the Category list.
3) In Options > Leading Zeros, enter the minimum number of characters required. For
example, for four characters, enter 4. Any number less than four characters will have
leading zeros added, for example 12 becomes 0012.
4) Click OK. The number entered retains its number format and any formula used in the
spreadsheet will treat the entry as a number in formula functions.
Method 2
1) Select the cell.
2) Open the Sidebar (View > Sidebar) and click the Open Panel (+) icon on the Number
Format panel to open it.
3) Select Number in the Category list box.
4) Set the Leading zeroes value box to 4. Formatting is applied immediately.
Numbers as text
Numbers can also be entered as text using one of the following methods.
Method 1
1) With the cell selected, right-click on the cell and select Format Cells from the context menu
or go to Format > Cells on the Menu bar or use the keyboard shortcut Ctrl+1 to open the
Format Cells dialog (Figure 21).
2) Make sure the Numbers page is selected, then select Text from the Category list.
3) Click OK and the number, when entered, is converted to text and, by default, left aligned.
Method 2
1) Select the cell.
2) Open the Sidebar (View > Sidebar) and click the Open Panel (+) icon on the Number
Format panel.
3) Select Text in the Category list box. Formatting is applied to the cell immediately.
4) Click back on the cell. Enter the number and move focus from the cell to have the data
formatted.
Note
Any numbers that have been formatted as text in a spreadsheet will be treated as a
zero by any formulas used in the spreadsheet. Formula functions will ignore text
entries.
Text
Click in the cell and type the text. By default, text is left-aligned in a cell.
Autocorrection options
Calc automatically applies many changes during data input using autocorrection, unless you have
deactivated any autocorrect changes. You can also undo any autocorrection changes by using the
keyboard shortcut Ctrl+Z or manually by going back to the change and replacing the autocorrection
with what you want to actually see.
To change the autocorrect options, go to Tools > AutoCorrect Options on the Menu bar to open
the AutoCorrect dialog (Figure 24).
Replace
Edits the replacement table for automatically correcting or replacing words or abbreviations in your
document.
Exceptions
Specify the abbreviations or letter combinations that you do not want LibreOffice to correct
automatically.
Options
Select the options for automatically correcting errors as you type and then click OK.
Localized options
Specify the AutoCorrect options for quotation marks and for options that are specific to the
language of the text.
Reset
Resets modified values back to the LibreOffice default values.
2) Select the individual sheets where you want the information to be repeated. Use the Shift
and Ctrl (Options on Mac) keys to select multiple sheets.
3) Click OK to select the sheets and the sheet tabs will change color.
4) Enter the information in the cells on the first sheet where you want it to appear and it will be
repeated in all the selected sheets.
Note
This technique automatically overwrites, without any warning, any information that is
already in the cells on the selected sheets. Make sure you deselect the additional
sheets when you are finished entering information that is going to be repeated before
continuing to enter data into your spreadsheet.
Editing data
Deleting data
Editing data
Sometimes it is necessary to edit the contents of cell without removing all of the data from the cell.
For example, changing the phrase “Sales in Qtr. 2” to “Sales rose in Qtr” can be done as follows.
Formatting data
Note
All the settings discussed in this section can also be set as a part of the cell style. See
the Calc Guide Chapter 4 Using Styles and Templates in Calc for more information.
Automatic wrapping
To automatically wrap multiple lines of text in a cell, use one of the following methods.
Method 1
1) Right-click on the cell and select Format Cells from the context menu, or go to Format >
Cells on the Menu bar, or press Ctrl+1, to open the Format Cells dialog.
2) Click on the Alignment tab (Figure 30).
Formatting data | 35
3) Under Properties, select Wrap text automatically and click OK.
Method 2
1) Select the cell.
2) Open the Sidebar (View > Sidebar) and click the Open Panel (+) icon on the Alignment
panel.
3) Select the Wrap text option to apply the formatting immediately.
Formatting numbers
Several different number formats can be applied to cells by using icons on the Formatting toolbar
(highlighted in Figure 32). Select the cell, then click the relevant icon to change the number format.
For more control or to select other number formats, use the Numbers page of the Format Cells
dialog (Figure 21 on page 27):
• Apply any of the data types in the Category list to the data.
• Control the number of decimal places and leading zeros in Options.
• Enter a custom format code.
• The Language setting controls the local settings for the different formats such as the date
format and currency symbol.
Some number formats are available from the Sidebar’s Number Format panel in the Properties
deck. Click the More Options button to open the Format Cells dialog described above.
Formatting a font
To quickly select a font and format it for use in a cell:
1) Select the cell.
2) Click the small triangle on the right of the Font Name box on the Formatting toolbar
(highlighted in Figure 34) and select a font from the drop-down list.
3) Click on the small triangle on the right of the Font Size on the Formatting toolbar and select
a font size from the drop down list.
4) To change the character format, click on the Bold, Italic, or Underline icons.
Formatting data | 37
5) To change the paragraph alignment of the font, click on one of the four alignment icons
(Left, Center, Right, Justified) .
6) To change the font color, click the arrow next to the Font Color icon to display the color
palette, then select the desired color.
The Properties deck of the Sidebar has two panels, Character and Alignment, which between
them contain all the formatting controls from the Formatting toolbar.
To specify the language used in the cell, open the Font page on the Format Cells dialog. You can
also select the More Options button on either of the Sidebar panels to open the Format Cells
dialog. Changing language in a cell allows different languages to be used within the same
document.
Use the Font Effects tab on the Format Cells dialog to set other font characteristics. See the Calc
Guide Chapter 4 Using Styles and Templates in Calc for more information.
Note
Cell border properties apply only to the selected cells and can only be changed if you
are editing those cells. For example, if cell C3 has a top border, that border can only be
removed by selecting C3. It cannot be removed in C2 despite also appearing to be the
bottom border for cell C2.
Using AutoFormat
You can use Calc’s AutoFormat feature to format a group of cells quickly and easily.
1) Select the cells in at least three columns and rows, including column and row headers, that
you want to format.
2) Go to Format > AutoFormat on the Menu bar to open the AutoFormat dialog (Figure 35).
3) Select the type of format and format color from the list.
4) If necessary, click More to open Formatting if Formatting is not visible.
5) Select the formatting properties to be included in the AutoFormat function.
6) Click OK.
Using themes
Calc comes with a predefined set of formatting themes that you can apply to spreadsheets. It is not
possible to add themes to Calc and they cannot be modified. However, you can modify their styles
Using themes | 39
after you apply them to a spreadsheet and the modified styles are only available for use for that
spreadsheet when you save the spreadsheet.
To apply a theme to a spreadsheet:
1) Click the Choose Themes icon in the Tools toolbar. If this toolbar is not visible, go to
View > Toolbars on the Menu bar and select Tools, and the Theme Selection dialog
(Figure 36) opens. This dialog lists the available themes for the whole spreadsheet.
2) Select the theme that you want to apply. As soon as you select a theme, the theme styles
are applied to the spreadsheet and are immediately visible.
3) Click OK.
4) If you wish, you can now open the Styles and Formatting window to modify specific styles.
These modifications do not modify the theme; they only change the appearance of the style
in the specific spreadsheet you are creating.
Showing data
To show hidden sheets, rows, and columns:
1) Select the sheets, rows or columns each side of the hidden sheet, row or column.
2) Go to Format on the Menu bar and select Sheet, Row or Column.
3) Select Show from the menu and the sheet, row or column will be displayed and can be
printed.
4) Alternatively, right-click on the sheet tabs, row headers or column headers and select Show
from the context menu.
To show hidden data in cells:
1) Go to Tools > Protect Document and select Sheet from the menu options.
2) Enter the password to unprotect the sheet and click OK.
3) Go to Format > Cells on the Menu bar, or right-click and select Format Cells from the
context menu, or use the keyboard shortcut Ctrl+1 to open the Format Cells dialog.
4) Click the Cell Protection tab (Figure 38) and deselect the hide options for the cells.
5) Click OK.
Sorting records
Sorting within Calc arranges the cells in a sheet using the sort criteria that you specify. Several
criteria can be used and a sort applies each criteria consecutively. Sorts are useful when you are
searching for a particular item and become even more useful after you have filtered data.
Also, sorting is useful when you add new information to your spreadsheet. When a spreadsheet is
long, it is usually easier to add new information at the bottom of the sheet, rather than adding rows
in their correct place. After you have added information, you then carry out a sort to update the
spreadsheet.
For more information on how to sort records and the sorting options available, see the Calc Guide
Chapter 2 Entering, Editing, and Formatting Data.
Analyzing data
Calc includes several tools to help you analyze 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.
One of the most useful of these tools is the PivotTable, which is used for combining, comparing,
and analyzing large amounts of data easily. Using the PivotTable, 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.
See the Calc Guide Chapter 8 Using Pivot Tables and Chapter 9 Data Analysis for more
information on pivot tables and other tools available in Calc to analyze your data.
Printing
Printing from Calc is much the same as printing from other LibreOffice components (see Chapter
10 Printing, Exporting, and Emailing in this guide). However, some details for printing in Calc are
different, especially regarding preparation for printing.
Print ranges
Print ranges have several uses, including printing only a specific part of the data or printing
selected rows or columns on every page. For more information about using print ranges, see the
Calc Guide Chapter 6 Printing, Exporting, and E-mailing.
Printing | 43
3) To check the print range, go to File > Page Preview on the Menu bar or click on the Page
Preview icon . LibreOffice will display the cells in the print range.
Note
The additional print range will print as a separate page, even if both ranges are on the
same sheet.
Printing options
To select the printing options for page order, details, and scale to be used when printing a
spreadsheet:
1) Go to Format > Page on the Menu bar to open the Page Style dialog (Figure 40).
2) Select the Sheet tab and make your selections from the available options.
3) Click OK.
For more information on printing options, see the Calc Guide Chapter 6 Printing, Exporting, and
E-mailing.
Page breaks
While defining a print range can be a powerful tool, it may sometimes be necessary to manually
adjust the Calc printout manually using a manual or page break. A page break helps to ensure that
your data prints properly according to your page size and page orientation. You can insert a
horizontal page break above or a vertical page break to the left of the active cell.
Printing | 45
For more information on manual breaks, see the Calc Guide Chapter 6 Printing, Exporting, and
E-mailing.
Inserting a break
To insert a page break:
1) Navigate to the cell where the page break will begin.
2) Go to Insert > Page Break on the Menu bar.
3) Select Row Break to create a page break above the selected cell.
4) Select Column Break to create a page break to the left of the selected cell.
Note
Multiple manual row and column breaks can exist on the same page. When you want
to remove them, you have to remove each break individually.
Printing | 47