Copyright
This document is Copyright © 2026 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 ([Link] version 3 or later, or the Creative
Commons Attribution License ([Link] version 4.0 or later.
All trademarks within this guide belong to their legitimate owners.
Contributors
To this edition
Olivier Hallot, Regina Henschel, Ed Olson, B. Antonio Fernández.
To previous editions
Dione Maddern, Vasudev Narayanan, Mike Kaganski, Celia Palacios Tagle, Lisa Samy, Claire Wood, Ed
Olson, Skip Masonsmith, flywire, Kees Kriek, Steve Fanning, Jenna Sargent, Olivier Hallot, Pulkit Krishna,
Jean Hollis Weber, Dan Lewis, Peter Schofield, Jochen Schiffers, Robert Großkopf, Jost Lange, Martin
Fox, Hazel Russman, Steve Schwettman, Alain Romedenne, Andrew Pitonyak, Jean-Pierre Ledure, Drew
Jensen, Randolph Gamo.
Feedback
Please direct any comments or suggestions about this document to the Documentation Team’s
forum at [Link] (registration is
required) or email: loguides@[Link].
Note
Everything you send to a forum, including your email address and any other
personal information that is written in the message, is publicly archived and
cannot be deleted. Emails sent to the forum are moderated.
Publication date and software version
Published February 2026. Based on LibreOffice 26.2.
Other versions of LibreOffice may differ in appearance and functionality.
Documentation for LibreOffice is available at [Link]
Contents
Copyright.....................................................................................................................................2
Preface...............................................................................................................................9
Who is this book for?................................................................................................................10
What’s in this book?.................................................................................................................. 10
Where to get more help............................................................................................................10
What you see may be different................................................................................................. 12
Using LibreOffice on macOS.................................................................................................... 13
What are all these things called?..............................................................................................14
Frequently asked questions......................................................................................................15
What's new in this guide........................................................................................................... 16
Chapter 1 Introduction....................................................................................................17
What is Calc?............................................................................................................................ 18
Spreadsheets, sheets, and cells...............................................................................................18
Calc main window.....................................................................................................................18
Creating, opening, and saving spreadsheets............................................................................26
Password protection................................................................................................................. 30
Navigating within spreadsheets................................................................................................ 31
Selecting items in a spreadsheet..............................................................................................35
Working with columns and rows............................................................................................... 38
Working with sheets.................................................................................................................. 40
Viewing a spreadsheet..............................................................................................................42
Using the Navigator.................................................................................................................. 45
Using document properties.......................................................................................................46
Chapter 2 Entering and Editing Data.............................................................................51
Introduction............................................................................................................................... 52
Entering data.............................................................................................................................52
Accelerating data entry............................................................................................................. 59
Merging and splitting cells.........................................................................................................65
Sharing content between sheets...............................................................................................66
Validating cell contents.............................................................................................................67
Modifying data...........................................................................................................................71
Group and outline..................................................................................................................... 75
Filtering..................................................................................................................................... 77
Sorting records..........................................................................................................................82
Handling duplicate records.......................................................................................................85
Find and replace....................................................................................................................... 86
Searching and filtering with regular expressions...................................................................... 90
Chapter 3 Formatting Data.............................................................................................95
Introduction............................................................................................................................... 96
Formatting data......................................................................................................................... 96
AutoFormat of cells and sheets..............................................................................................103
Value highlighting.................................................................................................................... 104
Using conditional formatting....................................................................................................104
Hiding and showing data......................................................................................................... 115
Chapter 4 Using Styles and Templates.......................................................................119
Introduction to styles...............................................................................................................120
Calc style types....................................................................................................................... 120
Applying cell styles..................................................................................................................121
Applying page styles...............................................................................................................124
Creating styles........................................................................................................................ 125
Calc Guide 26.2 | 3
Using themes.......................................................................................................................... 138
Managing styles...................................................................................................................... 140
Introduction to Templates........................................................................................................ 141
Using a template to create a spreadsheet.............................................................................. 142
Creating a template.................................................................................................................143
Editing a template................................................................................................................... 144
Changing the template assigned to a document....................................................................145
Adding templates obtained from other sources...................................................................... 145
Setting the default template.................................................................................................... 147
Organizing templates..............................................................................................................148
Chapter 5 Using Images and Graphics.......................................................................151
Introduction............................................................................................................................. 152
Adding graphics to a spreadsheet..........................................................................................152
Modifying images.................................................................................................................... 156
Positioning, resizing, and arranging images...........................................................................158
Using LibreOffice’s drawing tools............................................................................................161
Additional tools........................................................................................................................164
Using Fontwork....................................................................................................................... 164
Generating a QR or Barcode.................................................................................................. 165
Chapter 6 Creating Charts and Graphs.......................................................................167
Introduction............................................................................................................................. 168
Chart Wizard........................................................................................................................... 168
Using the Sidebar to change chart settings............................................................................175
Modifying charts...................................................................................................................... 176
Selecting and moving chart elements.....................................................................................180
Changing chart type................................................................................................................ 181
Titles, subtitles, and axis names............................................................................................. 182
Legends.................................................................................................................................. 183
Formatting chart backgrounds................................................................................................ 185
Data range and series.............................................................................................................186
Axes........................................................................................................................................ 194
Data labels.............................................................................................................................. 201
Chart Data Tables................................................................................................................... 205
Grids....................................................................................................................................... 208
3D charts.................................................................................................................................209
Trend and mean value lines....................................................................................................213
Error bars................................................................................................................................ 218
Adding drawing objects to charts............................................................................................221
Resizing, moving, and positioning charts................................................................................223
Selecting multiple charts.........................................................................................................227
Copying, exporting, and deleting charts..................................................................................228
Chapter 7 Gallery of Chart Types.................................................................................231
Introduction............................................................................................................................. 232
Column charts......................................................................................................................... 232
Bar charts................................................................................................................................233
Pie charts................................................................................................................................ 233
Of-Pie charts........................................................................................................................... 235
Area charts..............................................................................................................................237
Line charts.............................................................................................................................. 239
Scatter or XY charts................................................................................................................ 241
Bubble charts.......................................................................................................................... 243
Net charts................................................................................................................................244
Stock charts............................................................................................................................ 246
4 | Calc Guide 26.2
Column and line charts........................................................................................................... 249
Pivot charts............................................................................................................................. 250
Create box plots with whiskers in Calc...................................................................................250
Sparklines............................................................................................................................... 252
Chapter 8 Printing, Exporting, Emailing, and Signing..............................................259
Printing.................................................................................................................................... 260
Using print ranges................................................................................................................... 264
Page breaks............................................................................................................................ 269
Printing options for page styles............................................................................................... 270
Headers and footers............................................................................................................... 271
Exporting to PDF.....................................................................................................................274
Exporting to other formats.......................................................................................................281
Emailing spreadsheets............................................................................................................282
Digital signing of documents...................................................................................................282
Removing personal data.........................................................................................................285
Chapter 9 Using Formulas and Functions..................................................................287
Introduction............................................................................................................................. 288
About Calculations.................................................................................................................. 288
Setting up a spreadsheet........................................................................................................290
Creating formulas....................................................................................................................291
Understanding functions......................................................................................................... 307
Strategies for creating formulas and functions........................................................................314
Investigating and Resolving Formula Errors...........................................................................316
Examples of functions............................................................................................................. 320
Volatile / non-volatile functions................................................................................................322
Using wildcards and regular expressions in functions............................................................323
Advanced functions.................................................................................................................326
Chapter 10 Using Pivot Tables.....................................................................................327
Introduction............................................................................................................................. 328
The Pivot Table Layout dialog................................................................................................. 331
Working with the results of the pivot table.............................................................................. 343
Using pivot table results elsewhere........................................................................................355
Pivot charts............................................................................................................................. 357
Chapter 11 Data Analysis..............................................................................................361
Introduction............................................................................................................................. 362
Consolidating data.................................................................................................................. 362
Creating subtotals................................................................................................................... 365
Using scenarios...................................................................................................................... 371
Using the Multiple Operations tool..........................................................................................374
Using Goal Seek..................................................................................................................... 380
Using the Solver......................................................................................................................382
Using Statistics tools............................................................................................................... 388
Chapter 12 Linking Data...............................................................................................409
Using multiple sheets.............................................................................................................. 410
Referencing other documents................................................................................................. 417
Using hyperlinks and URLs.....................................................................................................418
Linking to external data........................................................................................................... 424
Linking to registered data sources..........................................................................................431
Embedding spreadsheets....................................................................................................... 436
XML Source............................................................................................................................ 442
Direct import of JSON and XML files......................................................................................445
Chapter 13 Sharing and Reviewing Spreadsheets....................................................447
Calc Guide 26.2 | 5
Introduction............................................................................................................................. 448
Sharing spreadsheets............................................................................................................. 448
Reviewing documents............................................................................................................. 450
Merging documents................................................................................................................ 456
Comparing documents............................................................................................................ 457
Saving versions.......................................................................................................................457
Chapter 14 Macros........................................................................................................461
Introduction............................................................................................................................. 462
On Visual Basic for Applications (VBA) compatibility..............................................................462
Using the macro recorder.......................................................................................................462
Write your own functions.........................................................................................................466
Accessing cells directly...........................................................................................................473
Overview of BeanShell, JavaScript, and Python macros........................................................475
ScriptForge library...................................................................................................................478
Built-in object inspector........................................................................................................... 479
Working with VBA macros.......................................................................................................480
Conclusion.............................................................................................................................. 482
Chapter 15 Calc as a Database....................................................................................483
Introduction............................................................................................................................. 484
Associating a range with a name............................................................................................485
Using the Data Provider Tool to Load Data in Spreadsheets..................................................490
Fetching data from data sources............................................................................................492
Referencing in a Calc Database Table....................................................................................493
Sorting a block of cells............................................................................................................ 496
Filtering................................................................................................................................... 496
Useful database-like functions................................................................................................500
Chapter 16 Setting up and Customizing.....................................................................509
Introduction............................................................................................................................. 510
LibreOffice options..................................................................................................................510
Options for loading and saving documents.............................................................................515
Calc specific options............................................................................................................... 518
Default colors for charts..........................................................................................................531
Customizing the user interface...............................................................................................532
Assigning macros to events....................................................................................................540
Adding functionality with extensions....................................................................................... 540
Adding custom colors..............................................................................................................542
Setting up document themes.................................................................................................. 543
Chapter 17 User Interface Variants..............................................................................545
Introduction............................................................................................................................. 546
Selecting the user interface....................................................................................................547
Standard interfaces................................................................................................................. 547
Contextual Single.................................................................................................................... 548
Tabbed interface..................................................................................................................... 548
Tabbed Compact interface......................................................................................................561
Groupedbar Compact interface...............................................................................................561
Appendix A Keyboard Shortcuts.................................................................................565
Introduction............................................................................................................................. 566
Combined Shortcut Reference................................................................................................566
Appendix B Error Codes...............................................................................................575
Introduction to Calc error codes.............................................................................................. 576
Error codes displayed within cells........................................................................................... 577
General error codes................................................................................................................ 578
6 | Calc Guide 26.2
Calc Error Functions............................................................................................................... 580
Calc Guide 26.2 | 7
Calc Guide 26.2
Preface
Who is this book for?
This book is for beginner to advanced users of Calc, the spreadsheet component of LibreOffice.
You may be new to spreadsheet software, or you may be familiar with another program. If you
have never used LibreOffice before, or you want an introduction to all of its components, you
might like to read the Getting Started Guide first. If you have never used spreadsheets before,
you might also like to read a book or find some tutorials about the use of spreadsheets.
What’s in this book?
This book introduces the features and functions of LibreOffice Calc. It is not a tutorial on using
spreadsheets. Some chapters assume familiarity with basic spreadsheet usage when describing
how to use Calc.
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 data and observing the results without having to retype all the data.
Functions can be used to create formulas to perform complex calculations on data.
Some other features provided by Calc include:
• Database functions, to arrange, store, and filter data.
• Data statistics tools, to perform complex data analysis.
• Dynamic charts: a wide range of 2D, 3D charts, and sparklines
• Ability to open, edit, and save Microsoft Excel and other spreadsheets.
• Import and export of spreadsheets from multiple formats, including HTML, CSV, and
Data Interchange Format.
Where to get more help
This book, the other LibreOffice user guides, the built-in Help system, and user support systems
assume that you are familiar with your computer and basic functions such as starting a program,
opening and saving files.
Help system
LibreOffice comes with an extensive online Help system. This is the first line of support for using
LibreOffice. Windows and Linux users can choose to download and install the offline Help for
use when not connected to the Internet; the offline Help is installed with the program on macOS.
To display the Help system, press F1 or select Help > LibreOffice Help from the Menu bar
(Figure 1). If you do not have the offline help installed on your computer, and you are connected
to the Internet, your default browser will open the online Help pages on the LibreOffice website.
The Help menu includes links to other LibreOffice information and support facilities.
Note
The following options indicated by a ‡ symbol are only accessible if your computer is
connected to the Internet.
10 | Calc Guide 26.2
Figure 1: The Help menu
• What’s This? – For quick tips when a toolbar is visible, place the mouse pointer over
any of the icons to see a small box (“tooltip”) with a brief explanation of the icon’s
function. For a more detailed explanation, select Help > What’s This? and hold the
pointer over the icon. In addition, you can choose whether to activate extended tips
using Tools > Options > LibreOffice > General > Extended tips.
• User Guides‡ – Opens your default browser at the English Documentation page of the
LibreOffice website [Link]
There you will find copies of user guides and other useful information.
• Show Tip of the Day – Opens a dialog showing a useful piece of information to help
expand your knowledge of LibreOffice.
• Search Commands – Opens a dialog where you can search for commands that are
present in the main menu and then run a selected command. More information about
this facility can be found in Chapter 1, Introduction.
• Get Help Online‡ – Opens your default browser at the Ask LibreOffice forum of
questions and answers from the LibreOffice community
[Link]
• Send Feedback‡ – Opens your default browser at the Feedback page of the LibreOffice
website [Link] From there you can report bugs,
suggest new features, and communicate with others in the LibreOffice community.
• Restart in Safe Mode – Opens a dialog where you can restart LibreOffice and reset the
software to its default settings.
• Get Involved‡ – Opens your default browser at the Get Involved page of the LibreOffice
website [Link] There you can choose a
topic of interest to help improve the program.
• Donate to LibreOffice‡ – Opens your default browser at the Support LibreOffice page
of the LibreOffice website [Link]
• License Information – Outlines the licenses under which LibreOffice is made available.
Preface | 11
• Check for Updates‡ – Opens a dialog and checks the LibreOffice website for updates
to your version of the software.
• About LibreOffice – Opens a dialog, which displays information about the version of
LibreOffice and the operating system you are using. This information will often be
requested if you ask the community for help or assistance with the software. A button is
provided to enable you to copy this information to the clipboard so that you can
subsequently paste it into a forum post, an email, or a bug report.
Other free online support
The LibreOffice community not only develops software, but provides free, volunteer-based
support. In addition to the Help menu links above, there are other online community support
options available, see Table 1.
Table 1: Free LibreOffice support
Resource Support
Answers to frequently asked questions
FAQs
[Link]
Free community support is provided by a network of experienced
Mailing lists users
[Link]
As in the mailing lists above, but through forum
Forum
[Link]
Free community assistance is provided in a question and answer
Questions & Answers formatted web service. Search similar topics or open a new one in
and [Link]
Knowledge Base The service is available in several other languages; click on the
language button to open a dialog for language selection.
The LibreOffice website in various languages
[Link]
Native language Mailing lists for native languages
support [Link]
Information about social networking
[Link]
Information about available accessibility options
Accessibility options
[Link]
Paid support and training
You can also pay for support through service contracts from a vendor or consulting firm
specializing in LibreOffice. For information about certified professional support, see The
Document Foundation’s website: [Link]
What you see may be different
Illustrations
LibreOffice runs on Windows, Linux, and macOS operating systems, each having several
versions and can be customized by users (fonts, colors, themes, window managers). The
illustrations in this guide were taken from a variety of computers and operating systems thus
causing some illustrations to appear differently from what you see on your computer display.
12 | Calc Guide 26.2
Also, some of the dialogs may be different because of the settings selected in LibreOffice. You
can either use dialogs from your computer’s operating system or from LibreOffice. The
differences affect mainly Open, Save, and Print dialogs. To change which dialogs are used, go to
Tools > Options > LibreOffice > General and select or deselect the option Use LibreOffice
dialogs.
Icons
The LibreOffice community has created icons for several icon sets: Breeze, Colibre, Elementary,
Karasa Jaga, Sifr, and Sukapura; some of these are also available in dark, SVG (Scalable
Vector Graphics), and SVG+dark versions. Each user can select a preferred set. The icons in
this guide have been taken from a variety of LibreOffice installations that use different sets of
icons. The icons for some of the many tools available in LibreOffice may then differ from the
ones used in this guide.
To change the icon set used, go to Tools > Options > LibreOffice > View. Choose from the
drop-down list under Icon Theme.
Note
The Galaxy, Oxygen, and Tango icon sets are no longer included as part of the
standard installation package. They can be added back by downloading and
installing the following extensions:
[Link]
[Link]
[Link]
Some of the previously included gallery backgrounds are now only available as an
extension from:
[Link]
Using LibreOffice on macOS
Some keystrokes and menu items are different on macOS from those used in Windows and
Linux. Table 2 gives some common substitutions for the instructions in this document. For a
more detailed list, see the application Help and Appendix A, Keyboard Shortcuts, to this guide.
Table 2: Example keystrokes for different environments
Windows or Linux macOS equivalent Effect
Tools > Options on
LibreOffice > Preferences Access to setup options
Menu bar
Ctrl+click and/or right-click
Right-click Opens a context menu
depending on computer setup
⌘ and/or Cmd or Command,
Ctrl or Control Used with other keys
depending on keyboard
⌥ and/or Alt or Option
Alt Used with other keys
depending on keyboard
F11 ⌘+T Open the Styles deck in the Sidebar
Preface | 13
What are all these things called?
The terms used in LibreOffice for most parts of the user interface (the parts of the program you
see and use, in contrast to the behind-the-scenes code that actually makes it work) are the
same as for most other programs.
A dialog is a special type of window. Its purpose is to inform you of something, or request input
from you, or both. It provides controls to use to specify how to carry out an action. The technical
names for common controls are shown in Figure 2. In most cases the technical terms are not
used in this book, but it is useful to know them because the Help and other sources of
information often use them.
In most cases, you can interact only with the dialog (not the document itself) as long as the
dialog remains open. When you close the dialog after use (usually, clicking OK or another button
saves your changes and closes the dialog), then you can again work with your document.
Some dialogs can be left open as you work, so you can switch back and forth between the
dialog and your document. An example of this type is the Find and Replace dialog.
Figure 2: Dialog showing common controls
(1) Tabbed page (not strictly speaking a control).
(2) Radio buttons (only one can be selected at a time).
(3) Checkbox (more than one can be selected at a time).
(4) Spin box (click the up and down arrows to change the number shown in the text box next to
it, or type in the text box).
(5) Thumbnail or preview.
(6) Drop-down list from which to select an item.
(7) Push buttons.
14 | Calc Guide 26.2
Frequently asked questions
How is LibreOffice Licensed?
LibreOffice is distributed under the Open Source Initiative (OSI) approved Mozilla Public
License (MPL). See [Link]
It is based on code from Apache OpenOffice made available under the Apache License
2.0 but also includes software that differs from version to version under a variety of
other Open Source licenses. New code is available under GNU Lesser General Public
License (LGPL) 3.0 and MPL 2.0.
May I distribute LibreOffice to anyone? May I sell it? May I use it in my business?
Yes.
How many computers may I install it on?
As many as you like.
Is LibreOffice available in my language?
LibreOffice has been translated (localized) into over 100 languages, so your language is
probably supported. Additionally, there are over 100 spelling, hyphenation, and
thesaurus dictionaries available for languages, and dialects that do not have a localized
program interface. The dictionaries are available by selecting the Dictionary tag filter
from the LibreOffice Extension Center [Link] .
How can you make it for free?
LibreOffice is developed and maintained by volunteers and has the backing of several
organizations.
Why do I need Java to run LibreOffice? Is it written in Java?
LibreOffice is not written in Java; it is mostly written in the C++ language. Java is one of
several languages that can be used to extend the software. The Java JRE (Java
Runtime Environment) is only required for some features. The most notable one is the
HSQLDB relational database engine used by the Base component of LibreOffice. For
Calc, Java is needed to run some of the solver engines described in Chapter 10, Data
Analysis.
Java is available at no cost. More information and download links to the appropriate
edition for your operating system can be found at: [Link] .
Note
If you want to use LibreOffice features that require Java it is important that the
correct 32 bit or 64 bit edition matches the installed version of LibreOffice.
How can I contribute to LibreOffice?
You can help with the development and user support of LibreOffice in many ways, and
you do not need to be a programmer. To start, check out this webpage:
[Link]
May I distribute the PDF of this book, or print and sell copies?
Yes, as long as you meet the requirements of one of the licenses in the copyright
statement at the beginning of this book. You do not have to request special permission.
We request that you share with the project some of the profits you make from sales of
books, in consideration of all the work we have put into producing them.
Donate to LibreOffice: [Link]
Preface | 15
What's new in this guide
Information about the LibreOffice 26.2 release can be found in these announcements:
[Link] and
[Link]
This book has been updated from Calc Guide 25.2. It covers changes that are visible in the Calc
user interface and changes in the behavior of the software.
Changes in chapters
• Chapter 1 - Added information on CSV import.
• Chapter 2 - Natural sort details.
• Chapter 6 - Added information on data table in format menu.
• Chapter 8 - Update PDF features, export dialogs and versions.
• Chapter 9 - Added information on quick naming ranges
• Chapter 12 - Direct import of XML and JSON files
• Chapter 15 - Added information on Data provider and new database related functions.
Moved sort data to chapter 2.
• Appendix A - Keyboard Shortcuts tables were rewritten and merged with MacOS
specific keys.
16 | Calc Guide 26.2
Calc Guide 26.2
Chapter 1
Introduction
Using spreadsheets in LibreOffice
What is Calc?
Calc is the spreadsheet component of LibreOffice. 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:
• Functions, which can be used to create formulas to perform complex calculations on
data.
• Database functions to arrange, store, and filter data.
• Data statistics tools, to perform complex data analysis.
• Dynamic charts, including a wide range of 2D and 3D charts.
• Macros for recording and executing repetitive tasks; scripting languages supported
include LibreOffice Basic, Python, BeanShell, and JavaScript.
• Ability to open, edit, and save Microsoft Excel spreadsheets.
• Import and export of spreadsheets in multiple formats, including HTML, CSV, PDF, and
Data Interchange Format.
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. For more
information, see Chapter 12, Macros, in this guide or "Getting Started with Macros",
in the Getting Started Guide.
Spreadsheets, sheets, and cells
Calc works with documents called spreadsheets. Spreadsheets consist of a number of individual
sheets, each sheet containing cells arranged in rows and columns. A particular cell is identified
by its row number and column letter.
Cells hold the individual elements – text, numbers, formulas, and so on – that make up the data
to display and manipulate.
Each spreadsheet can have up to 10,000 sheets and each sheet can have a maximum of
1,048,576 rows and 16,384 columns.
Calc main window
When Calc is started, the main window opens (Figure 3). The various parts of this display are
explained below.
Note
By default, Calc’s commands are grouped in menus and toolbars, as described in
this section. In addition, Calc provides other user interface variations, displaying
contextual groups of commands and contents. For more information, see
Chapter 17, User Interface Variants.
18 | Calc Guide 26.2
Note
If any part of the Calc window in Figure 3 is not shown, you can display it using the
View menu. For example, View > Status Bar on the Menu bar will toggle (show or
hide) the Status Bar. It is not always necessary to display all of the parts shown; you
can show or hide any of them as desired.
Figure 3: Calc main window
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 list of options
appears. You can also modify the Menu bar, as explained in Chapter 16, Setting up and
Customizing.
• File – contains commands that apply to the entire document, such as Open, Save,
Wizards, Export as PDF, Print, Digital Signatures, Templates.
• Edit – contains commands for editing the document, such as Undo, Copy, Find and
Replace, Track Changes.
• View – contains commands for modifying how the Calc user interface looks, such as
Toolbars, View Headers, Full Screen, Zoom.
• Insert – contains commands for inserting elements into a spreadsheet, such as Image,
Chart, Text Box, Headers and Footers.
• Format – contains commands for modifying the layout of a spreadsheet, such as Cells,
Page Style, AutoFormat Styles, Align Text.
Chapter 1 Introduction | 19
• Styles – contains options for applying and managing styles, such as Heading 1,
Footnote, Manage Styles.
• Sheet – contains commands for inserting and deleting elements and modifying the
entire sheet, such as Delete Rows, Insert Sheet, Rename Sheet, Navigate.
• Data – contains commands for manipulating data in your spreadsheet, such as
Duplicates, Define Range, Sort, AutoFilter, Consolidate, Statistics.
• Tools – contains functions to help check and customize a spreadsheet, for example
Spelling, Share Spreadsheet, Macros, Options.
• Window – contains two commands; New Window and Close Window. Also shows all
open windows in other LibreOffice applications.
• Help – contains links to LibreOffice Help (included with the software), User Guides, and
other miscellaneous functions; for example Restart in Safe Mode, License Information,
Check for Updates, About LibreOffice.
The scope of the Menu bar can be daunting for some people and even experienced users can
forget where to look for rarely used functions. To quickly locate and run a command in the Menu
bar, select Help > Search Commands or press Shift+Esc. Calc displays the dialog shown in
Figure 4.
Figure 4: Search Commands dialog
In the above example the pop-up is used to search for the available recalculate options, which
appear in the lower area as soon as the letters “Reca” are typed in the upper area. The required
option is run by clicking on it, or by using the arrow buttons on the keyboard to move through the
options and then pressing the Enter key.
Toolbars
The default setting when Calc opens is for the Standard and Formatting toolbars to be docked at
the top of the workspace (Figure 3).
Calc toolbars can be either docked (fixed in place), or floating, allowing you to move a toolbar to
a more convenient location on your workspace. Docked toolbars can be undocked and moved to
a different docked location or become floating toolbars. Likewise, floating toolbars can be
docked.
The initial default is for all displayed toolbars to be locked in their docked positions. An individual
toolbar can be unlocked, when a vertical handle is displayed at its left edge, and this handle can
be used to drag the toolbar to a new screen position. To lock / unlock all toolbars at once, select
View > Toolbars > Lock Toolbars (LibreOffice must be restarted to apply this change).
You can choose the single-toolbar alternative to the default double toolbar arrangement. It
contains the most-used commands. To activate it, enable View > User Interface > Single
Toolbar. Other variations are also available through View > User Interface.
For additional information on toolbars, see the Getting Started Guide.
The default set of icons (sometimes called buttons) on toolbars provides a wide range of
common commands and functions. You can also remove or add icons to toolbars.
See Chapter 16, Setting up and Customizing, for more information.
20 | Calc Guide 26.2
Placing the mouse pointer over an icon, text box, or menu command, displays a small box called
a tooltip that shows the name of the item’s function. To close a tooltip, move away from the
underlying component or press the Esc key.
To see a more detailed explanation of an icon, text box, or menu command, turn extended tips
on or off. To do this go to Tools > Options > LibreOffice > General on the Menu bar and toggle
the Extended tips checkbox.
Formula Bar
The Formula Bar is located at the top of the Calc workspace. It is permanently docked in this
position and cannot be used as a floating toolbar. However, it can be hidden or made visible by
going to View > Formula Bar on the Menu bar.
Figure 5: Formula Bar
From left to right in Figure 5, 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. If you have selected a range of cells that is also a named
range, the name of the range is shown in this box. You can also type a cell reference in
the Name Box to jump to the referenced cell. If you type the name of a named range
and press the Enter key, the named range is selected and displayed.
• Function Wizard – opens a dialog from which you can search through lists of available
functions and formulas. This can be very useful because it also shows how the
functions are formatted.
• Select Function – performs a calculation on the numbers in the cells above the
selected cell and then places the result in it. If there are no numbers above the selected
cell, then the calculation operates on the cells to the left. The calculation to be
performed is selected from a drop-down menu containing options for Sum, Average,
Min, Max, Count, CountA, Product, Stdev, StdevP, Var, and VarP.
Tip
The Alt+= keyboard shortcut is equivalent to clicking the Select Function icon and
selecting the Sum option.
• Formula – inserts an equal (=) sign in 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. To turn the Input line into a multi-line input area for
very long formulas, click the Expand Formula Bar icon on the right or Click and drag
between the Formula Bar and top of the Column Headers (when mouse pointer turns
into a double arrow) to extend downwards. To edit inside the Input line area, click in the
area, then type your changes. The height of the formula bar will be saved in your
document.
You can also directly edit inside the cell by double-clicking on the cell. When you enter new data
into a cell, the Select Function and Formula icons change to Cancel and Accept icons.
Note
In a spreadsheet, the term “function” covers much more than just mathematical
functions. See Chapter 9, Using Formulas and Functions, for more information.
Chapter 1 Introduction | 21
Status Bar
The Status Bar at the bottom of the workspace (Figure 6) provides information about the
spreadsheet and convenient ways to quickly change some of its features. Most of the fields are
similar to those in other components of LibreOffice. See the Getting Started Guide for more
information.
Figure 6: Status Bar
1) Unsaved changes 7) AutoCalculate mode
2) Sheet number 8) Digital signature
3) Cell selection information 9) Cell or object information
4) Page style 10) Zoom slider
5) Language 11) Zoom percentage
6) Selection mode
The fields on the Status Bar, from left to right, are as follows.
Unsaved changes
The appearance of this icon indicates whether the spreadsheet contains unsaved
changes. When there are unsaved changes, click this icon, use File > Save, click the
Save icon on the Standard toolbar, or press Ctrl+S to save the spreadsheet.
Sheet number
Shows the sequence number of the current sheet and the total number of sheets in the
spreadsheet. The sequence number may not be the same as the name on the sheet tab
if sheets have been moved. Double-click on this zone to open the Navigator dialog.
Cell selection information
Shows how many rows and how many columns are selected. Blank if the selected cells
do not form a rectangular block.
Page style
Shows the page style of the current sheet. To edit the page style, double-click on this
field and the Page Style dialog opens.
Language
Shows current default language as selected at Tools > Options > Languages and
Locales > General.
Insert / overwrite mode
When you are interacting with a cell in edit mode, this field distinguishes between the
insert and overwrite modes. If the cell being edited is in overwrite mode, the field shows
the text Overwrite. In other cases, the field is blank. You can press the Insert key on
the keyboard, or click on this field, to switch between insert and overwrite modes.
Selection mode
Click to open a context menu and select Standard selection, Extending selection, or
Adding selection. The icon changes when different selection modes are selected.
See the Getting Started Guide for more information.
22 | Calc Guide 26.2
Digital signature
If the document has been digitally signed, an icon shows here. You can click the icon to
view the certificate. See Chapter 8, Printing, Exporting, E-mailing, and Signing for more
information about digital signatures.
Cell or object information
Displays information related to the position of the cursor or the selected element of the
spreadsheet. When a group of cells is selected, the average and sum of the contents is
displayed by default. Right-click in this field to select other functions, such as the
maximum value, minimum value, or count (number of items selected).
Zoom slider
Drag the zoom slider, click on the slider’s rail, or click the + and – symbols to change
the view magnification.
Zoom percentage
Indicates the magnification level of the document. Right-click on the percentage to open
a list of magnification values from which to choose. Click on the percentage to open the
Zoom & View Layout dialog.
Sidebar
The Sidebar (Figure 7) is a mixture of toolbar and dialog. When opened (View > Sidebar or
Ctrl+F5), it appears on the right side of the window. When entering or editing data in cells, the
Sidebar consists of five decks: Properties, Styles, 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. These decks are described below. However, the Sidebar is context-sensitive and
the number of decks and the content of each may change when you select objects such as
images or charts.
Properties
The Properties deck includes five content panels. Each panel has a More Options
button that provides additional options. If a dialog opens, it locks the document for
editing until it is closed.
Style: Options for applying, updating, or creating cell and page styles.
Character: Options for formatting the text, such as font name, size, and color. Some
controls, such as superscript, only become active when the text cursor is active in the
Input line of the Formula Bar or the cell. A font is temporarily applied on selected cells
when hovering or navigating in the Font Name drop-down list.
Number Format: Options for formatting numbers, including decimals, currency, dates,
or numeric text.
Alignment: Options for arranging the text in various ways, including horizontal and
vertical alignment, wrapping, indenting, merging, text orientation, and vertical stacking.
Cell Appearance: Options include background color and border formats, including line
color and style.
Chapter 1 Introduction | 23
Figure 7: Sidebar
Styles
The Styles deck enables you to apply existing styles, modify existing styles, or create
new styles. This deck can also be opened by selecting Styles > Manage Styles on the
Menu bar, selecting View > Styles on the Menu bar, or pressing F11.
Gallery
The Gallery deck enables you to add images, diagrams, or other objects that are
available in the Gallery themes. This deck can also be opened by selecting View >
Gallery on the Menu bar.
Navigator
The Navigator deck can also be opened by selecting View > Navigator from the Menu
bar or pressing F5. See Using the Navigator on page 45.
Functions
The Functions deck contains a list of Calc’s many functions organized by category. It is
a simpler version of the Function Wizard, which is opened by selecting Insert >
Function on the Menu bar, clicking the Function Wizard icon on the Formula Bar, or
pressing Ctrl+F2.
24 | Calc Guide 26.2
To the right side of the title bar of each open deck is a Close Sidebar Deck button, which closes
the deck to leave only the Tab bar of the Sidebar open. Click any button in the Tab bar to toggle
on / off the display of the associated deck.
To hide the Sidebar, or reveal it if already hidden, click on the left edge Hide/Show button.
To adjust the deck width, drag on the left edge of the Sidebar.
Spreadsheet layout
Individual cells
The main section of the screen displays the cells in the form of a grid, with each cell located at
the intersection of a column and a row.
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 alphabetic characters that start with A and
increase to the right. The row headers use numerical characters that start at 1 and increase
down.
These column and row headers form the cell references that appear in the Name Box on the
Formula Bar (Figure 5). If the headers are not visible on the spreadsheet, go to View >
View Headers on the Menu bar.
When the mouse pointer lies over the grid of cells, the system default pointer is normally shown
(typically an arrow pointer). However, a configuration option is available to switch to using the
pointer shape defined in the icon theme (typically a fat cross). See Chapter 16, Setting up and
Customizing for more information.
The active cell is always indicated by highlighting its corresponding column and row header
cells. An option is available to highlight the entire row and column of the active cell using a
transparent color (Figure 8). This is enabled/disabled using the Tools > Options > LibreOffice
Calc > View > Column/Row highlighting and View Column/Row Highlighting options.
Figure 8: Column and row highlighting
Sheet tabs
A spreadsheet file can contain many individual sheets. At the bottom of the grid of cells in a
spreadsheet are sheet tabs (Figure 3). Each tab represents a sheet in a spreadsheet. You can
create a new sheet by clicking on the plus sign to the left of the sheet tabs or by clicking in the
blank space to the right of the sheet tabs.
Clicking on a tab makes an individual sheet active. When a sheet is active, the tab is highlighted.
To select multiple sheets, hold down the Ctrl key while clicking on the sheet tabs.
Chapter 1 Introduction | 25
To change the default name for a sheet (Sheet1, Sheet2, and so on):
1) Right-click on the sheet tab and select Rename Sheet in the context menu. In the
dialog that opens, type in a new name for the sheet.
2) Click OK to close the dialog.
To change the color of a sheet tab:
1) Right-click on the sheet tab and select Tab Color in the context menu to open the Tab
Color dialog (Figure 9).
Figure 9: Tab Color dialog
2) Select a color and click OK to apply the color and close the dialog.
To add new colors to this color palette, see “Adding custom colors” in Chapter 16, Setting up and
Customizing.
Creating, opening, and saving spreadsheets
Creating and opening
Creating and opening spreadsheets is identical to creating and opening documents in the other
LibreOffice modules. For more information on creating and opening spreadsheets, see the
Getting Started Guide.
Using templates
Calc documents can also be created from templates. For information on how to create and use
templates, see Chapter 4, Using Styles and Templates, in this guide.
Opening a CSV file
Comma-separated values (CSV) files are spreadsheet files in a text format where cell contents
are separated by a character such as a comma or semicolon. Each line in a CSV text file
represents a row in a spreadsheet. Text is entered between quotation marks; numbers are
entered without quotation marks.
To open a CSV file in Calc:
1) Choose File > Open on the Menu bar, click the Open icon on the Standard toolbar, or
press Ctrl+O and locate the CSV file that you want to open.
26 | Calc Guide 26.2
2) Select the file and click Open. By default, a CSV file has the extension .csv. However,
some CSV files may have a .txt extension.
3) The Text Import dialog (Figure 10) opens. Here you can select options for importing a
CSV file into a Calc spreadsheet.
4) Click OK to open and import the file.
Figure 10: Text Import dialog
The 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, Calc will use the language associated with the locale selected at Tools >
Options > Languages and Locales > General > Formats. If another language is
selected, that language will determine how numbers are treated.
• From row – specifies which row the import starts with. The initial rows are visible in the
preview window at the bottom of the dialog.
Separator Options
• Fixed width – separates data into columns by a set number of characters. Click on the
ruler that appears in the preview window to set the width.
• Separated by – separates data into columns based on the separator defined here.
Select Other to specify another character used to separate data into columns. This
custom separator must also be contained in the data.
• Merge delimiters – combines consecutive delimiters and removes blank data fields.
• Trim spaces – removes starting and trailing spaces from within fields.
Chapter 1 Introduction | 27
• String delimiter – select a character to delimit text data.
Tip
CSV files can identify the separator to use by including a first row of sep=X or
“sep=X” where X is the separator character. Set From row to 2 to import correctly.
Other options
• Format quoted field as text – when this option is enabled, fields or cells whose values
are entirely within quotes are imported as text.
• Detect special numbers – when this option is enabled, Calc will automatically detect all
number formats, including special number formats such as dates and times. Scientific
notation will also be detected as the adjacent Detect scientific notation option must be
enabled at the same time. The selected language influences how such special numbers
are detected, since different languages and regions many have different conventions for
such special numbers.
• When this option is disabled, Calc will detect and convert only numbers in decimal
notation. Detection of numbers in scientific notation will depend on the adjacent Detect
scientific notation option. The rest will be imported as text. A decimal number string can
have digits 0-9, thousands separators, and a decimal separator. Thousands separators
and decimal separators may vary with the selected language and region.
• Evaluate formulas – when this option is enabled, fields that begin with an equals sign
(=) will be imported and evaluated as a formula instead of as data.
• Detect scientific notation – when this option is enabled, Calc will automatically detect
numbers with scientific notation, such as “5E2” for 500. The selected language
influences how scientific notation is detected, since different languages and regions
many have different decimal separator.
• This option can be disabled only if the Detect special numbers option is disabled. When
this option is disabled, Calc will detect and convert only numbers in decimal notation
and the remainder will be imported as text. A decimal number string can have digits 0-9,
thousands separators, and a decimal separator. Thousands separators and decimal
separators may vary with the selected language and region.
Fields – shows how your data will look when it is separated into columns.
• Column type – select a column in the preview window and select the data type to be
applied to the imported data.
• Standard – Calc determines the type of data.
• Text – imported data are treated as text.
• Date – imported data are treated as dates in the selected format – “DMY”, “MDY”, or
“YMD”.
• US English – numbers formatted in US English are searched for and included
regardless of the system language. A number format is not applied. If there are no
US English entries, the Standard format is applied.
• Hide – the data in the column are not imported.
Note
You can skip the dialog by selecting Always show on import. The current settings
are saved in your user profile for later use. You can display it back by using the new
Edit filter settings checkbox in the File > Open dialog.
28 | Calc Guide 26.2
Saving spreadsheets
For information on how to save files manually or automatically, see the Getting Started Guide.
Calc can save spreadsheets in a range of formats and also export spreadsheets to PDF and
XHTML file formats; see Chapter 8, Printing, Exporting, Emailing, and Signing, for more
information.
Saving in other formats
If you need to send files to users who are unable to receive spreadsheet files in Open Document
Format (ODF) (*.ods), which Calc uses as its default format, you can save a spreadsheet in
another format.
1) Select File > Save As on the Menu bar, click the down arrow at the right of the Save
icon on the Standard toolbar and select Save As from the drop-down menu, or press
Ctrl+Shift+S to open the Save As dialog (Figure 11).
2) In File name, if you wish, enter a new file name for the spreadsheet and select the
folder where you want to save the file.
3) In the Save as type field, select from the drop-down menu the type of spreadsheet
format you want to use. If Automatic file name extension is selected, the correct file
extension for the spreadsheet format you have selected will be added to the file name.
4) Click Save.
Figure 11: The Save As dialog
Each time a file is saved in a format other than ODF format, the Confirm File Format dialog
opens (Figure 12). Click Use [xxx] Format to continue saving in the selected spreadsheet
format or click Use ODF Format to save the spreadsheet in Calc’s default format. If you disable
Warn when not saving in ODF or default format on Tools > Options > Load/Save > General
on the Menu bar, the Confirm File Format dialog will no longer appear. You can also clear the
checkbox Ask when not saving in ODF or default format on the dialog to stop the dialog
appearing.
Chapter 1 Introduction | 29
Figure 12: Confirm File Format dialog
If you select Text CSV format (*.csv), the Export Text File dialog (Figure 13) opens. Here you can
select the character set, field delimiter, string delimiter, and so on to be used for the CSV file.
Note
Once you have saved a spreadsheet in another format, all changes you make to the
spreadsheet will now occur only in the format you are using because you have
changed the name and file type of your document. If you want to go back to working
with an *.ods version, you must save the file as an *.ods file.
Figure 13: Export Text File dialog
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 the section named
Default File Format and ODF Settings, next to Document type, select Spreadsheet,
then next to Always save as, select your preferred file format, for example one of the
available Microsoft Excel options.
Password protection
To protect a spreadsheet and restrict who can open, read, and make changes to it, you have to
use password protection. Password protection is common to all LibreOffice modules; for more
information, see the Getting Started Guide.
30 | Calc Guide 26.2
Navigating within spreadsheets
Calc provides many ways to navigate within a spreadsheet from cell to cell and sheet to sheet.
You can generally use the method you prefer.
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 uses your system’s highlight
color.
• Using the mouse – place the mouse pointer over the cell and click the left mouse
button. To move the focus to another cell using the mouse, move the mouse pointer to
the cell and click the left mouse button.
• Using a cell reference – select or delete the existing cell reference in the Name Box on
the Formula Bar (Figure 5 on page 21). Type the reference of the cell you want to move
to and press the Enter key. Cell references are case-insensitive. Thus, typing a3 or A3
will move the focus to cell A3.
• Using the Navigator – to open the Navigator (Figure 25), go to View > Navigator on the
Menu bar, or press F5, or click the Navigator button on the Sidebar. Type the cell
references into the Column and Row fields and press the Enter key.
• Using the Enter key – pressing Enter moves the cell focus down one cell (by default).
You can change the direction of this focus movement as described in the Customizing
the Enter key section on page 34.
• Pressing Shift+Enter moves the focus one cell in the opposite direction to that
associated with the Enter key.
• Using the Tab key – pressing Tab moves the cell focus one cell to the right. Pressing
Shift+Tab moves the focus one cell to the left.
• Using the arrow keys – pressing the arrow keys on the keyboard moves the cell focus in
the direction of the arrow pressed.
• Using Home, End, Page Up, and Page Down
– Home moves the cell focus to the start of a row. Ctrl+Home moves the cell focus to
the first cell in the sheet, A1.
– The result of pressing End or Ctrl+End depends on the data contained in the sheet.
To explain these key presses, it is helpful to define Rmax as the highest numbered
row in the sheet that contains any data and Cmax as the rightmost column in the
sheet that contains any data. Press End to move the cell focus along the current row
to the cell in column Cmax. Press Ctrl+End to move the cell focus to the cell at the
intersection of row Rmax and column Cmax. Note that in either case, the newly
focused cell may not contain any data.
– Page Down moves the cell focus down one complete screen display.
– Page Up moves the cell focus up one complete screen display.
Chapter 1 Introduction | 31
Sheet navigation
Each sheet in a spreadsheet is independent of the other sheets, though references can be
linked from one sheet to another. There are four ways to navigate between different sheets in a
spreadsheet.
• Using the Navigator – when the Navigator is open (Figure 25), double-clicking on any of
the listed sheets selects the sheet.
• Using the keyboard – using key combinations Ctrl+Page Down moves one sheet to the
right and Ctrl+Page Up moves one sheet to the left. Ctrl+Tab is equivalent to
Ctrl+Page Down, while Ctrl+Shift+Tab is equivalent to Ctrl+Page Up. These
interactions operate in a cyclic manner. For example, if currently on the first sheet tab,
then Ctrl+Page Up moves to the last sheet tab.
• Using the mouse – clicking on one of the sheet tabs at the bottom of the spreadsheet
selects that sheet.
• Using the menu – go to Sheet > Navigate > To Previous Sheet / To Next Sheet to
navigate to previous or next sheet. These interactions operate in the same cyclic
manner as described above for their equivalent keyboard shortcuts. Sheet > Navigate
> Go to Sheet brings up a dialog box that allows you to select a sheet or to search for a
sheet by name.
If there are many sheets in the spreadsheet, some of the sheet tabs may be hidden. If this is the
case, use the four buttons to the left of the sheet tabs to move the tabs into view (Figure 14).
Note
The sheet tab arrows that appear on the left in Figure 14 are only active if there are
more sheet tabs than can be displayed.
Figure 14: Navigating sheet tabs
Note
When you insert a new sheet into a 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, your new sheet may not be in numerical order. It is
recommended to rename sheets in a spreadsheet to make them more recognizable.
32 | Calc Guide 26.2
Tip
You can customize the prefix word “Sheet” for new sheets in your document by
entering a new word in Tools > Options > LibreOffice Calc > Defaults > Prefix
name for new worksheets.
Keyboard navigation
You can navigate a spreadsheet using the keyboard, by pressing a key or a combination of keys
at the same time. For example, Ctrl+Home moves the focus to cell A1. Table 3 lists the keys and
key combinations you can use for spreadsheet navigation in Calc. A complete list of keyboard
shortcuts is available in Appendix A.
Table 3. Keyboard cell navigation
Keyboard shortcut Cell navigation
Ctrl+Home or Moves focus to the top left cell of the sheet (usually cell A1) or
Ctrl+End moves focus to the last used cell in sheet (usually in the bottom
right of the sheet).
Alt+Page Down or
Alt+Page Up Moves focus one screen to the right or left (if possible).
Ctrl+Page Down or Moves focus to the next sheet to the right or left in sheet tabs.
Ctrl+Tab or These interactions operate in a cyclic manner. For example, if
Ctrl+Page Up or currently on the first sheet tab, then Ctrl+Page Up moves to the
Ctrl+Shift+Tab last sheet tab.
Tab or Shift+Tab Moves focus to the next cell on the right or left.
Enter or Moves focus down/up one cell (unless you have changed this
Shift+Enter action, as described in the following subsection).
→ or← Moves cell focus right or left one cell.
↑or↓ Moves cell focus up or down one cell.
If focus is on a blank cell, Ctrl+→ moves focus along the current
row to the first cell on the right that contains data. If there is no cell
on the right containing data, it moves focus along the current row to
the last cell at the right of the sheet.
If focus is on a blank cell, Ctrl+← moves focus along the current
row to the first cell on the left that contains data. If there is no cell on
the left containing data, it moves focus along the current row to the
cell in column A of the sheet.
If focus is on a cell containing data, Ctrl+→ normally moves focus
along the current row to the cell at the right edge of the same data
Ctrl+→ or Ctrl+← region. However, if there is a blank cell to the right of the original
cell, focus is moved to the cell at the left edge of the next data
region to the right. In this case, if there is no data region to the right,
focus is moved along the current row to the last cell at the right of
the sheet.
If focus is on a cell containing data, Ctrl+← normally moves focus
along the current row to the cell at the left edge of the same data
region. However, if there is a blank cell to the left of the original cell,
focus is moved to the cell at the right edge of the next data region to
the left. In this case, if there is no data region to the left, focus is
moved along the current row to the cell in column A of the sheet.
Chapter 1 Introduction | 33
Keyboard shortcut Cell navigation
If focus is on a blank cell, Ctrl+↑ moves focus up the current
column to the first cell that contains data. If there is no cell above
containing data, it moves focus up the current column to the cell in
row 1 of the sheet.
If focus is on a blank cell, Ctrl+↓ moves focus down the current
column to the first cell that contains data. If there is no cell below
containing data, it moves focus down the current column to the last
cell at the bottom of the sheet.
If focus is on a cell containing data, Ctrl+↑ normally moves focus
Ctrl+↑ or Ctrl+↓ up the current column to the cell at the top edge of the same data
region. However, if there is a blank cell above the original cell, focus
is moved to the cell at the bottom edge of the next data region
above. In this case, if there is no data region above, focus is moved
up the current column to the cell in row 1 of the sheet.
If focus is on a cell containing data, Ctrl+↓ normally moves focus
down the current column to the cell at the bottom edge of the same
data region. However, if there is a blank cell below the original cell,
focus is moved to the cell at the top edge of the next data region
below. In this case, if there is no data region below, focus is moved
down the current column to the bottom of the sheet.
Customizing the Enter key
You can choose the direction in which the Enter key moves the cell focus by going to Tools >
Options > LibreOffice Calc > General. Use the first three options under Input Settings
(Figure 15) to change the Enter key settings. Select the direction cell focus moves from the
drop-down list. Depending on the file being used or the type of data being entered, setting a
different direction can be useful. The Enter key can also be used to switch into and out of
editing mode. In Calc, when the content of a cell is copied to the clipboard, you can paste the
information in another cell by pressing the Enter key; here you can disable this feature.
Figure 15: Customizing the Enter key
34 | Calc Guide 26.2
Selecting items in a spreadsheet
Selecting cells
Single cell
Click in the cell. You can verify the selection by looking in the Name Box on the Formula Bar
(Figure 5).
Range of contiguous cells
A range of cells can be selected using the keyboard or the mouse.
To select a range of cells by dragging the mouse pointer:
1) Click in a cell.
2) Press and hold down the left mouse button.
3) Move the mouse to highlight the desired block of cells, then release the left mouse
button.
To select a range of cells without dragging the mouse:
1) Click in the cell which is to be one corner of the range of cells.
2) Move the mouse to the opposite corner of the range of cells.
3) Hold down the Shift key and click.
To select a block of cells containing data:
1) Click in a non-empty cell inside the block of cells containing data. Do not click on an
empty cell inside the block.
2) Press Ctrl + A. The block of cells is selected. Empty cells inside the block are
selected too.
Figure 16: Selection of a block of non-empty cells with Ctrl+A
To select a range of cells using Extending selection mode:
1) Click in the cell which is to be one corner of the range of cells.
2) Click in the Selection mode field on the Status Bar (Figure 6) and select Extending
selection.
3) Click in the cell in the opposite corner of the range of cells.
Chapter 1 Introduction | 35
Tip
Make sure to change back to Standard selection mode or you may find yourself
extending a cell selection unintentionally.
To select a range of cells without using the mouse:
1) Select the cell that will be one of the corners in the range of cells.
2) While holding down the Shift key, use the cursor arrows to select the rest of the range.
To select a range of cells using the Name Box:
1) Click in the Name Box on the Formula Bar (Figure 5).
2) Enter the cell reference for the upper left-hand cell, followed by a colon (:), and then the
lower right-hand cell reference, then press the Enter key. For example, to select the
range that would go from A3 to C6, enter A3:C6.
Range of non-contiguous cells
To select a range of non-contiguous cells using the mouse:
1) Select the first cell or range of cells using one of the methods above.
2) Move the mouse pointer to the start of the next range or single cell.
3) Hold down the Ctrl key and click or click-and-drag to select another range of cells to
add to the first range.
4) Repeat as necessary.
To select a range of cells using Adding selection mode:
1) Click in the Selection mode field on the Status Bar (Figure 6) and select Adding
selection.
2) Click or click-and-drag to select ranges of cells to add to the selection.
Selecting columns and rows
Single column or row
To select a single column, click on the column header (Figure 3). To select a single row, click on
the row header.
Multiple columns or rows
To select multiple columns or rows that are contiguous:
1) Click on the first column or row in the group.
2) Hold down the Shift key.
3) Click the last column or row in the group.
To select multiple columns or rows that are not contiguous:
1) Click on the first column or row in the group.
2) Hold down the Ctrl key.
3) Click on all of the subsequent columns or rows while holding down the Ctrl key.
36 | Calc Guide 26.2
Tip
You can also select rows and columns using options in the Edit > Select menu
(Select Row, Select Column, Select Visible Rows Only, and Select Visible
Columns Only).
Entire sheet
To select the entire sheet, click on the small box between the column headers and the row
headers (Figure 17), use the key combination Ctrl+A, press Ctrl+Shift+Space, or go to Edit
on the Menu bar and select Select All.
Figure 17: Select All box
Selecting sheets
You can select either one or multiple sheets in Calc. It can be advantageous to select multiple
sheets, especially 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 tab for the selected sheet becomes
highlighted.
Multiple contiguous sheets
To select multiple contiguous sheets:
1) Click on the sheet tab for the first desired sheet.
2) While holding down the Shift key, click on the sheet tab for the last desired sheet.
3) All tabs between these two selections will be highlighted. Any actions that you perform
will now affect all highlighted sheets.
Multiple non-contiguous sheets
To select multiple non-contiguous sheets:
1) Click on the sheet tab for the first desired sheet.
2) While holding down the Ctrl key, click on the sheet tabs for other desired sheets.
3) The selected tabs will be highlighted. Any actions that you perform will now affect all
highlighted sheets.
All sheets
Right-click a sheet tab and choose Select All Sheets in the context menu, or select Edit >
Select > Select All Sheets on the Menu bar.
Tip
You can also select sheets using the Select Sheets dialog, accessed by selecting
Edit > Select > Select Sheets on the Menu bar.
Chapter 1 Introduction | 37
Working with columns and rows
Inserting columns and rows
When you insert columns or rows, the cells take the formatting of the corresponding cells in the
column to the left or the row above.
Single column or row
Using the Sheet menu:
1) Select a cell, column, or row where you want the new column or row inserted.
2) Go to Sheet on the Menu bar. For columns, select Sheet > Insert Columns and then
select Columns Before or Columns After. For rows, select Sheet > Insert Rows and
then select Rows Above or Rows Below.
Using the context menu:
1) Select a column or row where you want the new column or row inserted.
2) Right-click the column or row header.
3) Select Insert Columns Before / After or Insert Rows Above / Below in the context
menu.
Multiple columns or rows
Multiple columns or rows can be inserted at once rather than inserting them one at a time.
1) Highlight the required number of columns or rows by holding down the left mouse
button on the first one and then dragging across the required number of identifiers.
2) Proceed as for inserting a single column or row above. The number of columns or rows
highlighted will be inserted.
Hiding columns and rows
To hide columns or rows from view, select the columns or rows to hide and do one of the
following:
Right-click on the selected column or row headers and select Hide Columns / Rows.
From the Menu bar, select Format > Columns / Rows > Hide.
Tip
For a visible indication of hidden rows and columns, enable the option from the Menu
bar, View > Hidden Row/Column Indicator (Figure 18).
38 | Calc Guide 26.2
Figure 18: Hidden columns and rows indicator
To unhide columns or rows, select the entire sheet or the columns or rows around the columns
or rows you wish to unhide and do one of the following:
Right-click on the selected column or row headers and select Show Columns / Rows.
From the Menu bar, select Format > Columns / Rows > Show.
Deleting columns and rows
Single column or row
To delete a single column or row, do one of the following:
• Select a cell in the column or row you want to delete, right-click and select Delete in the
context menu, select Sheet > Delete Cells on the Menu bar, or press Ctrl+- to open
the Delete Cells dialog (Figure 19). Select Delete entire column(s) or Delete entire
row(s) and click OK.
• Select a cell in the column or row you want to delete and select Sheet > Delete
Columns or Sheet > Delete Rows.
• Right-click the header of the column or row that you want to delete and select Delete
Columns or Delete Rows in the context menu.
Figure 19: Delete Cells dialog
Multiple columns or rows
To delete multiple columns or rows, do one of the following:
• Select a range of cells across the columns or rows you want to delete, right-click and
select Delete in the context menu, select Sheet > Delete Cells on the Menu bar, or
press Ctrl+- to open the Delete Cells dialog. Select Delete entire column(s) or
Delete entire row(s) and click OK.
• Select a range of cells across the columns or rows you want to delete and select
Sheet > Delete Columns or Sheet > Delete Rows.
Chapter 1 Introduction | 39
• Highlight the required columns or rows by holding down the left mouse button on the
header of the first one and then dragging across the required number of headers. Then
right-click on one of the selected column or row headers and select Delete Columns or
Delete Rows in the context menu.
Deleting cells
1) Select the cell or cells you want to delete.
2) Select Sheet > Delete Cells, press Ctrl+-, or right-click on one of the selected cells
and select Delete in the context menu.
3) Select the option you require from the Delete Cells dialog and click OK.
Working with sheets
Inserting new sheets
Click on the + symbol next to the sheet tabs to insert a new sheet after the last sheet in the
spreadsheet without opening the Insert Sheet dialog. The following methods open the Insert
Sheet dialog (Figure 20) where you can position the new sheet, create more than one sheet,
name the new sheet, or select a sheet from a file.
• Select the sheet where you want to insert a new sheet, then select Sheet > Insert
Sheet on the Menu bar.
• Right-click on the sheet tab where you want to insert a new sheet and select Insert
Sheet in the context menu.
• Click in the empty space at the end of the sheet tabs.
• Right-click in the empty space at the end of the sheet tabs and select Insert Sheet from
the context menu.
Figure 20: Insert Sheet dialog
Moving and copying sheets
You can move or copy sheets within the same spreadsheet by dragging and dropping or using
the Move/Copy Sheet dialog (Figure 21). To move or copy a sheet into a different spreadsheet,
use the Move/Copy Sheet dialog.
40 | Calc Guide 26.2
Dragging and dropping
To move a sheet to a different position within the same spreadsheet, click on the sheet tab and
drag it to its new position before releasing the mouse button.
To copy a sheet within the same spreadsheet, hold down the Ctrl key then click on the sheet
tab and drag it to its new position before releasing the mouse button. The mouse pointer may
change to include a plus sign depending on the setup of your operating system.
Using Move/Copy Sheet dialog
The Move/Copy Sheet dialog allows you to specify exactly whether you want the sheet in the
same or a different spreadsheet, its position within the spreadsheet, and the sheet name when it
is moved or copied.
1) In the current document, right-click on the sheet tab you wish to move or copy and
select Move or Copy Sheet in the context menu, or go to Sheet > Move or Copy
Sheet on the Menu bar.
2) Select Move to move the sheet or Copy to copy the sheet.
3) Select the spreadsheet where you want the sheet to be placed from the To document
drop-down list. This can be the same spreadsheet, another spreadsheet that is already
opened, or you can create a new spreadsheet.
4) Select the position in Insert before where you want to place the sheet.
5) Type a name in the New name text box if you want to rename the sheet when it is
moved or copied. When copying, Calc suggests a default name (Sheet1_2, Sheet2_2,
and so on).
6) Click Move or Copy to confirm the move or copy and close the dialog.
Figure 21: Move/Copy Sheet dialog
Caution
When you move or copy to another spreadsheet or to a new one, a conflict may
occur if formulas are linked to sheets in the previous location.
Chapter 1 Introduction | 41
Deleting sheets
To delete a single sheet, right-click on the sheet tab you want to delete and select Delete Sheet
in the context menu, or go to Sheet > Delete Sheet on the Menu bar. If the sheet is not empty,
then Calc displays a confirmation dialog – click Yes to confirm the deletion.
To delete multiple sheets, select the sheets (see Selecting sheets on page 37), then right-click
one of the sheet tabs and select Delete Sheet in the context menu, or go to Sheet > Delete
Sheet on the Menu bar. If any of the selected sheets is not empty, then Calc displays a
confirmation dialog stating the number of sheets to be deleted – click Yes to confirm the deletion.
Hiding and showing sheets
Sometimes you may want to hide the contents of a sheet to preserve data from accidental
editing or because its contents are not important to display.
To hide a sheet or many sheets, select the sheet or sheets as above, right-click to open the
context menu, and select Hide Sheet.
To show hidden sheets, right-click any sheet tab and select Show Sheet in the context menu.
A dialog will open with all hidden sheets listed. Select the desired sheets and then click OK.
Note
LibreOffice Calc does not let you hide the last visible sheet.
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 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 20).
• Right-click on a sheet tab and select Rename Sheet in the context menu to open the
Rename Sheet dialog
• Select Sheet > Rename Sheet on the Menu bar to access the Rename Sheet dialog.
• Double-click on a sheet tab to open the Rename Sheet dialog.
Note
Sheet names can contain almost any character. Some naming restrictions apply, the
following characters are not allowed in sheet names: colon (:), backslash (\),
forward slash (/), question mark (?), asterisk (*), left square bracket ([), or right
square bracket (]). In addition, a single quote (‘) cannot be used as the first or last
character of the name.
Viewing a spreadsheet
Changing document view
Use the zoom function to show more or fewer cells in the window when you are working on a
spreadsheet. For more about zoom, see the Getting Started Guide.
42 | Calc Guide 26.2
Freezing rows and columns
Freezing is used to lock rows across the top of a spreadsheet or to lock columns on the left of a
spreadsheet. Then, when moving around within a sheet, the cells in frozen rows and columns
always remain in view.
Figure 10 shows some frozen rows and columns. The heavier horizontal line between rows 3
and 23 and the heavier vertical line between columns F and Q indicate that rows 1 to 3 and
columns A to F are frozen. The rows between 3 and 23 and the columns between F and Q have
been scrolled off the page. To freeze rows or columns:
1) Click on the row header below the rows you want the freeze or click on the column
header to the right of the columns where you want the freeze. To freeze both rows and
columns, select the cell (not a row or column) that is below the row and to the right of
the column that you want to freeze. Go to View on the Menu bar and select Freeze
Rows and Columns. A heavier line appears between the rows or columns indicating
where the freeze has been placed.
Figure 22: Frozen rows and columns
Unfreezing
To unfreeze rows or columns, go to View on the Menu bar and click Freeze Rows and
Columns to toggle it off. The heavier lines indicating freezing will disappear.
Splitting the screen
Another way to change the view is by splitting the screen displayed (also known as splitting the
window). The screen can be split horizontally, vertically, or both, displaying up to four portions of
the spreadsheet at the same time. An example of splitting the screen is shown in Figure 23
where a split is indicated by a gray line.
This could be useful for example, when a large spreadsheet has one cell with a number that is
used by three formulas in other cells. Using the split-screen technique, the cell containing the
number can be positioned in one section of the view and the cells with formulas can be seen in
the other sections. This makes it easy to see how changing the number in one cell affects each
of the formulas.
Figure 23: Split screen example
Chapter 1 Introduction | 43
Splitting horizontally or vertically
There are two ways to split a screen horizontally or vertically:
Method One:
1) Click on the row header below the rows where you want to split the screen horizontally
or click on the column header to the right of the columns where you want to split the
screen vertically.
2) Go to View on the Menu bar and select Split Window or right-click and choose
Split Window in the context menu. A thick line appears between the rows or columns
indicating where the split has been placed. An example of a split line is shown below
Row 2 in Figure 23.
Method Two:
For a horizontal split, click on the thick black line at the top of the vertical scroll bar (Figure 24)
and drag the split line below the row where you want the horizontal split positioned.
Similarly, for a vertical split, click on the thick black line at the right of the horizontal scroll bar
(Figure 24) and drag the split line to the right of the column where you want the vertical split
positioned.
Figure 24: Split screen bars
Splitting both horizontally and vertically
Method One:
Position both the black horizontal and the black vertical lines as described above and as shown
in Figure 24.
Method Two:
1) Click 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 View on the Menu bar and select Split Window. Thick lines appear between the
rows and columns indicating where the splits have been placed.
Removing split views
To remove a split view, do any of the following:
• Double-click on each split line in turn.
• Click on and drag the split lines back to their places at the ends of the scroll bars.
• Go to View on the Menu bar and click Split Window to toggle it off.
• Right-click on a column or row heading and click Split Window in the context menu to
toggle it off.
44 | Calc Guide 26.2
Using the Navigator
The Navigator (Figure 25) is available in all LibreOffice modules. It provides tools and methods
to move quickly through a spreadsheet and find specific items.
The Navigator categorizes and groups spreadsheet objects which you can click on to move
quickly to that object. If an indicator (plus sign or triangle, dependent on computer setup)
appears next to a category, at least one object in this category exists. To open a category and
see the list of items, click on the indicator. When a category is showing the list of objects in it,
double-click on an object to jump directly to that object’s location in the spreadsheet.
To open the Navigator, do one of the following:
• Press the F5 key.
• Select View > Navigator on the Menu bar.
• Click the Navigator icon on the Tab panel of the Sidebar.
Figure 25: Navigator dialog in Calc
The controls and tools available in the Navigator are as follows:
• Column – type a column letter and press the Enter key to reposition the cell cursor to
the specified column in the same row.
• Row – type a row number and press the Enter key to reposition the cell cursor to the
specified row in the same column.
• Data Range – highlights the data range containing the cell in which the cursor currently
lies. Calc checks the content of adjacent cells and determines the data range
automatically. The data range can comprise one cell if there is no data in adjacent cells.
• Start – moves the cursor to the cell at the beginning of the current data range, which
you can highlight using the Data Range icon.
• End – moves the cursor to the cell at the end of the current data range, which you can
highlight using the Data Range icon.
• Contents – toggles on / off the display of the contents view in the lower part of the
Navigator dialog, to temporarily reduce its size. There is no equivalent control needed
on the Navigator deck of the Sidebar.
Chapter 1 Introduction | 45
• Toggle – toggles the contents view. Only the selected category and its objects are
displayed. Click the icon again to restore all elements for viewing.
• Scenarios – displays all available scenarios. See Chapter 11, Data Analysis, for more
information about scenarios. Double-click a name to apply that scenario and the result
is shown in the sheet. If the Navigator displays scenarios, you can access the following
commands when you right-click a scenario entry:
– Delete – deletes the selected scenario.
– Properties – opens the Edit Scenario dialog, where you can edit the scenario
properties.
• Drag Mode – opens a sub menu for selecting which action is performed when dragging
and dropping an object from the Navigator into a document. Depending on the mode
you select, the icon indicates whether a hyperlink, a link, or a copy is created.
– Insert as Hyperlink – hyperlinks the entire item.
– Insert as Link – links the copied item to the original item so that when the original
item is changed, that change will be reflected in the current document.
– Insert as Copy – inserts a copy of the selected item.
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 the default
Calc names, for example Scenario 1, Image 1, Image 2, Object 1, and so on. These
default names may not correspond to the position of the object in the document.
Using document properties
To open the Properties dialog for a document, go to File > Properties on the Menu bar. The
Properties dialog provides information about the spreadsheet and allows you to set some of its
properties. The dialog is shown in Figure 26 and its tabs are described below.
Figure 26: Properties dialog, General tab
46 | Calc Guide 26.2
General
Contains basic information about the current file.
• The text at the top of the dialog displays the file name.
• Change Password – opens a dialog to change the password. It is only active if a
password has been set for the file.
• Type – displays the file type of the current document.
• Location – displays the path and the name of the directory where the file is stored. In
the case of a local file, this is a clickable link that opens the file browser to view the
folder. For remote content (shown as, for example, [Link] the link opens a web
browser.
• Size – displays the size of the current document in bytes.
• Created – displays the date, time, and author when the file was first opened.
• Modified – displays the date, time, and author when the file was last saved in a
LibreOffice file format.
• Template – displays the template that was used to create the file, if applicable.
• Digitally signed – displays the date and time when the file was last signed as well as
the name of the author who signed the document.
• Digital Signatures – opens the Digital Signatures dialog where you can manage digital
signatures for the current document.
• Last printed – displays the date, time, and user name when the file was last printed.
• Total editing time – displays the amount of time that the file has been open for editing
since the file was created. The editing time is updated when you save the file.
• Revision number – displays the number of times that the file has been saved.
• Apply user data – saves the full name of the user with the file. You can edit the name
by going to Tools > Options > LibreOffice > User Data on the Menu bar.
• Save preview image with this document – saves a [Link] inside the
document. These images may be used by a file manager under certain conditions.
• Preferred resolution for images: Check this box to select the preferred image
resolution in points per inch, which is used as default when an image is inserted and
resize it according to the value in the list box.
• Reset Properties – resets the editing time to zero, the creation date to the current date
and time, and the version number to 1. The modification and printing dates are also
deleted.
Description
LibreOffice supports the Dublin Core Metadata Element Set, a standardized set of metadata
elements used to describe physical and electronic documents.
• Title – enter a title for the spreadsheet.
• Subject – enter a subject for the spreadsheet. You can use a subject to group
documents with similar content.
• Keywords – enter the words that you want to use to index the content of the
spreadsheet. Keywords must be separated by commas. A keyword can contain white
space characters or semicolons.
Chapter 1 Introduction | 47
• Contributor – enter the name of a person or organization that has contributed to the
spreadsheet.
• Coverage – enter details of the scope of the spreadsheet.
• Identifier – enter a reference that identifies the spreadsheet.
• Publisher – enter the name of a person or organization that makes the spreadsheet
available.
• Relation – enter details of a related resource.
• Rights – enter details of any rights that are held in or over the spreadsheet.
• Source – enter details of any related resource that has been used in deriving the
spreadsheet.
• Type – enter the nature or type of the spreadsheet.
• Comments – enter comments to help identify the spreadsheet.
Custom Properties
Use this page to assign custom information fields to the spreadsheet. In a new spreadsheet, this
page may be blank. If the new spreadsheet is based on a template, this page may contain fields.
You can change the name, type, and contents of each row. The information in the fields will be
exported as metadata to other file formats.
Click Add Property to add a new custom property. Use the red “X” button at the end of an entry
to delete the custom property.
Security
Enables two password-protected security options.
• Open file read-only – select to allow this document to be opened only in read-only
mode. This file sharing option protects the document against accidental changes. It is
still possible to edit a copy of the document and save that copy with the same name as
the original.
• Record changes – select to require that all changes be recorded. To protect the
recording state with a password, click Protect and enter a password. This is similar to
Edit > Track Changes > Record on the Menu bar. However, while other users of this
document can apply their changes, they cannot disable change recording without
knowing the password.
• Protect or Unprotect – protects the change recording state with a password. If change
recording is protected for the current document, the button is named Unprotect.
Click Unprotect to disable the protection.
Font
When Embed fonts in the document is selected, any fonts used in the spreadsheet will be
embedded into the document when it is saved. This may be useful if you are creating a PDF of
the spreadsheet and want to control how it will look on other computer systems.
Only embed fonts that are used in documents – If fonts have been defined for the
spreadsheet (for example, in the template), but have not been used, select this option to not
embed them.
Font scripts to embed – You can choose which types of fonts are embedded: Latin, Asian,
Complex. See the Getting Started Guide for more information.
48 | Calc Guide 26.2
Statistics
Displays statistics for the current file: the number of sheets, cells, pages, and formula groups.
Chapter 1 Introduction | 49
Calc Guide 26.2
Chapter 2
Entering and Editing
Data
Introduction
There are several ways of entering data into Calc by using:
the keyboard
the Fill tool
selection lists
dragging and dropping
Data can also be entered into multiple sheets of the same spreadsheet at the same time.
Entering data
Most data entry in Calc can be done using the keyboard.
Numbers
Click in the cell and type the number using the number keys on either the main keyboard or the
numeric keypad.
Negative 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 is the same
which is, -1234.
Leading zeroes
By default, if a number is entered with leading zeroes, Calc will drop the leading zeroes.
For example if 0012 is entered into a cell, it becomes 12.
To retain both the number format and a minimum number of characters in a cell when entering
numbers, for example 1234 and 0012, use one of these methods to add leading zeroes.
Method 1
1) With the cell selected, go to Format > Cells on the Menu bar, or right-click on the cell
and select Format Cells in the context menu, or use the keyboard shortcut Ctrl+1, to
open the Format Cells dialog (Figure 27).
52 | Calc Guide 26.2
Figure 27: Format Cells dialog – Numbers tab
2) Make sure the Numbers tab is selected, then select Number in the Category list.
3) In the Leading zeroes field within the Options area, enter the minimum number of
characters required. For example, for four characters, enter 4. Any number less than
four characters will then have leading zeroes 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) On the Sidebar, go to the Properties deck.
3) In the Number Format panel (Figure 28), select Number in the drop-down list, and enter
4 in the Leading zeroes field. The formatting is applied immediately.
Figure 28: Set leading zeroes in Sidebar
Converting text to numbers
Sometimes when data is added into a cell, it may appear to be numerical data, but in fact has
the data type “text”, which can lead to errors in arithmetic calculations that use the data. This can
happen when data is pasted from the clipboard, imported from a CSV file, or entered into a cell
that is formatted as text and has the data type “text”.
Chapter 2 Entering and Editing Data | 53
Note
Changing a cell’s format from Text to Number only affects how the data appears on-
screen. It cannot change the cell’s data type from text to number.
Tip
Sometimes there is an opposite problem: when data looking like numbers must be
entered as text. If numerical characters do not need to be treated as numbers in
calculations (for example when entering zip codes), type an apostrophe (') before
the number, for example '01481. When you move the cell focus, the apostrophe is
removed, the leading zeroes are retained, and the number is converted to
left‑aligned text.
Convert text to number using Find and Replace
This method uses Calc’s Find and Replace feature to reenter the data into the cell as though it
were entered from the keyboard.
Data with the same decimal separator
If the imported data and the spreadsheet both use the same decimal delimiter, for example
importing data with a period (.) as a decimal separator into a spreadsheet with the period (.) as a
decimal separator, then use the following method:
1) Select the cell range containing the data to be converted.
2) Press Ctrl+M or right‑click the selected range and select Clear Direct Formatting from
the context menu.
3) Press Ctrl+H or select Edit > Find and Replace from the menu.
4) In the Find field, enter: .+
5) In the Replace field, enter: $0
6) Under other options, select Current selection only and Regular expressions.
7) Click Replace All.
Data with a different decimal separator
If the imported data uses a different decimal separator to the spreadsheet, for example importing
data that uses a period (.) as a decimal delimiter into a spreadsheet that uses a comma (,) as
the decimal delimiter, then use the following method:
1) Select the cell range containing the data to converted.
2) Press Ctrl+M or right‑click the selected range and select Clear Direct Formatting from
the context menu.
3) Press Ctrl+H or select Edit > Find and Replace from the menu.
4) In the Find field, enter: .
5) In the Replace field, enter: ,
6) Under other options, select Current selection only and deselect Regular expressions.
7) Click Replace All.
Importing from CSV
If the data was imported from a CSV file, it may have been imported with incorrect locale
settings. To correct this error, re-import the data and ensure that the Locale setting matches the
locale of the data in the source document.
54 | Calc Guide 26.2
See Chapter 1, Introduction, Opening a CSV File for instructions on how to import a CSV file.
Convert to number using Text to Columns
If the text contains a delimiter such as a comma, space, or tab, expanding it into multiple
columns, Calc’s Text to Columns, feature converts it from text to numerical data.
To convert text to columns:
1) Select the cell range containing the data to be converted.
2) Choose Data > Text to Columns.
3) Select the delimiter in Separator Options.
4) Click OK.
Convert to number using an extension
If you need to convert text to numbers frequently, install the CT2N – Convert Text To Number
(and dates) extension for LibreOffice Calc. The extension is available at:
[Link]
See Chapter 16, Installing an extension for instructions on how to install an extension.
Text
Click in a cell and type the text. The text is left-aligned by default. Cells can contain several lines
of text. If you want to use paragraphs, press Ctrl+Enter to create another paragraph.
On the Formula Bar, you can extend the Input line if you are entering several lines of text. Click
on the Expand / Collapse Formula Bar icon located on the right of the Formula Bar and the
Input line becomes multi-line, as shown in Figure 29. You can drag the bottom of the Input line
up and down to control its exact height. Click the Expand / Collapse Formula Bar icon again to
return the Input line to its default single line height.
Figure 29: Expanded Input line on Formula Bar
Date and time
Select the cell and type the date or time. You can separate the date elements with a slash (/) or
a hyphen (–) or use text, for example 10 Oct 2020. The date format automatically changes to
the selected format used by Calc.
Note
Tools > Options > Languages and Locales > General > Formats > Date
acceptance patterns defines the date patterns that will be recognized by Calc. In
addition, every locale accepts input in an ISO 8601 YYYY-MM-DD pattern (for
example, 2020-07-26).
Chapter 2 Entering and Editing Data | 55
When you enter a time, separate time elements with colons, for example [Link]. The time
format automatically changes to the selected format used by Calc.
To change the date or time format used by Calc:
1) With the cell selected, open the Format Cells dialog (Figure 27).
2) Make sure the Numbers tab is selected, then select Date or Time in the Category list.
3) Select the date or time format you want to use from the Format list.
4) Click OK to save the changes and close the dialog.
Note
The date format will be influenced by the system or document language settings.
Special characters
A special character is a character not normally found on a standard keyboard; for example, © ¾
æ ç ñ ö ø ¢. To insert a special character:
1) Select a cell and place the cursor in the cell or in the Input line, at the point where you
want the character to appear.
2) Go to Insert > Special Character on the Menu bar to open the Special Characters
dialog (Figure 30).
Figure 30: Special Characters dialog
3) From the grid of characters, select the desired character. The last character selected is
shown on the right of the Special Characters dialog along with its numerical code.
4) Any recently inserted characters are shown below the grid of characters and can be
selected in the same way as any other character in the dialog.
56 | Calc Guide 26.2
5) Double-click a special character to insert it into the cell, without closing the dialog. Click
Insert to insert a selected special character into the cell and close the dialog.
Tip
At the bottom of the Special Characters dialog there is provision for building a small
collection of Favorite Characters. To add a new character to the collection, select the
desired character and click the Add to Favorites button. To remove an existing
character from the collection, select the character and click the Remove from
Favorites button.
Alternately, Windows users can use Alt+NumPad to input Unicode characters. For example,
holding the Alt key and typing 955 on the numeric keypad produces the Greek small letter
lambda (λ) from its decimal equivalent 955. Similarly, users of other platforms may input Unicode
characters by typing a two-digit hex code and then pressing Alt+X. For example, typing A9 and
then pressing Alt+X inserts a copyright symbol (@). This method also works for Windows users.
Linux users who have assigned a Compose key can use Compose to insert supported special
characters. For example, if the assigned Compose key is the Right Alt key, then pressing
Right Alt+m+u inserts the Greek small letter mu (µ) into the selected cell.
Tip
Clicking the More Characters button opens the full Special Characters dialog
(Figure 30).
You can quickly insert one of your recent or favorite special characters by clicking the
Insert Special Characters icon (Ω) on the Standard toolbar and selecting the
required character or character name from the drop-down.
Figure 31: Special Character dialog
Note
Different fonts include different special characters. If you do not find a particular
special character you want, try changing the Font and Subset selections.
Autocorrect options
By default, Calc automatically applies many changes during data input using AutoCorrect. You
can undo any AutoCorrect changes by selecting Edit > Undo on the Menu bar, pressing the
Chapter 2 Entering and Editing Data | 57
keyboard shortcut Ctrl+Z, or manually going back to the change and replacing the
autocorrection with what you actually want to see.
To change the AutoCorrect options, go to Tools > AutoCorrect Options on the Menu bar to
open the AutoCorrect dialog (Figure 32).
Figure 32: AutoCorrect dialog
• Replace – edit the replacement table for automatically correcting or replacing words or
abbreviations.
• Exceptions – specify the abbreviations or letter combinations that you do not want
corrected automatically.
• Options – select the options for automatically correcting errors as you type.
• Localized Options – specify the AutoCorrect options for quotation marks and for
options that are specific to the language of the text.
• Reset – reset modified values back to their previous values.
Inserting dashes
Calc provides text shortcuts so that you can quickly insert dashes into a cell and these shortcuts
are shown in Table 4.
Table 4: Inserting dashes
Text that you type Result
A - B (A, space, hyphen, space, B) A – B (A, space, en-dash, space, B)
A -- B (A, space, hyphen, hyphen, space, B) A – B (A, space, en-dash, space, B)
A--B (A, hyphen, hyphen, B) A—B (A, em-dash, B)
A-B (A, hyphen, B) A-B (unchanged)
A -B (A, space, hyphen, B) A -B (unchanged)
A --B (A, space, hyphen, hyphen, B) A –B (A, space, en-dash, B)
58 | Calc Guide 26.2
Accelerating data entry
Calc includes built-in tools that help reduce the time required to enter data into a spreadsheet.
The tools include:
• AutoInput
• Fill Tool
• Selection Lists
• Data Entry Form Tool
Each tool is described in the sections that follow.
AutoInput tool
The AutoInput function in Calc automatically completes entries, based on other entries in the
same column.
When text is highlighted in a cell, AutoInput can be used as follows:
• Press Enter to accept the completion and move to the next cell. Press F2 to accept the
completion and move the cursor to the end of the text inside the cell. Clicking outside
the cell will accept the completion and select the clicked cell.
• When multiple matches continue with the same letters they will appear in the cell after
what has already been typed. Press → to accept the partial completion and move the
cursor to the end of the text inside the cell.
• To view more completions that start with the same letters, use the key combinations
Ctrl+Tab to scroll forward, or Ctrl+Shift+Tab to scroll backward.
• To see a list of all available AutoInput text items for the current column, use the
keyboard combination Alt+↓. See Selection lists on page 64 for more information.
When typing formulas using characters that match function names, a Help tip will appear listing
the available functions that start with matching characters.
AutoInput ignores the case sensitivity of any data you enter. If, for example, you have written
Total in a cell, you cannot then use AutoInput to enter total in another cell of the same
column without first deactivating AutoInput or entering total manually.
By default, AutoInput is activated in Calc. To turn it off, go to Tools on the Menu bar and deselect
AutoInput.
Fill tool
You can use the Fill tool in Calc to duplicate existing content or create a series in a range of cells
in the spreadsheet as shown by the examples in Figure 33.
1) Select the cell containing the contents you want to copy or start the series from.
2) Drag the mouse pointer in any direction or hold down the Shift key and click in the last
cell you want to fill.
3) Go to Sheet > Fill Cells on the Menu bar and select the direction in which you want to
copy or create data (Down, Right, Up, Left, Sheets, Series, or Random Number).
A menu option will be grayed out if it is not available.
Chapter 2 Entering and Editing Data | 59
Figure 33: Examples of using the Fill tool
Tip
You can use the keyboard shortcut Ctrl+D as an alternative to selecting Sheet > Fill
Cells > Fill Down on the Menu bar.
Alternatively, you can use a shortcut to fill cells:
1) Select the cell containing the contents you want to copy or start the series from.
2) Move the pointer over the small selection handle in the bottom right corner of the
selected cell. The pointer will change shape.
3) Click and drag in the direction you want the cells to be filled, vertical or horizontal. If the
original cell contained text, then the text will automatically be copied. If the original cell
contained a number or text from a defined list (see Defining a fill series on page 61), a
series will be created. To duplicate the number or text instead, hold Ctrl while
dragging.
Caution
When you are selecting cells so you can use the Fill tool, make sure that none of the
cells contain data, except for the cell data you want to use. When you use the Fill
tool, any data contained in selected cells is overwritten.
Using a fill series
When you select a series fill from Sheet > Fill Cells > Fill Series on the Menu bar, the
Fill Series dialog (Figure 34) opens. Here you can select the type of series you want or create
your own list.
• Direction – determines the direction of series creation.
– Down – creates a downward series in the selected cell range for the column using
the defined increment to the end value.
– Right – creates a series running from left to right within the selected cell range using
the defined increment to the end value.
– Up – creates an upward series in the selected cell range of the column using the
defined increment to the end value.
– Left – creates a series running from right to left within the selected cell range using
the defined increment to the end value.
60 | Calc Guide 26.2
Figure 34: Fill Series dialog
• Series Type – defines the series type. These are:
– Linear – creates a linear number series using the defined increment and end value.
– Growth – creates a growth series using the defined increment and end value.
– Date – creates a date series using the defined increment and end date.
– AutoFill – forms a series directly in the sheet. The AutoFill function takes account of
customized lists. For example, by entering January in the first cell, the series is
completed using the list defined in Tools > Options > LibreOffice Calc > Sort
Lists. AutoFill tries to complete a value series by using a defined pattern. For
example, a numerical series using 1,3,5 is automatically completed with
7,9,11,13; a date and time series using 01.01.99 and 15.01.99, is completed
using an interval of fourteen days.
• Time Unit – in this area you specify the desired unit of time. This area is only active if
the Date option has been selected in Series Type. The options are:
– Day – creates a series using seven days.
– Weekday – creates a series of five day sets.
– Month – creates a series from the names or abbreviations of the months.
– Year – creates a series of years.
• Start value – determines the start value for the series. Use numbers, dates, or times.
• End value – determines the end value for the series. Use numbers, dates, or times.
• Increment – determines the value by which the series of the selected type increases by
each step. Entries can only be made if the linear, growth, or date series types have
been selected.
Defining a fill series
To define your own fill series:
1) Go to Tools > Options > LibreOffice Calc > Sort Lists to open the Sort Lists dialog
(Figure 35). This dialog shows any previously defined series in the Lists box on the left
and the contents of the highlighted list in the Entries box.
2) Click New to clear the Entries box.
Chapter 2 Entering and Editing Data | 61
3) Type the series for the new list in the Entries box, with one entry per line (Figure 36).
4) Click Add and the new list will now appear in the Lists box.
5) Click OK to save the new list and close the dialog.
Figure 35: Sort Lists dialog
Figure 36: Creating a new sort list
Fill with random numbers
Populate a cell range with automatically generated pseudo-random numbers using the selected
distribution function and its specified parameters.
When you select a random number fill from Sheet > Fill Cells > Fill Random Number on the
Menu bar, the Random Number Generator dialog (Figure 37) opens. Here you can select the
type of random numbers you want.
62 | Calc Guide 26.2
Figure 37: Random Number Generator dialog
Cell Range
Define the range of cells to fill with random numbers. If you have previously selected a
range, it will be displayed here.
Distribution
Select the distribution function for the random number generator. Available distributions
are:
– Uniform
– Uniform Integer
– Normal
– Cauchy
– Bernoulli
– Binomial
– Chi Squared
– Geometric
– Negative Binomial
– Poisson.
Distribution parameters
Define parameters related to the selected distribution type, as follows:
– Uniform and Uniform Integer. Specify minimum and maximum values.
– Normal. Specify mean and standard deviation.
– Cauchy. Specify median and sigma.
– Bernoulli and Geometric. Specify p-value.
Chapter 2 Entering and Editing Data | 63
– Binomial and Negative Binomial. Specify p-value and number of trials.
– Chi Squared. Specify degrees of freedom (nu).
– Poisson. Specify mean.
Enable custom seed
Set a value to initiate the random number generator algorithm. It is used to initialize
(seed) the random number generator in order to reproduce the same sequence of
pseudo-random numbers. Specify a positive integer to produce a specific sequence.
Enable rounding
Round the generated numbers to the given number of decimal places.
Selection lists
Selection lists are available only for text and are limited to using only text that has already been
entered in the same column.
1) Select a blank cell in a column that contains cells with text entries.
2) Right-click and select Selection List in the context menu, or use the keyboard shortcut
Alt+↓. A drop-down list appears listing any cell in the same column that either has at
least one text character or whose format is defined as text.
3) Click on the text entry you require and it is entered into the selected cell.
Data Form tool
The Data Form tool makes table data entry easier in spreadsheets, accelerating intensive
manual input. Using the tool you can enter, edit, and delete data records (or rows) and avoid
horizontal scrolling when the table has many columns or when some columns are very wide.
To be effective, the data table should have a header row, where the content of each cell is the
title of the column. The content of each header cell becomes the label for each data field in the
form.
To use the Data Form tool:
1) Select a header or data cell within the table of data.
2) Go to Data > Form on the Menu bar.
3) Calc displays the Data Form dialog (Figure 38), showing the data for the first entry in
the data table.
4) Add, edit, or remove entries from the data table as required.
5) Click the Close button to close the dialog.
The Data Form dialog provides a text entry field for displaying, editing, or entering the value of
each cell within one row of the data table. In addition, the dialog provides the following options:
• New – Fill the record (table row cells) using the content of form fields and jump to the
next record, or add a new record at the bottom of the table. Alternatively press the
Enter key to add new or updated data to the data table.
• Delete – Deletes the current record.
• Restore – When a form field is edited, restore the record contents to its initial state.
• Previous Record – Move to the previous record.
• Next Record – Move to the next record.
• Close – Close the form.
64 | Calc Guide 26.2
Figure 38: Using the Data Form tool
Tip
Use the Tab and Shift+Tab keys to jump forward and backward between text boxes
of the Data Form dialog. In addition, you can use the form’s scroll bar to move
between records.
Tip
Move to the last record before entering a new record, otherwise the current record
will be edited.
Merging and splitting cells
Merging
You can select contiguous cells and merge them into one as follows:
1) Select the range of contiguous cells you want to merge.
2) Go to Format > Merge Cells > Merge Cells or Merge and Center Cells on the Menu
bar, or click on the Merge and Center Cells icon on the Formatting toolbar, or right-
click on the selected cells and select Merge Cells in the context menu. Using Merge
and Center Cells will center align any contents in the cells.
3) If the cells contain any data, the Merge Cells dialog (Figure 39) opens, showing choices
for moving or hiding data in the hidden cells.
4) Make your selection and click OK.
Caution
Merging cells can lead to calculation errors in formulas used in the spreadsheet.
Chapter 2 Entering and Editing Data | 65
Figure 39: Merge choices for non-empty cells
Splitting
To reverse a merge operation by splitting a cell that was previously created by merging several
cells.
1) Select a merged cell.
2) Go to Format > Merge Cells > Split Cells on the Menu bar, or click on the Merge and
Center Cells icon on the Formatting toolbar, or right-click and select Split Cells in the
context menu.
3) Any data in the cell will remain in the first cell. If the hidden cells did have any contents
before the cells were merged, then you may have to manually move the contents to the
correct cell.
Sharing content between sheets
Instead of entering information on each sheet individually, for example to set up standard listings
for a group of individuals or organizations, you can enter it in several sheets at the same time. To
enter the same information in the same cell on multiple sheets.
Figure 40: Select Sheets dialog
1) Go to Edit > Select > Select Sheets on the Menu bar to open the Select Sheets dialog
(Figure 40).
2) Select the individual sheets where you want the information to be repeated.
3) Click OK to select the sheets and the sheet tabs will be highlighted.
66 | Calc Guide 26.2
4) Enter the information in the cells on the sheet where you want the information to first
appear and the information will be repeated in the selected sheets.
5) Deselect the sheets when you have finished entering the information that you want
repeated in the sheets.
Tip
You can select sheets with the mouse, as described in the Selecting sheets section
of Chapter 1, Introduction.
Caution
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 have finished entering the information to be repeated before
continuing to enter data into the spreadsheet.
Validating cell contents
When creating spreadsheets for other people to use, you may want to make sure they enter data
that is valid or appropriate for the cell. You can also use validation in your own work as a guide
to entering data that is either complex or rarely used.
Fill series and selection lists can handle some types of data, but are limited to predefined
information. For example, a cell may require a date or a whole number with no alphabetic
characters or decimal points, or a cell may not be left empty.
You can also define the range of contents that can be entered, and provide help messages
explaining the content rules, when users enter invalid content. You can also set the cell to refuse
invalid content, accept it with a warning, or start a macro when an error is entered.
Defining validation
To validate any new data entered into a cell:
1) Select a cell and go to Data > Validity on the Menu bar to open the Validity dialog
(Figure 41).
2) Define the type of contents that can be entered in that cell using the options given on
the tabbed pages for Criteria, Input Help, and Error Alert. The options are explained
below.
Criteria options
Specify the validation rules for the selected cells using the Criteria tab of the Validity dialog as
shown in Figure 41. For example, you can define criteria such as numbers between 1 and 10, or
text strings that are no more than 20 characters.
Chapter 2 Entering and Editing Data | 67
Figure 41: Validity dialog – Criteria tab
The options available on the Criteria tab will depend on what has been selected in the Allow
drop-down list.
• Allow – select a validation option for the selected cells from the drop-down list.
– All values – no limitation.
– Whole Numbers – only whole numbers allowed.
– Decimal – all numbers correspond to decimal format.
– Date – all numbers correspond to date format. The entered values are formatted the
next time the dialog is called up.
– Time – all numbers correspond to time format. The entered values are formatted the
next time the dialog is called up.
– Cell range – allow only values that are given in a cell range. The cell range can be
specified explicitly, or as a named database range, or as a named range. The range
may consist of one column or one row of cells. If you specify a range of columns and
rows, only the first column is used.
– List – allow only values or strings specified in a list. Strings and values can be
mixed. Numbers evaluate to their value, so if you enter the number 1 in the list, the
entry 100% is also valid.
– Text length – allow entries whose length matches the condition on the number of
characters that has been set.
– Custom – allow entries that correspond to a formula entered in the Formula box.
• Allow empty cells – in conjunction with Tools > Detective > Mark Invalid Data, this
defines that blank cells are shown as invalid data (disabled) or not shown (enabled).
• Case-sensitive – requires that the cell’s contents match the case of the valid strings.
For example, if Case sensitive is selected, and the valid string is North, then north will
not validate. Case sensitivity is disabled by default.
68 | Calc Guide 26.2
• Show selection list – shows a list of all valid strings or values to select from. The list
can be opened either by clicking the down arrow at the right of the cell, or by selecting
the cell and pressing Alt+↓.
• Sort entries ascending – sorts the selection list in ascending order and filters
duplicates from the list. If not checked, the order from the data source is taken.
• Source – enter the cell range that contains the valid values or text.
• Entries – enter the entries that will be valid values or text strings.
• Data – select the comparative operator that you want to use from the drop-down list.
The available operators depend on what you have selected in the Data drop-down list.
For example, if you select valid range, the Minimum and Maximum input boxes replace
the Value box.
• Value – enter the value for the data validation option that you selected in the Data drop-
down list.
• Minimum – enter the minimum value for the data validation option that you selected in
the Data drop-down list.
• Maximum – enter the maximum value for the data validation option that you selected in
the Data drop-down list.
• Formula – enter a formula that can be interpreted as true (non-zero) or false (zero) to
provide a custom validation. For example, assuming cell A4 was selected before
opening the dialog, you could enter ISEVEN(A4) to indicate that only even values
should be entered in cell A4.
Input Help options
Enter the message to be displayed when the cell or cell range is selected in the spreadsheet
(Figure 42).
• Show input help when cell is selected – displays the message that you enter in the
Title and Input help boxes when the cell or cell range is selected in the sheet. If you
enter text in the Title and Input help boxes and then deselect this option, the text will not
be displayed.
• Title – enter the title to be displayed when the cell or cell range is selected.
• Input help – enter the message to be displayed when the cell or cell range is selected.
Figure 42: Validity dialog – Input Help tab
Chapter 2 Entering and Editing Data | 69
Error Alert options
Define the error message that is displayed when invalid data is entered in a cell (Figure 43).
Figure 43: Validity dialog – Error Alert tab
• Show error message when invalid values are entered – when selected, displays the
error message that you enter in the Contents area when invalid data is entered in a cell.
• Action – select the action that you want to occur when invalid data is entered in a cell.
– Stop – rejects the invalid entry and displays a dialog that you have to close by
clicking OK.
– Warning and Information – displays a dialog that can be closed by clicking OK or
Cancel. The invalid entry is only rejected when you click Cancel.
– Macro – activates the Browse button to open the Macro Selector dialog where you
can select a macro that is executed when invalid data is entered in a cell. The macro
is executed after the error message is displayed.
• Title – enter the title of the macro or the error message that you want to display when
invalid data is entered in a cell.
• Error message – enter the message that you want to display when invalid data is
entered in a cell.
Calc Detective
The Detective is a tool within Calc that you can use to locate any cells in a spreadsheet that
contain invalid data if the cells are set to accept invalid data with a warning.
1) Go to Tools > Detective > Mark Invalid Data on the Menu bar to locate any cells
containing invalid data. The Detective function marks any cells containing invalid data.
2) Correct the data so that it becomes valid.
3) Go to Tools > Detective > Remove All Traces on the Menu bar and any cells that
were previously marked as containing invalid data have the invalid data mark removed.
70 | Calc Guide 26.2
Note
A validity rule is considered part of the format for a cell. If you select Delete all on the
Delete Contents dialog (Figure 45), then it is removed. If you want to copy a validity
rule with the rest of the cell, use Edit > Paste Special > Paste Special to open the
Paste Special dialog (Figure 46), then select Paste all or Formats and click OK.
Modifying data
Deleting data
Deleting cell data only
Data can be deleted from a cell without deleting any of the cell formatting. Select a cell or a
range of cells and then press the Delete key.
Deleting cells
This option completely deletes selected cells, columns, or rows. The cells below or to the right of
the deleted cells will fill the space.
1) Select a cell or a range of cells.
2) Select Sheet > Delete Cells on the Menu bar, or right-click inside the selected cells and
choose Delete in the context menu, or press the Ctrl+– keys.
Figure 44: Delete Cells dialog
3) The Delete Cells dialog (Figure 44) provides four options to specify how sheets are
displayed after deleting cells:
– Shift cells up. Fills the resulting space with data from the cells underneath.
– Shift cells left. Fills the resulting space with data from the cells to the right of the
deleted cells.
– Delete entire row(s). After selecting at least one cell, deletes the entire row from
the sheet.
– Delete entire column(s). After selecting at least one cell, deletes the entire column
from the sheet.
4) To confirm the selection, click OK.
Note
The selected delete option is stored and reloaded when the dialog is next opened,
until LibreOffice is closed. After opening LibreOffice again the delete option contains
the default setting.
Chapter 2 Entering and Editing Data | 71
Deleting data and formatting
Data and cell formatting can be deleted from a cell at the same time. To do this:
1) Select a cell or a range of cells.
2) Select Sheet > Clear Cells on the Menu bar, or right-click inside the selected cells and
choose Clear Contents from the context menu, or press the Backspace key.
3) In the Delete Contents dialog (Figure 45), choose any of the options or choose
Delete all. Click OK.
Figure 45: Delete Contents dialog
Replacing data
To completely replace data in a cell and insert new data, select the cell and type in the new data.
The new data will replace the data already contained in the cell and will retain the original
formatting used in the cell.
Alternatively, click in the Input line on the Formula Bar, then double-click on the data to highlight
it completely and type the new data.
Editing data
Sometimes it is necessary to edit the contents of a 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.
Using the keyboard
To edit data with the keyboard:
1) Click in the cell to select it.
2) Press the F2 key to place the cursor at the end of the cell.
3) Press the Backspace key to delete any data up to the point where you want to enter
new data.
4) Alternatively, use the keyboard arrow keys to reposition the cursor where you want to
start entering the new data in the cell, then press the Delete key or Backspace key to
delete any unwanted data before typing the new data.
5) When you have finished editing, press the Enter key to save the changes.
Tip
Each time you select a cell, the contents are displayed in the Input line on the
Formula Bar. Using the Input line may be easier when editing data.
72 | Calc Guide 26.2
Using the mouse
1) Double-click on the cell to select it and place the cursor in the cell for editing.
2) Reposition the cursor to where you want to start editing the data in the cell.
3) Alternatively, single-click to select the cell, then move the cursor to the Input line on the
Formula Bar and click at the position where you want to start editing the data in the cell.
4) When you have finished, click away from the cell to deselect it and the editing changes
are saved.
Paste Special function
You can use the Paste Special function to paste into another cell selected parts of the data in the
original cell or cell range, for example its format or the result of its formula.
Paste Special dialog
1) Select a cell or a cell range.
2) Go to Edit > Copy on the Menu bar, or click the Copy icon on the Standard toolbar, or
right-click and select Copy in the context menu, or press Ctrl+C.
3) Select the target cell or cell range.
4) Go to Edit > Paste Special > Paste Special on the Menu bar, or right-click and select
Paste Special > Paste Special in the context menu, or use the keyboard shortcut
Ctrl+Shift+V, to open the Paste Special dialog (Figure 46).
5) Select the options for Paste, Operations, Options, and Shift Cells. The Paste Special
options are explained below.
6) Click OK to paste the data into the target cell or range of cells and close the dialog.
Figure 46: Paste Special dialog
Chapter 2 Entering and Editing Data | 73
Tip
Instead of steps 5) and 6) above, you can choose one of the four preset options at
the left of the dialog – Values Only, Values & Formats, Formats Only, or
Transpose All. With the Run immediately checkbox ticked, clicking one of these
shortcut buttons actions the requested paste operation and closes the dialog.
Paste Special options
• Paste – select a format for the clipboard contents that you want to paste.
– All – pastes all cell contents, comments, formats, and objects into the current
document.
– Numbers – pastes cells containing numbers.
– Text – pastes cells containing text.
– Date & time – pastes cells containing date and time values.
– Formats – pastes cell format attributes.
– Comments – pastes comments that are attached to cells. If you want to add the
comments to the existing cell content, select the Add operation.
– Objects – pastes objects contained within the selected cell range. These can be
OLE objects, chart objects, or drawing objects.
– Formulas – pastes cells containing formulas.
• Operations – select the operation to apply when you paste cells into the sheet.
– None – does not apply an operation when you insert the cell range from the
clipboard. The contents of the clipboard will replace existing cell contents.
– Add – adds the values in the clipboard cells to the values in the target cells. Also, if
the clipboard only contains comments, adds the comments to the target cells.
– Subtract – subtracts the values in the clipboard cells from the values in the target
cells.
– Multiply – multiplies the values in the clipboard cells with the values in the target
cells.
– Divide – divides the values in the target cells by the values in the clipboard cells.
• Options – sets the paste options for the clipboard contents.
– As Link – inserts the cell range as a link, so that changes made to the cells in the
source file are updated in the target file. To ensure that changes made to empty
cells in the source file are updated in the target file, ensure that All is selected in the
Paste area. You can also link sheets within the same spreadsheet. When you link to
other files, a Dynamic Data Exchange (DDE) link is automatically created. A DDE
link is inserted as a matrix formula and can only be modified as a whole.
– Transpose – pastes the rows of the range in the clipboard as columns of the output
range, and the columns of the range in the clipboard as rows.
– Skip empty cells – does not replace target cells with empty cells from the clipboard.
If you use this option in conjunction with the Multiply or the Divide operation, the
operation is not applied to the target cell of an empty cell in the clipboard. If you
select a mathematical operation and deselect Skip empty cells, empty cells in the
clipboard are treated as zeroes. For example, if you apply the Multiply operation, the
target cells are filled with zeroes.
74 | Calc Guide 26.2
• Shift Cells – set the shift options for the target cells when the clipboard content is
inserted.
– Don't shift – replaces target cells with inserted cells.
– Down – shifts target cells downward when you insert cells from the clipboard.
– Right – shifts target cells to the right when you insert cells from the clipboard.
Paste Only options
If you only want to copy text, numbers, or formulas to the target cell or cell range:
1) Select the source cell or cell range and copy the data.
2) Select the target cell or cell range.
3) Right-click on the target cell or cell range and select Paste Special in the context menu,
then select Text, Number, or Formula.
4) Alternatively, use the Paste Only Text, Paste Only Numbers, or Paste Only Formula
options in the Edit > Paste Special menu on the Menu bar.
Insert cell fields
You can insert a field linked to the date, sheet name, or document name in to a cell.
1) Select a cell and double-click to activate edit mode.
2) Right-click and select Insert Field > Date, Time, Sheet Name or Document Title in the
context menu.
3) Alternatively choose Insert > Field from the Menu bar, then select Date, Time, Sheet
Name or Document Title from the Field sub‑menu.
Note
The Insert Field > Document Title command inserts the name of the spreadsheet
and not the title defined on the Description tab of the Properties dialog for the file.
Tip
The fields are refreshed when the spreadsheet is saved or recalculated when using
the Ctrl+Shift+F9 shortcut.
Group and outline
Rows or columns may be grouped together so that the cells may be hidden or shown using a
single click.
The plus (+) or minus (-) controls on the group indicator are used to show or hide rows or
columns. However, if there are groups nested within each other, the basic controls have
numbered buttons so you can hide the different levels of nested groups.
Grouping
To group rows or columns:
1) Select the cells you want to group in the spreadsheet.
2) Go to Data > Group and Outline > Group on the Menu bar, or press the F12 key.
Chapter 2 Entering and Editing Data | 75
3) In the Group dialog, select either Rows or Columns and click OK. A group indicator
appears to the left of any rows grouped or above any columns grouped. Figure 47
shows a group indicator on the left of the first two rows of the spreadsheet showing that
they have been grouped.
Figure 47: Group indicator
Hiding details
To hide the details of any group of rows or columns:
1) Click on the minus (–) sign on the group indicator.
2) Alternatively, select a cell within the group and go to Data > Group and Outline >
Hide Details on the Menu bar.
3) The rows or columns are hidden and the minus (–) sign becomes a plus (+) sign on the
group indicator.
Showing details
To show the details of any hidden groups of rows or columns:
1) Click on the plus (+) sign on the Group indicator.
2) Alternatively, select a cell on each side of the hidden group and go to Data > Group
and Outline > Show Details on the Menu bar.
3) The hidden rows or columns are displayed and the plus (+) sign becomes a minus (–)
sign on the group indicator.
Ungrouping
To ungroup any groups of rows or columns:
1) Make sure the grouped rows or columns are displayed and click on a cell within the
group.
2) Go to Data > Group and Outline > Ungroup on the Menu bar, or use the keyboard
combination Ctrl+F12.
3) If only rows or only columns are grouped, they are ungrouped. If both rows and columns
are grouped, select either Rows or Columns on the Ungroup dialog and click OK.
Caution
Any hidden groups of rows or columns must be displayed. If they are hidden, then
the grouped rows or columns are deleted from the spreadsheet.
Note
If there are nested groups, only the last group of rows or columns created is
ungrouped.
76 | Calc Guide 26.2
AutoOutline
If a selected cell range contains formulas or references, Calc can automatically outline the
selection. For example, in Figure 48 the cells for Quarter 1 and Quarter 2 each contain a
sum formula for the three cells to their left. If you apply the AutoOutline command, the columns
are grouped into two quarters.
To apply the AutoOutline function, go to Data > Group and Outline > AutoOutline on the Menu
bar. Calc will then check for cells that contain formulas or references and automatically group the
cells as necessary.
Figure 48: Example of AutoOutline
Removing
To remove any cell groups of rows or columns, go to Data > Group and Outline > Remove
Outline on the Menu bar and any groups are removed.
For any cell group of rows or columns that are hidden, the grouping is removed from the cells
and the cells are displayed in the spreadsheet.
Filtering
A filter is a list of conditions that each entry has to meet to be displayed. Calc provides three
types of filters:
• Standard – specifies the logical conditions to filter the data.
• AutoFilter – filters data according to a specific value or string. Automatically filters the
selected cell range and creates one-row list boxes where you can choose the items that
you want to display.
• Advanced – uses filter criteria from specified cells.
Applying a standard filter
A standard filter is more complex than the AutoFilter. You can set as many as eight conditions as
a filter, combining them with the operators AND or OR. Standard filters are mostly useful for
numbers, although a few of the conditional operators can also be used for text.
1) Select a cell range in the spreadsheet.
2) Go to Data > More Filters > Standard Filter on the Menu bar to open the Standard
Filter dialog (Figure 49).
3) Specify the filter criteria and filtering options that you want to use.
4) Click OK to carry out standard filtering and close the dialog. Any records that match the
filter criteria and options that you specified are shown.
Chapter 2 Entering and Editing Data | 77
Figure 49: Standard Filter dialog
Use the Standard Filter dialog to define the filter conditions to be combined to form the overall
filter criteria. Each filter condition is specified by indicating the type of logical operator, the name
of a field, a logical condition, and a value.
• Operator – for the following arguments, you can choose between the logical operators
AND and OR. No logical operator is specified for the first filter condition in the list.
• Field name – specifies the field names from the current table to set them in the
argument. You will see the column identifiers if no text is available for the field names.
• Condition – specifies the comparative operators through which the entries in the
Field name and Value fields can be linked.
• Value – specifies a value to filter the field. The Value list box contains all possible
values for the specified Field name. Select a value to be used in the filter, including
Empty and Not Empty entries.
• Remove – deletes the associated filter criterion from the Filter Criteria area.
• Case-sensitive – distinguishes between uppercase and lowercase letters when filtering
the data.
• Range contains column labels – includes the column labels in the first row of a cell
range.
• Copy results to – select the checkbox and then select the cell range where you want to
display the filter results. You can also select a named range from the list.
• Regular expressions – select to use regular expressions in the filter definition. If
selected, you can use regular expressions in the Value field of the Standard Filter dialog
if the Condition field is set to “=” (equal) or “<>” (not equal). For more information about
regular expressions, see the section entitled Searching and filtering with regular
expressions later in this chapter.
• No duplications – excludes duplicate rows from the list of filtered data.
• Keep filter criteria – select Copy results to and then specify the destination range
where you want to display the filtered data. If this box is checked, the destination range
remains linked to the source range. You must have defined the source range under
78 | Calc Guide 26.2
Data > Define Range as a database range. You can also reapply the defined filter at
any time by clicking into the source range and then going to Data > Refresh Range.
Applying an AutoFilter
An AutoFilter adds a drop-down list to the top row of one or more data columns which lets you
select the rows to be displayed. The list includes every unique entry in the selected cells sorted
into lexical order (see [Link] for an explanation of
lexical order). AutoFilter can be used on multiple sheets without first defining a database range.
1) Click in a cell range on the spreadsheet. If you want to apply multiple AutoFilters to the
same sheet, you must first define database ranges, then apply the AutoFilters to the
database ranges.
2) Go to Data > AutoFilter on the Menu bar, click the AutoFilter icon on the Standard
toolbar, or press Ctrl+Shift+L. An arrow button is added to the head of each column
in the database range and the size of these buttons scales according to the sheet’s
zoom level.
3) Click the arrow or small triangle in the column that contains the value or string that you
want to set as the filter criteria (shown in Figure 50).
4) Select one or more values or enter a string to be used as the filter criteria in the
Search items box. After clicking OK only the records matching the filter criteria will be
visible. Rows affected by the AutoFilter will have their numbers displayed in blue.
Columns where filtering conditions were created will display the arrow button in blue.
Figure 50: AutoFilter example
Filtering by color
You can filter data by the background or font colors used in the cells of a column of interest.
• The AutoFilter drop-down provides a Filter by Color menu containing an entry for each
background color used. In the example shown in Figure 51, the menu provides three
Chapter 2 Entering and Editing Data | 79
entries indicating that some cells have a light green background, others have a yellow
background, and the remainder have no background color set (No Fill).
Figure 51: Filtering by font and background colors
• The Filter by Color menu on the AutoFilter drop-down also contains an entry for each
font color used. In the example shown in Figure 51, the menu provides three entries
indicating that some cells have a black font, others have a blue font, and the remainder
have a red font. In this case there are no cells that utilize the automatically assigned
font (“Automatic”). The colors presented in this menu include those assigned through
custom number format codes.
Note
It is not possible to filter by a combination of different colors.
Filtering by condition
The AutoFilter drop-down provides a Filter by Condition menu containing five entries:
• Empty. Filter data to show only rows with empty cells in the relevant column.
• Not Empty. Filter data to show only rows with non-empty cells in the relevant column.
• Top 10. Displays the ten rows of the cell range that contain the largest values in the
cells of the current column. If these values are unique then no more than ten rows will
be visible, but if the values are not unique then it is possible for more than ten rows to
be shown.
• Bottom 10. Displays the ten rows of the cell range that contain the smallest values in
the cells of the current column. If these values are unique then no more than ten rows
will be visible, but if the values are not unique then it is possible for more than ten rows
to be shown.
• Standard Filter. Displays the Standard Filter dialog (see Figure 49).
80 | Calc Guide 26.2
Figure 52: Filtering by condition
Applying an advanced filter
An advanced filter has a structure similar to a standard filter. The difference is that the advanced
filter arguments are not entered in a dialog. Instead, filters can be entered in a blank area of a
spreadsheet, then referenced by the filter dialog to apply the filters.
1) Select a cell range in the spreadsheet.
2) Go to Data > More Filters > Advanced Filter on the Menu bar to open the Advanced
Filter dialog (Figure 53).
3) In Read Filter Criteria From, select the named range, or enter the cell range that
contains the filter criteria that you want to use.
4) Click OK to carry out advanced filtering and close the dialog. Any records that match
the filter criteria and options that you specified are shown.
Figure 53: Advanced Filter dialog
Chapter 2 Entering and Editing Data | 81
Note
The options for advanced filtering are the same as those used for standard filtering,
see Applying a standard filter on page 77 for more information.
For an example of an advanced filter, see the Help page entitled Filter: Applying Advanced
Filters.
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 criterion 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 a 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 can then sort the records to
update the spreadsheet.
Sort dialog
To sort cells in a spreadsheet using the Sort dialog:
1) Select the cells, rows, or columns to be sorted.
2) Go to Data > Sort on the Menu bar, or click the Sort icon on the Standard toolbar, to
open the Sort dialog.
3) On the Sort Criteria tab (Figure 54), select the criteria in the drop-down lists.
The selection lists are populated from the selected cells.
Figure 54: Sort dialog – Sort Criteria tab
4) Select either Ascending order (A-Z, 0-9) or Descending order (Z-A, 9-0).
5) Headers – omits the first column/row in the selection from the sort.
82 | Calc Guide 26.2
6) Direction – select Top to bottom (sort rows) to sort rows by the values in the active
columns of the selected range or select Left to right (sort columns) to sort columns by
the values in the active rows of the selected range.
7) On the Options tab (Figure 55), choose the sort options.
8) Click OK and the sort is carried out on the spreadsheet.
Note
If any of the cells that you select for sorting are protected and the sheet is protected,
then Calc cannot modify those cells and the sort will not be executed. An error
message will be displayed to indicate that protected cells cannot be modified.
However, it is possible to sort a range containing a row of column labels that are
protected, since these are not modified by the sort.
Sort options
On the Options tab of the Sort dialog (Figure 55), you can set these options:
Figure 55: Sort dialog – Options tab
Case sensitive
Sorting follows the collation rules of the document locale. In most Western locales,
lowercase letters appear before uppercase letters, while in others, the order is reversed.
For example, in the English (USA) locale, the order is 'a', 'A', 'b', 'B'. In the Danish
locale, however, the order is 'A', 'a', 'B', 'b'.
Tip
LibreOffice uses collation rules based on the International Components for Unicode
(ICU). For detailed collation information specific to your document locale, visit
[Link]
Chapter 2 Entering and Editing Data | 83
Include formats
Keep the current cell formatting even if the cell changes position after sorting. In case
you have applied an AutoFormat with alternating even-odd row formatting, then you
might want to unselect this option.
Enable natural sort
Natural sorting is an algorithm that orders string-prefixed numbers by their numerical
value, rather than treating them as plain text for comparison.
For example: the series of values A1, A15, A9, A4, A5, A17, ..., A2, A13,
A21 when sorted in natural order becomes
A1, A2, A3, A4, A5, A6, ..., A19, A20, A21.
The same set of values not sorted naturally becomes
A1, A11, A12, A13, ..., A19, A2, A20, A21, A3, A4, A5, ..., A9.
Recognize decimal separator: The decimal separator character, which varies by
locale, when included in the number that follows the text, indicate that it is a decimal
number. For example: A1.14, A1.2, A2.5, A10 (with a dot as the separator).
Decimal separator as regular character: The decimal separator character, which
varies by locale, does not indicate a decimal number when included in the following
text; instead, it is treated as a regular character. For example, A1.14 contains character
'A', number 1, character '.' and number 14.
Note
For Asian languages, select Case sensitive to apply multi-level collation. With multi-
level collation, entries are first compared in their primitive forms with their cases and
diacritics ignored. If they evaluate as the same, their diacritics are taken into account
for the second-level comparison. If they still evaluate as the same, their cases,
character widths, and Japanese Kana difference are considered for the third-level
comparison.
Include boundary column(s) containing only comments
Keeps these cells associated with the cells being sorted.
Include boundary column(s) containing only images
Keeps these cells associated with the cells being sorted.
Copy sort results to
Copies the sorted list to the cell range that you specify. Select a named cell range with
global scope or a database range where you want to display the sorted list.
Alternatively, enter the top-left cell of the target range in the input box.
Note
The copy process first copies the source data to the target range and then sorts the
data in place. This order of operations is important if the source range is unsorted
and contains formulas, as copying a range automatically adjusts the relative cell
references in those formulas.
Custom sort order
Select this option and then select the custom sort order that you want to apply. The
available selections are defined as “fill series” in Tools > Options > LibreOffice Calc >
Sort Lists. See Defining a fill series on page 61.
84 | Calc Guide 26.2
Locale
Select the language for the sorting rules.
Options
Select a sorting option for the language. For many languages this selection is grayed
out but for some languages options are available. For example, for German the default
choice is Alphanumeric, but you can also select the Phone book option to include the
umlaut special character in the sorting.
Quick sort
If the columns in the spreadsheet have a header with a text format, you can use a quick sort.
1) Select a cell or a cell range to be sorted.
2) Select Data > Sort Ascending or Data > Sort Descending on the Menu bar, or click
the Sort Ascending or Sort Descending icon on the Standard toolbar.
Handling duplicate records
Duplicate records in spreadsheets can complicate data analysis and skew results. Calc offers an
efficient tool for managing duplicates, allowing you to eliminate or select duplicated rows or
columns. This Handling Duplicates tool can also be utilized to clean up unwanted records. With
this tool, you can easily delete duplicates or highlight them for further review.
Handling Duplicates Records dialog
Duplicate records can show up in rows or columns (Figure 56)
1) Select the range containing the data.
2) Go to Data – Duplicates.
3) Select the comparison direction, if by Rows or by Columns.
4) Check the header checkbox if the first row or first column contains data headers, based
on your selection above. When the first row or column is identified as a data header, it
will not be treated as a duplicate record.
5) Choose the comparison operation. Selecting All means that all records will be
processed, excluding data headers. Alternatively, you can check the boxes for specific
rows or columns you wish to compare. For instance, you may want to focus on
identifying duplicates in columns 3 and 10 while excluding the other columns.
6) Choose the action to perform. Remove will delete he duplicates and Select will just
select them for later use.
Chapter 2 Entering and Editing Data | 85
Figure 56: Handing Duplicates Records dialog.
Note
When duplicate records are removed, the entire rows or columns in the range
containing those duplicates are deleted. This action causes the surrounding cells to
shift and fill the empty spaces left behind. If the comparison is conducted along the
rows, the cells below the removed duplicates will shift upward. Conversely, if the
comparison is done along the columns, the cells to the right of the deleted duplicates
will move leftward.
Find and replace
There are two ways to find text within a document in Calc: the Find toolbar and the Find and
Replace dialog. The toolbar is quick and easy to use, but its functions are more limited than
using the dialog.
Find toolbar
Figure 57: Find toolbar
1) Go to View > Toolbars > Find or Edit > Find on the Menu bar, or use the keyboard
shortcut Ctrl+F, to open the Find toolbar (Figure 57). By default, this toolbar is docked
in the lower left of the Calc window. You can undock the toolbar and move it.
2) Type a search term in the Find text box.
3) To refine the search, you can select the Match Case option. For example, if Owner is
the search term, selecting Match Case will find Owner but not owner. You can also
select the Find All or Formatted Display options.
4) Click the Find Next or Find Previous icon. To find other occurrences of the same term,
continue clicking the icon.
86 | Calc Guide 26.2
Find and Replace dialog
To open the Find and Replace dialog (Figure 58), go to Edit > Find and Replace on the Menu
bar, or click the Find and Replace icon on the Standard toolbar or the Find toolbar, or use the
keyboard shortcut Ctrl+H.
Find
1) In the Find and Replace dialog enter the search criteria in the Find box.
2) Select basic options from those located directly under the Find box.
3) If necessary, click on Other options to increase the number of search filters.
4) Click Find Next to locate the first instance of the search criteria.
5) Click Find Next again to locate the next instance of the search criteria. Repeat as
needed.
6) Or, click Find All to locate all cells containing the search criteria. These cells will be
highlighted in the spreadsheet. A Search Results dialog will pop up, listing the cell
locations.
Figure 58: Find and Replace dialog
Replace
1) In the Find and Replace dialog enter the search criteria in the Find box.
2) Select basic options from those located directly under the Find box.
3) Enter the replacement contents in the Replace box.
4) If necessary, click on Other options to increase the number of search filters.
5) To step through the cells and choose whether to replace the contents:
a) Click Find Next to locate the first instance of the search criteria.
Chapter 2 Entering and Editing Data | 87
b) If necessary, click Replace to replace the search criteria with the contents of the
Replace box.
c) Repeat as required.
6) Or, to locate and replace all instances of the search criteria without stopping at each
one, click Replace all. A Search Results dialog will pop up, listing the affected cells.
Tip
To replace the first instance of the search criteria you can simply press Replace
without pressing Find Next first.
Caution
Use Replace All with caution; otherwise, as it may produce unintended results.
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.
Find and Replace options
The options available to refine your find and replace are as follows:
• Find – enter the text that you want to search for, or select a previous search in the list.
• Match case – distinguishes between uppercase and lowercase characters.
• Formatted display – searches for cell contents in a particular format. For example, if
a cell has a currency value, say $123.45 and another has the same contents but
default formatting 123.45, then searching for $123.45 will find the currency cell but not
the default-formatted cell.
• Entire cells – searches for cells with contents that are identical to the search text.
• All sheets – Searches through all of the sheets in the current spreadsheet.
• Replace – enter the replacement text, or select a recent replacement text or style from
the list.
• Current selection only – searches only the selected text or cells.
• Replace backwards – search starts at the current cursor position and goes backwards
to the beginning of the spreadsheet.
• Wildcards – select to use wildcards in the search. A wildcard is a special character that
represents one or more unspecified characters. Wildcards make text searches more
powerful, but often less specific. The following wildcards are available:
– ? (question mark) matches any single character. For example, b?g finds “bag”,
“beg”, “big”, “bog”, and “bug”.
– * (asterisk) matches any sequence of characters, including an empty string. For
example, *cast finds “cast”, “forecast”, and “outcast”.
– ~ (tilde) escapes the special meaning of a question mark, asterisk, or tilde character
that follows immediately after the tilde character. For example, why~? finds “why?”.
• Regular expressions – select to use regular expressions in the search. Regular
expressions offer the most powerful method of searching for text strings. For more
information about regular expressions, see the section entitled Searching and filtering
with regular expressions later in this chapter.
88 | Calc Guide 26.2
• Similarity search – find terms that are similar to the Find text. Select this option, and
then click the Similarities button to define the similarity options on the Similarity Search
dialog.
• Cell Styles – searches for cell content formatted with the style that you specify. Select
this option and then select a style from the Find list. To specify a replacement style,
select a style from the Replace list.
• Diacritic-sensitive – include diacritics and accents in the search.
• Direction – determines the Rows or Columns order for searching the cells.
• Search in – select either Formulas, Values, or Comments to search for the characters
that you specify in the results of formulas, in values, or in comments.
Other options may appear depending on your language settings on the Tools > Options >
Languages and Locales > General page (for example, Match character width, Sounds like
(Japanese), Kashida-sensitive). See the Help system for more information about these options.
Note
The Wildcards, Regular expressions, and Similarity search options are mutually
exclusive; only one can be selected.
Search Results dialog
After you select Find All on the Find toolbar, or Find All or Replace All on the Find and Replace
dialog, Calc’s initial default behavior is to display the Search Results dialog (Figure 59) after it
has completed the operation. This dialog summarizes the results. In addition, affected cells are
highlighted in the spreadsheet.
The Search Results dialog lists the affected cells and their current content (after any
replacement). It also states the number of affected cells. If you deselect the Show this dialog
checkbox on the Search Results dialog before pressing the Close button, then the dialog will not
be displayed after future uses of Find All or Replace All. The display of the Search Results
dialog can also be controlled by enabling or disabling the Tools > Options > LibreOffice Calc >
View > Window > Summary on search option.
Figure 59: Search Results dialog
Chapter 2 Entering and Editing Data | 89
Searching and filtering with regular expressions
Regular expressions, often known as regex or regexp, are very powerful and enable users to
define complex search patterns for locating data of interest within a spreadsheet.
A regular expression is a string of characters defining a pattern of text that is to be matched.
More detailed, general background information can be found on Wikipedia at
[Link]
Regular expressions are widely used in many domains and there are multiple regular expression
processors available. Calc utilizes the open source Regular Expressions package from the
International Components for Unicode (ICU). See
[Link] for further details, including a full
definition of the syntax for ICU Regular Expressions.
Regular expressions appear in three areas of Calc’s functionality, as follows:
• Searching with the Find and Replace dialog, accessed by selecting Edit > Find and
Replace on the Menu bar, by clicking the Find and Replace icon on the Find toolbar, or
by pressing Ctrl+H.
• Filtering using the Standard Filter and Advanced Filter dialogs, accessed by selecting
Data > More Filters > Standard Filter and Data > More Filters > Advanced Filter.
• Functions. Many of Calc’s functions can use regular expressions in search criteria.
However, these only operate correctly if the Tools > Options > LibreOffice Calc >
Calculate > Formulas wildcards > Enable regular expressions in formulas option
has been selected. We also recommend that you enable the Tools > Options >
LibreOffice Calc > Calculate > General Calculations > Search criteria = and <>
must apply to whole cells option so that search criteria in formulas must match the
whole of the cell contents. See Chapter 9, Using Formulas and Functions, for more
information.
To illustrate the use of regular expressions we can use a sales data spreadsheet, the first few
rows of which are shown in Figure 60.
Figure 60: Spreadsheet data for example regular expressions
90 | Calc Guide 26.2
Unfortunately the data entry clerks do not know the sales personnel well and so the spreadsheet
contains a number of misspellings of Brigitte’s name. On inspecting the data, we notice that if we
could find all cells containing a string that begins with the characters Bri and then replace the
entire contents of each such cell with the string Brigitte, then the data in the spreadsheet
would be corrected. This can be achieved easily with a simple regular expression, as follows:
1) Select Edit > Find and Replace on the Menu bar. Calc opens the Find and Replace
dialog (Figure 61).
2) Type ^Bri.* into the Find field. The character ^ means match at the beginning; .
means match any character; and * means “match 0 or more times”.
3) Type Brigitte into the Replace field.
4) If necessary, click the icon to expand the Other options area of the dialog.
5) Make sure that the Regular expressions checkbox is checked.
6) Click Replace All. Calc updates the spreadsheet data, replacing all occurrences of
“Bridget” and “Brigid” with “Brigitte”.
7) Click Close to close the Find and Replace dialog.
Figure 61: Using a regular expression on the Find and Replace dialog
Suppose we want to filter the same spreadsheet (Figure 60) to show only data relating to the
Tennis and Golf categories, from the North and East regions. This is easily achieved using
regular expressions, using the following steps:
1) Click a cell within the sales data.
2) Select Data > More Filters > Standard Filter on the Menu bar to open the
Standard Filter dialog (Figure 62).
3) Select Category from the first drop-down menu in the Field name column.
4) Select = from the first drop-down menu in the Condition column.
5) Type Tennis|Golf in the first text box in the Value column.
6) Select AND from the first drop-down menu in the Operator column.
7) Select Region from the second drop-down menu in the Field name column.
Chapter 2 Entering and Editing Data | 91
8) Select = from the second drop-down menu in the Condition column.
9) Type North|East in the second text box in the Value column.
10) If necessary, click the icon to expand the Options area of the dialog.
11) Make sure that the Regular expressions checkbox is checked.
12) Click OK and Calc updates the data displayed in accordance with the specified filter
criteria.
Figure 62: Using regular expressions on the Standard Filter dialog
The data shown in Figure 63 can be used to show a simple example of a function call that
incorporates a regular expression. Suppose we wanted to calculate the revenue from the sale of
pencils, pencil cases, and pens. This can be achieved by entering the following formula into an
empty cell =SUMIFS(C2:C6; A2:A6; "^pen.*"), where the regular expression matches the
name of any product that starts with the characters pen. Alternatively we could calculate the
revenue from the sale of books and notebooks using the formula =SUMIFS(C2:C6; A2:A6;
".*book$"), where the regular expression matches the name of any product that ends with the
characters “book”.
Figure 63: Stationery sales and revenue data
In Calc there are 26 functions that support the use of regular expressions and these are listed in
Chapter 9, Using Formulas and Functions. The REGEX function is particularly powerful,
matching and extracting, or optionally replacing, text using regular expressions. For example the
formula =REGEX("123456ABCDEF";"[126]";"";"g") returns 345ABCDEF, where any
occurrence of "1", "2" or "6" is replaced by the empty string and is thus deleted.
92 | Calc Guide 26.2
Tip
The online help describes many more regular expressions and their uses.
Note
If interoperability with Microsoft Excel is important for your spreadsheet, then you
may not be able to fully utilize Calc’s regular expression facilities because Excel
does not provide equivalent facilities. Hence, when you export a Calc spreadsheet to
Excel format, information relating to regular expressions will not be usable within
Excel. In this case you can use the less powerful wildcards facility provided by Calc
because spreadsheets that utilize wildcards can be exported to Excel format without
loss of data. See Chapter 9, Using Formulas and Functions, for more information
about wildcards.
Chapter 2 Entering and Editing Data | 93
Calc Guide 26.2
Chapter 3
Formatting Data
Make your data shine
Introduction
As with any modern spreadsheet program, cell formatting is an important feature of Calc. Calc
formatting resources use an extensive set of attributes to enhance the visual display of relevant
information of your spreadsheet. Manual and style formatting, as well as conditional formatting,
are addressed in this chapter.
Formatting data
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.
You can format the data in Calc in several ways. Formatting can be defined as part of a cell style
so that it is automatically applied, or it can be applied manually to the cell. The Format Cells
dialog can be used for more control and extra options, over a selected cell or cell range. All the
format options are discussed below.
Multiple lines of text
Multiple lines of text can be entered into a single cell using automatic wrapping or manual line
breaks. Each method is useful for different situations.
Automatic wrapping
To automatically wrap multiple lines of text in a cell, use one of the following methods:
Method 1
1) Select the cell.
2) On the Properties deck of the Sidebar, click the + button to expand the Alignment panel
(Figure 64).
3) Select the Wrap text option to apply the formatting immediately.
Figure 64: Wrap text formatting
Method 2
1) Select a cell or cell range.
2) Go to Format > Cells on the Menu bar, or right-click and select Format Cells in the
context menu, or press Ctrl+1, to open the Format Cells dialog.
3) Click on the Alignment tab (Figure 65).
4) Under Properties, select Wrap text automatically and click OK.
96 | Calc Guide 26.2
Figure 65: Format Cells dialog – Alignment tab
Method 3
1) Select the cell.
2) Click on the toolbar Wrap Text tool.
Manual line breaks
To insert a manual line break while typing in a cell, press Ctrl+Enter. When editing text,
double-click the cell, then reposition the cursor to where you want the line break. In the Input line
of the Formula bar, you can also press Shift+Enter.
When a manual line break is entered, the cell row height changes, but the cell width may not
change and the text may still overlap the end of the cell. You have to change the cell width
manually or reposition the line break.
Shrinking text to fit a cell
The font size of the data in a cell can automatically adjust to fit inside cell borders:
1) Select a cell or cell range.
2) Go to Format > Cells on the Menu bar, or right-click and select Format Cells in the
context menu, or press Ctrl+1, to open the Format Cells dialog.
3) Click on the Alignment tab (Figure 65).
4) Under Properties, select Shrink to fit cell size and click OK.
Formatting numbers
Several number formats can be applied to cells by using icons on the Formatting toolbar
(highlighted in Figure 66). Select the cell, then click the relevant icon to change the number
format.
Chapter 3 Formatting Data | 97
Figure 66: Number icons on Formatting toolbar
For more control or to select other number formats, use the Numbers tab of the Format Cells
dialog (Figure 67):
• Apply any of the data types in the Category list to the data.
• Select one of the predefined formats in the Format list.
• Control the number of decimal places and leading zeroes in Options.
• Enter a custom format code. This is a very powerful facility that is detailed in the
Number Format Codes page of the Help.
• The Language setting controls the local settings for the different formats such as the
date format and currency symbol.
Figure 67: Formatting numbers
Formatting fonts
To select a font and format it for use in a cell:
1) Select a cell or cell range.
2) Click the down arrow on the right of the Font Name box on the Formatting toolbar
(highlighted in Figure 68) and select a font in the drop-down list. A font is temporarily
applied on selected cells by hovering or navigating in the Font Name drop-down list.
The font can also be changed using the Font tab on the Format Cells dialog.
Figure 68: Font Name and Size on Formatting toolbar
3) Click on the down arrow on the right of the Font Size box on the Formatting toolbar and
select a font size from the drop-down list. The font size can also be changed using the
Font tab on the Format Cells dialog.
98 | Calc Guide 26.2
4) To change the character format, click on the Bold, Italic, or Underline icons on the
Formatting toolbar.
5) To change the paragraph alignment, click on one of the alignment icons (Align Left,
Align Center and Align Right). The Format > Align menu also provides these options
in addition to the Justified alignment.
Note
To specify the language used in the cell, open the Font tab on the Format Cells
dialog. Changing language in a cell allows different languages to exist within the
same document. For more changes to font characteristics, see “Font effects” below.
Tip
To choose whether to show the font names in their font or in plain text, go to Tools >
Options > LibreOffice > View and select or deselect the Show preview of fonts
option in the Font Lists section. For more information, see Chapter 16 Setting up and
Customizing.
Font effects
1) Select a cell or cell range.
2) Right-click and select Format Cells in the context menu, or go to Format > Cells on
the Menu bar, or press Ctrl+1, to open the Format Cells dialog.
3) Click on the Font Effects tab (Figure 69).
Figure 69: Format Cells dialog – Font Effects tab
4) Select the font effect you want to use from the options available. The options available
are described in Chapter 4, Using Styles and Templates.
5) Click OK to apply the font effects and close the dialog.
Changes are applied to selected text, the word containing the cursor, or to any new text you
type.
Chapter 3 Formatting Data | 99
Text orientation
To change the text direction within a cell, use the Alignment tab on the Format Cells dialog
(Figure 65):
1) On the Alignment tab of the Format Cells dialog, select the Reference edge from which
to rotate the text as follows:
– Text Extension From Lower Cell Border – writes the rotated text from the bottom cell
edge outwards.
– Text Extension From Upper Cell Border – writes the rotated text from the top cell
edge outwards.
– Text Extension Inside Cell – writes the rotated text only within the cell.
2) Click on the small indicator at the edge of the text orientation dial and rotate it until you
reach the required degrees.
3) Alternatively, enter the number of degrees to rotate the text in the Degrees box.
4) Select Vertically stacked to make the text appear vertically in the cell.
If Asian language support is enabled and the text direction is set to vertical, then an Asian layout
mode becomes available. This option, which can be enabled using a checkbox on the Alignment
tab of the Format Cells dialog, aligns Asian characters one below the other in the selected
cell(s). If the cell contains more than one line of text, the lines are converted to text columns that
are arranged from right to left. Western characters in the converted text are rotated 90 degrees
to the right. Asian characters are not rotated.
Using the Formatting toolbar tools
The tools on the Formatting toolbar can be used as follows after the cell has been selected:
• To change the text direction from horizontal (default direction) to vertical, click on the
Text direction from top to bottom icon.
• To change text direction from vertical to horizontal (default), click on the Text direction
from left to right icon.
• To change text direction from the left-to-right direction that is the default direction for
Western fonts to a right-to-left direction used in fonts like Arabic, click on the Right-To-
Left icon. This only works if a font has been used that requires a right-to-left direction.
• To change text direction back to the default left-to-right direction used for Western fonts,
click on the Left-To-Right icon.
Note
The text direction icons can only be made available if the Asian and Complex text
layout options are checked under Tools > Options > Languages and Locales >
General > Default Languages for Documents. If it is necessary to make the
buttons visible, right-click on the toolbar and select Visible Buttons in the context
menu. Then, click on the required icon to place it on the Formatting toolbar.
Asian typography
If Asian language support is enabled, then an Asian Typography tab is included on the Format
Cells dialog (Figure 70). This tab enables setting of typographic options for cells in Asian
language documents. To enable Asian language support, navigate through Tools > Options >
Languages and Locales > General > Default Languages for Documents > Asian.
100 | Calc Guide 26.2
Figure 70: Format Cells dialog - Asian Typography tab
The following options are provided:
• The Apply list of forbidden characters to the beginning and end of lines option
prevents the characters in the list of restricted characters from starting or ending a line.
The characters are relocated to either the previous or the next line. To edit the list of
restricted characters, go to Tools > Options > Languages and Locales > Asian
Layout > First and Last Characters.
• The Allow hanging punctuation option prevents commas and periods from breaking
the line. Instead, these characters are added to the end of the line, even in the page
margin.
• The Apply spacing between Asian and non-Asian text option inserts a space
between ideographic and alphabetic text.
Formatting cell borders
To format the borders of a cell or a group of selected cells, you can use the border icons on the
Formatting toolbar to apply the default styles to borders, or the Format Cells dialog for greater
control. See Chapter4, Using Styles and Templates, for more information on the options.
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, even though it appears to
be the bottom border for cell C2.
1) Select a cell or a range of cells.
2) Go to Format > Cells on the Menu bar, or right-click and select Format Cells in the
context menu, or press Ctrl+1, to open the Format Cells dialog.
3) On the Borders tab (Figure 71), select the options required.
4) Click OK to close the dialog and save the changes.
Alternatively, use the icons on the Formatting toolbar to apply default styles to borders:
1) Click the Borders icon and select one of the options displayed in the Borders palette.
2) Click the Border Style icon and select one of the line styles from the Border Style
palette.
3) Click the Border Color icon to apply the most recently selected color. Click the down
arrow to the right of the Border Color icon to select another color from the Border
Color palette.
Chapter 3 Formatting Data | 101
Note
When entering borders with the border icons on the Formatting toolbar, you have two
choices: either left-click the required icon to add a border to the present borders or
Shift+click to add a border and remove the present borders.
Figure 71: Format Cells dialog – Borders tab
Formatting cell backgrounds
To format the background color for a cell or a group of cells (see Chapter 4, Using Styles and
Templates, for more information):
1) Select a cell or a range of cells.
2) Go to Format > Cells on the Menu bar, or right-click and select Format Cells in the
context menu, or press Ctrl+1, to open the Format Cells dialog.
3) On the Background tab, click the Color button and select a color from the color palette.
4) Click OK to save the changes and close the dialog.
Alternatively, click on the Background Color icon on the Formatting toolbar to apply the most
recently selected color. Click the down arrow to the right of the Background Color icon to select
a different color from the Background Color palette.
102 | Calc Guide 26.2
AutoFormat of cells and sheets
Using AutoFormat
You can use AutoFormat to format a group of cells:
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 Styles on the Menu bar to open the AutoFormat dialog
(Figure 72).
3) Select the type of format and format color in the list.
4) Select the formatting properties to be included in the Autoformat function.
5) Click OK to apply the changes and close the dialog.
Figure 72: AutoFormat dialog
Defining a new AutoFormat
You can define a new AutoFormat so that it becomes available for use in all spreadsheets:
1) Format the data type, font, font size, cell borders, cell background, and so on for a
group of cells.
2) Select a cell range of at least 4x4 cells.
3) Go to Format > AutoFormat Styles to open the AutoFormat dialog and then click the
Add button.
4) In the resulting Add AutoFormat dialog, type a meaningful name for the new format in
the Name box and click OK.
5) The new AutoFormat is now available in the Format list on the AutoFormat dialog. Click
OK to close the AutoFormat dialog.
Note
Autoformatting does not use cell styles. It applies direct formatting to the selected
range. The new Autoformat is stored in the user profile and is not part of the
spreadsheet document. This means that you can reuse the new AutoFormat in
another spreadsheet document using your profile. However, under a different profile
or different user, the new AutoFormat will not be listed. See Chapter 4, Using Styles
and Templates.
Chapter 3 Formatting Data | 103
Value highlighting
Sometimes, your spreadsheet can contain data of different types in the same column, row or
range. For example, a column with dates can have a string (text) written in the same format as
the default date format for the column. Because strings and numbers are treated differently in
some important functions, such as AVERAGE for example, the spreadsheet can display incorrect
results if your data has mixed types.
Value highlighting displays cell contents in different colors depending on the type of content. An
example of value highlighting is shown in Figure 73:
• Text is shown in black.
• Formulas are shown in green.
• Numbers (including date and time) are shown in blue.
Figure 73: Example of value highlighting
The value highlighting colors override any colors used in formatting. This color change applies
only to the colors seen on a display. When a spreadsheet is printed, the original colors used for
formatting are printed.
Go to View > Value Highlighting on the Menu bar, or use the keyboard shortcut Ctrl+F8, to
turn the function on or off. When value highlighting is switched off, the original formatting colors
are used for display.
You can make value highlighting the default when opening a spreadsheet in Calc, by selecting
Tools > Options > LibreOffice Calc > View > Display > Value highlighting. This default mode
for value highlighting may not be suitable for printing.
Tip
If the font color does not change when applied to a cell, check if the Value
highlighting is active.
Using conditional formatting
You can set up cell formats to change depending on conditions that you specify. Conditional
formatting is used to highlight data that is outside the specifications that you have set. Overuse
of conditional formatting is not advised as this could reduce the impact of data that falls outside
those specifications.
Note
To use conditional formatting, the AutoCalculate feature must be enabled and styles
must be used. See Chapter 4, Using Styles and Templates, for more information.
Setting up conditional formatting
1) Ensure that AutoCalculate is enabled in one of two ways:
– Check the setting at Data > Calculate > AutoCalculate.
– Check the status bar icon:
104 | Calc Guide 26.2
Figure 74: AutoCalculate on status bar.
2) Select the cells where you want to apply conditional formatting.
3) Go to Format > Conditional > Condition (Figure 79), Color Scale (Figure 84), Data
Bar (Figure 85), Icon Set (Figure 87), or Date (Figure 83), on the Menu bar to open the
Conditional Formatting dialog. Any conditions already defined are displayed.
4) Click Add to create and define a new condition. Repeat this step as necessary.
5) Select a style from the styles already defined in the Apply Style drop-down list. Repeat
this step as necessary.
6) Alternatively, select New Style to open the Cell Style dialog (Figure 88) and create a
new cell style. Repeat this step as necessary.
7) Click OK to save the conditions and close the dialog. The selected cells are now set to
apply a result using conditional formatting.
Figure 75: Conditional formatting toolbar icon
Figure 76: Conditional Formatting dialog – Cell value
Chapter 3 Formatting Data | 105
Tip
Although each condition type can be accessed using a different option in the Format
> Conditional menu of the Menu bar, the five variants of the Conditional Formatting
dialog shown in Figures 79 to 83 are not distinct. Once the dialog is open, you can
create conditions of all types without interacting with the Menu bar. For example, you
might create Condition 1 to select a cell style to be used if the cell takes a certain
value (Condition 1 is of type “Condition”). You might then press the Add button to
create Condition 2 by selecting All Cells in the condition’s upper left drop-down and
then selecting Data Bar in the adjacent drop-down (Condition 2 is of type “Data
Bar”). You might then press the Add button to create Condition 3 by selecting Date is
in the condition’s upper left drop-down (Condition 3 is of type “Date”). In this way you
can create many conditions of different types to control the conditional formatting of
the selected cells.
Types of conditional formatting
The Condition dialog is the starting point when using conditional formatting. Here you can define
what formats to use to highlight any data in the spreadsheet that meets the conditions you have
defined.
Cell value
Applies the selected style to the cell or cell range controlled by the condition set in the drop-
down list. The formatting is applied to each cell individually and the condition may depend on
other cells values of the selected range. Valid conditions are described in tables 5, 6 and 7.
Table 5: Conditions for number and text in cells
Condition Applies the selected style to the cell...
...when the cell value equals the user defined value in text box in the
is equal to
right. Use text inside quotes if you compare text values.
the cell value is not equal (different) to the user defined value in the text
is not equal to
box in the right. Use text inside quotes if you compare text values.
Applies the selected style to the cell when at least one other cell in the
is duplicate
range has equal contents.
Applies the selected style to the cell when the cell contents is unique in
is not duplicate
the range.
Applies the selected style to the cell when the cell contents begins with
begins with the text or number defined in the right text box.
See note on text conversion below.
Applies the selected style to the cell when the cell contents ends with the
ends with text or number defined in the right text box.
See note on text conversion below.
Applies the selected style to the cell when the cell contents contains the
contains text or number defined in the right text box.
See note on text conversion below.
Applies the selected style to the cell when the cell contents does not
does not contain contains the text or number defined in the right text box.
See note on text conversion below.
106 | Calc Guide 26.2
Note on text conversion conditions
The condition applies to the internal text conversion of the cell contents. Numeric
values are compared with their equivalent text representation. Numeric cell formats
(currency, scientific, user-defined, ...) are not considered for comparisons.
Table 6: Conditions for number-only cell values
Condition Applies the selected style to the cell when the cell value is...
is less than strictly less than the user defined value in the text box in the right.
is greater than strictly greater than the user defined value in the text box in the right.
is less than or
less than or equal to the user defined value in the text box in the right.
equal to
is greater than or
greater than or equal to the user defined value in the text box in the right.
equal to
between the two values defined in the text boxes on the right – lower and
is between
upper values – including the boundary values themselves.
not between the two values defined in the text boxes on the right – lower
is not between
and upper values – including the boundary values themselves.
is in top N Between the maximum value in the range and the Nth greater element of
elements the same. Enter the value of N in the text box on the right.
is in bottom N Between the minimum value in the range and the Nth lower element of
elements the same. Enter the value of N in the text box on the right.
In the top N percent of the number of cells in the range. For example, in a
is in top N percent 20 cells range and N equals 20, the style is applied to the 4 last cells of
the range. Enter the value of N in the text box on the right.
In the bottom N percent of the number of cells in the range. For example,
is in bottom N
in a 20 cells range and N equals 20, the style is applied to the 4 first cells
percent
of the range. Enter the value of N in the text box on the right.
strictly greater than the average of the cell range values.
is above average
See note below on average function.
the cell value is strictly less than the average of the cell range values.
is below average
See note below on average function.
is above or equal greater or equal than the average of the cell range values.
average See note below on average function.
is below or equal is less or equal than the average of the cell range values.
average See note below on average function.
Note on AVERAGE function in conditions
The AVERAGE function ignores any text or empty cell within a data range. If you
suspect wrong results from this function, look for text in the data ranges. To highlight
text contents in a data range, use the Value highlighting feature above.
Chapter 3 Formatting Data | 107
Table 7: Conditions for errors in cells
Condition Applies the selected style to the cell...
When the cell is in an error condition defined in the right text box. See
Appendix B “Error Codes”.
is error Tip
A cell that references another cell with an error condition is not in error
itself.
When the cell is not in an error condition defined in the right text box. See
is not error
Appendix B “Error Codes”.
Color Scale
Use Color Scale to set the background color of cells depending on the values of the data in
those cells. Color Scale can only be used when All Cells has been selected for the condition.
You can use either two or three colors for the color scale or gradient.
Figure 77: Conditional Formatting dialog – Color Scale
The Color Scale (2 entries) requires the definition of the colors for the minimum and the
maximum values in the range. These two values can be calculated in several ways:
• Min (Max): the minimum (maximum) value of the range.
• Percentile: A percentile is each of the 99 values which divide the sorted data in 100
equal parts, so that each part represents 1/100 of the sample population. A percentile
returns the value for a data series going from the smallest to the largest value in a set of
data. For P = 25, the percentile means the first quartile. P = 50 is also the MEDIAN of
the data set. Enter the percentile value in the text box just below. Valid values are from
0 to 100.
• Value: a fixed value set for the minimum (maximum) color. Enter the value in the text
box just below.
• Percent: a fixed value representing the percentage of the minimum (maximum) of the
length defined by minimum and maximum values in the range. A minimum of 10%
selects the values below 10% of the segment [Min,Max]. A maximum of 80% select
108 | Calc Guide 26.2
values above 80% of the segment [Min,Max]. Valid values are from 0 (zero) to 100. Do
not enter a percent (%) sign.
• Formula: A formula expression starting with the equal sign (=) that calculates the
numeric value for the minimum (maximum) colors. Values can be numbers, dates or
time. Enter the formula expression in the text box just below.
Figure 78: Color scale with 2 and 3 colors
The Color scale (3 entries) allows a third color for an intermediate data value. The third color
can be defined as for the Color scale (2 entries) above.
Data Bar
Data bars provide a graphical representation of data in the spreadsheet. The graphical
representation is based on the values of data in a selected range. Click on More Options in the
Conditional Formatting dialog to define how the data bars will look. Data bars can only be used
when All Cells has been selected for the condition.
Figure 79: Conditional Formatting dialog – Data Bar
To format all cells with data bars, you must set the minimum and maximum values of the data
range. The condition options are the same as the Color Scale above with the addition of:
• Automatic: Automatically sets the and maximum value based on the values in the data
set.
Chapter 3 Formatting Data | 109
Figure 80: Data bars
Data bar options
Click on the More Options button to select attributes of the data bars. The Data Bar dialog
opens (Figure 81):
Entry values
Defines the minimum and maximum values for the data bar formatting. See the
dropdown items described in the minimum and maximum of the Color Scale above.
Bar Colors
Set the color for positive and negative values. Set the bar fill mode:
– Gradient: set a color scale between the color of positive (negative) values and
white.
– Color: use the positive (negative) color for the entire data bar, no fade out gradient
(Figure 80).
Axis
Set the position of the vertical axis for the data bar. Values are:
– Automatic: position the vertical axis in the middle of the maximum and minimum
values.
– Middle: set the vertical axis in the middle of the column (Figure 80).
– None: do not display a vertical axis.
Bar Lengths
Sets the minimum (maximum) length of the data bars, as a percentage of the column
width.
Display bars only
Do not display values in the cell, only the data bars.
110 | Calc Guide 26.2
Figure 81: Data bars options
Icon Set
Icon sets display an icon next to the data in each selected cell to give a visual representation of
where the cell data falls within the defined range that you set. The operators in the drop-down
menu include equal to, less than, greater than, less than or equal to, greater than or equal to,
and not equal to (Figure 80). The icon sets available include colored arrows, gray arrows,
colored flags, colored signs, symbols, bar ratings, and quarters (Figure 84 and Figure 85). Icon
sets can only be accessed when the Conditional Formatting dialog has been opened and
All Cells has been selected for the condition (Figure 82).
Figure 82: Conditional Formatting dialog – Icon Set
Figure 83 shows the icon set used in conditional formatting to show the evolution of data in two
datasets.
Chapter 3 Formatting Data | 111
Figure 83: Arrows icon set used to indicate evolution in data
Figure 84: Icon sets with 3 icons
Figure 85: Icon sets with 4 and 5 icons
Date
Date applies a defined style depending on a date range chosen in the drop-down menu. Date
range options are formed by applying the adjectives This, Last, and Next to the available
periods for Day, Week, Month, or Year with. Last 7 days is another option available. Examples
include Tomorrow (the word for next day), Last 7 days, This week, Next month, Last year.
112 | Calc Guide 26.2
Figure 86: Conditional Formatting dialog - Date
Note
The start and end of the week is locale dependent (set in Tools > Options >
Languages and Locales > General).
Figure 87: Condition for dates in next week.
Formula is
Applies the selected style to the cell when the formula expression in the text box in the right is
not zero.
The formula is expressed similar to a test condition evaluating to TRUE or FALSE.
Figure 88 shows different cell styles applied based on conditions for dates before and after the
current date. The formulae are expressed in Table 8.
Chapter 3 Formatting Data | 113
Figure 88: Conditions to set current, past, and future dates using formulas
Table 8: Current, past and future deadlines with formulas
Deadlines Formula is Style applied
Current date F3 = TODAY() “Neutral”
Past date F3 < TODAY() “Bad”
Future date F3 > TODAY() “Good”
Conditional formatting management
To see all the conditional formatting defined in the spreadsheet and any styles used:
1) Go to Format > Conditional > Manage on the Menu bar to open the Manage
Conditional Formatting dialog (Figure 89).
Figure 89: Manage Conditional Formatting dialog
2) Select a range in the Range list and click Edit to redefine the conditional formatting.
3) Select a range in the Range list and click Remove to delete the conditional formatting.
The deletion is immediate with no confirmation.
4) Select Add to create a new definition of conditional formatting.
5) Click OK to save the changes and close the dialog.
Copying cell styles
To apply the style used for conditional formatting to other cells later:
1) Click one of the cells that has been assigned conditional formatting and copy the cell to
the clipboard.
114 | Calc Guide 26.2
2) Select the cells that are to receive the same formatting as the copied cell.
3) Go to Edit > Paste Special > Paste Special on the Menu bar, or right-click and select
Paste Special > Paste Special in the context menu, or press Ctrl+Shift+V, to open the
Paste Special dialog (described in the “Paste Special dialog” section in Chapter 2,
Entering and Editing).
4) Make sure that only Formats is selected and click OK to paste the conditional formatting
into the cell.
Hiding and showing data
Calc elements can be hidden so that they cannot be viewed or printed. However, hidden
elements can still be selected for copying if you select the elements around them; for example, if
column B is hidden, it is copied when you select to copy columns A to C. When you require a
hidden element again, you can reverse the process and show the element.
Hiding data
Sheets
Select Sheet > Hide Sheet on the Menu bar, or right-click on the sheet tab for the sheet to be
hidden and select Hide Sheet in the context menu. There must always be one sheet that is not
hidden.
Rows and columns
1) Select a cell in the row or column you want to hide.
2) Go to Format on the Menu bar and select Rows or Columns.
3) Select Hide from the menu and the row or column can no longer be viewed or printed.
4) Alternatively, right-click on the row or column header and select Hide Rows or Hide
Columns in the context menu.
Tip
To enable/disable a visual indicator of hidden columns and rows, go to View >
Hidden Row/Column Indicator.
Cells
Hiding individual cells is more complicated. First, you need to define the cells as protected and
hidden; then you need to protect the sheet:
1) Select the cells you want to hide.
2) Go to Format > Cells on the Menu bar, or right-click and select Format Cells in the
context menu, or press Ctrl+1, to open the Format Cells dialog (Figure 90).
3) Click the Cell Protection tab and select an option for hiding and printing the cells.
4) Click OK to save the changes and close the dialog.
5) Go to Tools > Protect Sheet on the Menu bar, or right-click on the sheet tab and select
Protect Sheet in the context menu, to open the Protect Sheet dialog (Figure 91).
6) Select Protect this sheet and the contents of protected cells.
7) Create a password and then confirm the password. The dialog provides a password
strength meter to indicate the strength of the entered password. This incorporates a
Chapter 3 Formatting Data | 115
colored bar to reflect password strength, with red indicating a weak password and green
indicating a strong password. In addition, the longer the colored bar, the greater the
strength of the password.
8) Select or deselect the options in the Allow all users of this sheet to area so that users
can select protected or unprotected cells.
9) Click OK to save the changes and close the dialog.
Figure 90: Format Cells dialog – Cell Protection tab
Note
When content in cells is hidden, it is only the content contained in the cells that is
hidden and the protected cells cannot be modified. The blank cells remain visible in
the spreadsheet.
Figure 91: Protect Sheet dialog
116 | Calc Guide 26.2
Showing data
Sheets
Select Sheet > Show Sheet on the Menu bar, or right-click on any sheet tab and select Show
Sheet in the context menu. Choose which hidden sheets to show from the list on the Show
Sheet dialog. If there are no hidden sheets, the Show Sheet option will not appear in the context
menu and will be grayed on the Menu bar.
Rows and columns
1) Select the rows or columns on each side of the hidden row or column.
2) Go to Format on the Menu bar and select Rows or Columns. Select Show in the
menu and the row or column will be displayed and can be printed.
3) Alternatively, right-click on a row or column header and select Show Rows or Show
Columns in the context menu.
Cells
1) Go to Tools > Protect Sheet on the Menu bar, or right-click on the sheet tab and select
Protect Sheet in the context menu, to open the Protect Sheet dialog (Figure 91).
2) Enter the password to unprotect the sheet and click OK.
3) Go to Format > Cells on the Menu bar, right-click and select Format Cells in the
context menu, or press Ctrl+1, to open the Format Cells dialog (Figure 90).
4) Click the Cell Protection tab and deselect the hide options for the cells. Click OK.
Note
When protecting a sheet using the Protect Sheet dialog, you can leave the password
fields blank. In this case, the Protect Sheet dialog is not presented at step 1) above
and step 2) is not necessary.
Chapter 3 Formatting Data | 117
Calc Guide 26.2
Chapter 4
Using Styles and
Templates
Using consistent formatting in spreadsheets
Introduction to styles
A style is a predefined set of formatting options you can apply to elements in a spreadsheet to
quickly change their appearance. Instead of applying formatting attributes one by one—such as
font, size, bold, or alignment—you apply a single style that includes all those settings.
Many users tend to manually format spreadsheet cells, shapes, and pages without using styles,
focusing on individual attributes like font size or color. For example, you might set a cell’s font to
14 pt, Times New Roman, bold, and centered.
Using styles simplifies this process, saves time, and ensures consistency. Instead of repeating
individual formatting tasks, you apply a named style—like Title—that already includes the
desired settings. This reduces errors and makes global formatting changes easier.
For instance, if all your subtotals use a specific style, you can update their appearance across
an entire 15-page spreadsheet by modifying that style—changing from 8 pt Times New Roman
to 10 pt Arial, for example.
You can customize existing styles or create new ones to suit your needs. The next sections
explain how to create, edit, and apply styles.
Direct formatting and style formatting
Direct formatting (also called manual formatting) overrides styles. You cannot remove the direct
formatting by applying a style to it.
To remove manual formatting, select the object, and then do one of the following:
• Right-click and choose Clear Direct Formatting in the context menu (where available).
• Press Ctrl+M.
• Click the Clear Direct Formatting icon on the Standard toolbar.
• Select Format > Clear Direct Formatting on the Menu bar.
Calc style types
Calc offers three style types:
– Cell styles
– Drawing styles
– Page styles
These style types are explained in the following sections.
Cell styles
Cell styles are similar to paragraph styles used in LibreOffice Writer. They are the most basic
type of style in Calc. Cell styles are used for applying fonts, alignment, borders, background,
number formats (for example, currency, date, number), and cell protection to format the data in
the cells.
A basic range of cell styles is supplied with Calc. Many of these styles are shown on the Styles
menu on the Menu bar and all are shown in the Styles deck of the Sidebar. If you create a new
cell style, it will be shown in the Sidebar. To learn how to add a new style to the Styles menu,
see Chapter 16, Setting up and Customizing.
Changing the characteristics of the Default cell style will in turn change the characteristics of
other styles that inherit characteristics from the Default style.
120 | Calc Guide 26.2
Drawing styles
Drawing styles in Calc are similar to the graphic styles used in LibreOffice Draw and can be
applied to shapes and comments. To avoid repeating the same formatting—like fill, lines, and
borders—you can use drawing styles. Calc provides two built-in styles (Default and Note) that
you can edit or use as templates for your own, but you can't delete them.
• When a shape is added to a spreadsheet, the Default drawing style is initially applied to
that shape.
• When a comment is inserted into a spreadsheet, the Note drawing style is initially
applied to that comment.
Tip
You can select the comment drawing object and apply another drawing style, and
have notes in different background colors, fonts and font sizes, for example.
Page styles
Page styles in Calc are applied to sheets. Although one sheet may print on several pages, only
one-page style can be applied to a sheet. If a spreadsheet file contains more than one sheet,
then a different page style can be applied to each sheet. For example, a spreadsheet might
contain some sheets to be printed in landscape orientation and other sheets to be printed in
portrait orientation.
Two-page styles are supplied with Calc: Default and Report. Page styles allow you to set page
size and orientation, page margins, headers and footers, borders and backgrounds, and the
sequence for printing sheets.
Applying cell styles
Cell styles may be applied in several ways:
– Styles menu on the Menu bar
– Styles deck on the Sidebar
– Fill Format mode
– Apply Style list on the Formatting toolbar
– Keyboard shortcuts.
Styles menu
By default, the Styles menu (Figure 92) lists many of the cell styles supplied with Calc. To apply
a cell style, select the cell or group of cells to be formatted, and then choose Styles and click on
the required style.
Chapter 4 Using Styles and Templates | 121
Figure 92: The Styles menu
Styles deck in Sidebar
The Styles deck on the Sidebar lists and optionally shows previews of the styles available.
1) If the Styles deck in the Sidebar is not open, do one of the following to open it:
– Select View > Styles on the Menu bar.
– Select Styles > Manage Styles on the Menu bar.
– Press the F11 function key.
– If another deck of the Sidebar is open, select the Styles icon in the tab panel at the
right of the Sidebar.
2) Click the Cell Styles icon on top of the Styles deck to open the list of cell styles. Figure
93 shows the deck with cell styles visible.
3) In the spreadsheet, highlight the cell or group of cells where you want to apply a cell
style.
4) Double-click on the cell style name in the Styles deck and the formatting attributes for
that style are applied to the data contained in the highlighted cells.
Fill Format mode
Fill Format mode is useful when you want to apply the same style to many scattered cells.
1) Go to the Styles deck on the Sidebar (Figure 93).
2) Select the style you want to apply.
3) Click the Fill Format Mode icon in the top right of the Styles deck. The mouse pointer
changes shape.
4) Click in each cell where you want to apply the selected style.
5) When you have finished formatting cells, click the Fill Format Mode icon to exit the
mode.
122 | Calc Guide 26.2
Figure 93: Styles deck in Sidebar, showing cell styles
Caution
When Fill Format mode is active, a right-click anywhere in the document cancels the
last Fill Format action. Be careful not to accidentally right-click and thus cancel any
formatting actions you want to keep.
Apply Style list
The Apply Style drop-down list is not included by default on the Formatting toolbar in Calc, but
you can add it as follows:
1) Right-click on any icon on the Formatting toolbar and select Visible Buttons in the
context menu (Figure 94).
2) Click Apply Style. The context menu closes and the Apply Style list appears at the left
end of the Formatting toolbar.
Figure 94: Adding the Apply Style list to the Formatting toolbar
To apply a style using the Apply Style list:
1) Select a cell or a group of cells in the spreadsheet.
2) Click the down arrow at the right of the Apply Style list to open the drop-down menu
(Figure 95).
3) Select the required style. The formatting attributes of that style are applied to the
selected cells.
Chapter 4 Using Styles and Templates | 123
Figure 95: Using the Apply Style list
Only the styles that are in use are shown on the list. Click More Styles to go to the Styles deck
where all cell styles are available.
Keyboard shortcuts
You can create keyboard shortcuts to apply commonly-used cell, drawing, or page styles,
including any custom styles that you have created. See Chapter 16, Setting up and Customizing,
for more information.
Applying drawing styles
To apply a different drawing style to a shape or comment:
1) Select the shape or comment to be styled.
2) Go to the Styles deck on the Sidebar (Figure 93).
3) At the top of the Styles deck, click the Drawing Styles icon.
4) Double-click on the required drawing style.
Applying page styles
The page style applied to a sheet within a spreadsheet is indicated on the Status Bar, as shown
in Figure 96.
Figure 96: Page style (Default) indicated on Status Bar
To apply a different page style:
1) Select the sheet to be styled by clicking its sheet tab.
2) Go to the Styles deck on the Sidebar (Figure 93).
3) At the top of the Styles deck, click the Page Styles icon.
4) Double-click on the required page style.
124 | Calc Guide 26.2
Creating styles
To create a style, follow the procedure described in this section.
Note
Any new styles, and any changes to existing styles, apply only to the spreadsheet in
use. To save new styles in a template, see “Creating a template” on page 143 for
more information.
1) Go to the Styles deck on the Sidebar (Figure 93).
2) To create a new cell style, click the Cell Styles icon; or to create a new drawing style,
click the Drawing Styles icon; or to create a new page style, click the Page Styles
icon.
3) Right-click in the Styles deck and select New in the context menu to open either the
Cell Style dialog, the Drawing Style dialog, or the Page Style dialog.
4) Use the various tabbed pages on the dialogs to set the attributes for the new style. See
“Cell style attributes”, “Drawing style attributes”, and “Page style attributes” for more
information.
5) Click OK to close the dialog and save the new style.
Note
Style names are case-sensitive. For example, styles red and Red may both exist in
the same spreadsheet. To prevent confusion, it is best to avoid giving styles similar
names.
Cell style attributes
The following attributes are available on the tabbed pages of the Cell Style dialog (Figure 97).
General tab
• Name – displays the name of the selected style. If you are creating or modifying a
custom style, enter a name for the style. You cannot change the name of a predefined
style.
• Inherit from – you can choose to link the new style to an existing style and then modify
some of the attributes. If you do this, any change to the parent style’s attributes will
affect the new style. For example, you could make the styles identical except for the
font color; if you later change the font family of the parent style, the new style’s family
will also change.
• Edit Style – enables you to view and edit the properties of the parent style.
• Category – displays the category for the current style. If you are creating or modifying a
new style, select Custom Styles from the list. You cannot change the category for a
predefined style. Select Hidden Styles if you want that style to appear only in the Styles
list.
• Contains – describes the formatting used in the style.
Chapter 4 Using Styles and Templates | 125
Figure 97: Cell Style dialog – General tab
Numbers tab
• Category – select a category from the list.
• Format – select how you want the contents of the selected cells to be displayed.
When you select Currency as a category, you need to select a currency in the drop-down list
and then select the format to use from the options available for that currency.
The currency format is not dependent on the language that you select in the Language box. The
default currency format for a cell is determined by the regional settings of your operating system.
• Language – specifies the language settings for the selected cells. With the language
set to the default, Calc automatically applies the number formats associated with the
system default language. The language setting ensures that date and currency formats
are preserved even when the document is opened in an operating system that uses a
different default language setting.
• Options – specify the options for the selected format:
– Decimal places – enter the number of decimal places that you want to display.
– Leading zeroes – enter the maximum number of zeroes to display in front of the
decimal point.
– Negative numbers red – select to change the font color of negative numbers to red.
– Thousands separator – select to insert a separator between thousands. The type of
separator (for example, a comma or a space) depends on your language settings.
• Format code – displays the number format code for the selected format. You can also
enter a custom format.
• Add – adds the number format code that you entered to the user-defined category.
• Edit Comment – adds a comment to the selected number format.
• Remove – deletes the selected number format.
• Preview field – displays a preview of the current selection.
126 | Calc Guide 26.2
Figure 98: Cell Style dialog – Numbers tab
Font tab
Depending on your language settings, you can change the formatting for the following font types
on this tab – Western text font (Latin character sets), Asian text font (Chinese, Japanese, or
Korean character sets), and Complex text layout font (right-to-left text direction). Figure 99
shows the Font tab of the Cell Style dialog when the Asian and Complex text layout options
are selected in the Default Languages for Documents area of the Tools > Options >
Languages and Locales > General page. The layout of the Font and Font Effects tabs are
modified if either of these two options is deselected.
• Font – select an installed font in the list.
• Style – select the formatting you want to apply, for example bold, Italic, or underline.
• Size – select or enter the font size that you want to apply. For scalable fonts, you can
also enter decimal values. If you are creating a style that is based on another style, you
can enter a percentage value or a point value (for example, 2 pt or 5 pt).
• Language – sets the language that the spelling checker is to use. The spelling checker
works only when you have installed the corresponding language module. A language
entry has a check mark in front of it if the spelling checker is activated for that language.
• Features – some fonts offer special features such as Discretionary Ligatures and
Horizontal Kerning. Click this button to access the Font Features dialog (not shown) to
select those features.
• Preview – displays a preview of the current selection.
Chapter 4 Using Styles and Templates | 127
Figure 99: Cell Style dialog – Font tab
Font Effects tab
Figure 100: Cell Style dialog – Font Effects tab
128 | Calc Guide 26.2
• Font color – sets the color for the text. If you select Automatic, the text color is set to
black for light backgrounds and to white for dark backgrounds.
• Transparency – sets the transparency of the character text. The value 100% means
entirely transparent, while 0% means not transparent at all.
• Overlining – select the overlining style that you want to apply. To apply the overlining to
words only (not the spaces between them), select the option box Individual words.
• Overline color – select the color for the overlining, in the pallet when you click the
button next to the Overlining field. Automatic matches the font color.
• Strikethrough – select a strikethrough style for the selected text. To apply the
strikethrough to words only (not the spaces between them), select Individual words.
• Underlining – select the underlining style that you want to apply. To apply the
underlining to words only (not the spaces between them), select Individual words.
If you apply underlining to a superscript text, the underlining is raised to the level of the
superscript. If the superscript is contained in a word with normal text, the underlining is
not raised.
• Underline color – select the color for the underlining, in the pallet when you click the
button next to the Underlining field. Automatic matches the font color.
• Individual words – applies the selected effect only to words and ignores spaces.
• Relief – select a relief effect to apply to the text. The Embossed relief makes the
characters appear as if they are raised above the page. The Engraved relief makes the
characters appear as if they are pressed into the page.
• Outline – displays the outline of the characters. This effect does not work with every
font.
• Shadow – adds a shadow that casts below and to the right of the characters.
• Emphasis Mark – select a character to display over or below the entire length of the
selected text.
• Position – specify where to display the emphasis marks (for Asian languages).
• Preview – displays a preview of the current selection.
Alignment tab
• Text Alignment – sets the alignment options for the contents of the current cell, or the
selected cells.
– Horizontal – select the horizontal alignment option that you want to apply to the cell
contents:
– Default – aligns numbers to the right and text to the left.
– Left – aligns the contents of the cell to the left.
– Center – horizontally centers the contents of the cell.
– Right – aligns the contents of the cell to the right.
– Justified – aligns the contents of the cell to the left and to the right cell borders.
– Filled – repeats the cell contents (number and text) until the visible area of the cell is
filled. This feature does not work on text that contains line breaks.
– Distributed – aligns contents evenly across the whole cell. Unlike Justified, it also
justifies the very last line of text.
Chapter 4 Using Styles and Templates | 129
– Indent – indents from the left edge of the cell by the amount that you enter.
Figure 101: Cell Style dialog – Alignment tab
– Vertical – select the vertical alignment option that you want to apply to the cell
contents:
– Default – aligns the cell contents to the bottom of the cell.
– Top – aligns the contents of the cell to the upper edge of the cell.
– Bottom – aligns the contents of the cell to the lower edge of the cell.
– Middle – vertically centers the contents of the cell.
– Justified – aligns the contents of the cell to the top and to the bottom cell borders.
– Distributed – similar to Justified, unless the text orientation is vertical. Then it
behaves similarly to the horizontal Distributed setting, with the very last line justified.
• Text Orientation – defines the text direction of cell contents.
– ABCD wheel – click anywhere in the wheel to define the text orientation. The
characters “ABCD” on the wheel correspond to the new setting.
– Vertically stacked – assigns vertical text orientation for cell contents.
– Asian layout mode – only available if Asian language support is enabled and the text
direction is set to vertical. Aligns Asian characters one below the other in the
selected cell(s). If the cell contains more than one line of text, the lines are
converted to text columns that are arranged from right to left. Western characters in
the converted text are rotated 90 degrees to the right. Asian characters are not
rotated.
– Degrees – allows you to manually enter the orientation angle.
– Reference edge – specify the cell edge from which to write the rotated text:
130 | Calc Guide 26.2
– Text Extension From Lower Cell Border – writes the rotated text from the bottom cell
edge outwards.
– Text Extension From Upper Cell Border – writes the rotated text from the top cell
edge outwards.
– Text Extension Inside Cell – writes the rotated text only within the cell.
• Properties – determine the text flow in a cell.
– Wrap text automatically – wraps text onto another line at the cell border. The
number of lines depends on the width of the cell. To enter a manual line break, press
Ctrl+Enter in the cell.
– Hyphenation active – enables word hyphenation for text wrapping to the next line.
– Shrink to fit cell size – reduces the apparent size of the font so that the contents of
the cell fit into the current cell width. You cannot apply this command to a cell that
contains line breaks.
– Text direction – choices are Left-to-right, Right-to-left, and Use superordinate
object settings (the settings applied to the preceding cell).
Asian Typography tab
If Asian language support is enabled, the Asian Typography tab is displayed on the Cell Style
dialog. For more details of the options available on this tab, see the description of the
corresponding tab of the Format Cell dialog in Chapter 2, Entering and Editing Data.
Figure 102: Cell Style dialog - Asian Typography tab
Chapter 4 Using Styles and Templates | 131
Borders tab
Sets the border attributes for the selected cells.
• Line Arrangement – select a preset border style or define your own combination by
clicking in the diagram.
• Line – select the line style, thickness, and color that you want to apply. The style is
applied to the borders selected in the preview.
• Padding – specify the amount of space that you want to leave between the border and
the contents of the cell. You can set each distance (left, right, top, bottom) individually or
select Synchronize to apply the same padding to all four borders when you enter a
new value.
Figure 103: Cell Style dialog – Borders tab
• Shadow Style – applies a shadow effect to borders. You can specify the position of the
shadow (bottom right, top right, bottom left, or bottom right), the distance it extends, and
its color.
Background tab
Click Color to select a color to use as a background for the formatted cells. You can choose
from several palettes. To change the color, select another one. To remove the background color,
select None.
132 | Calc Guide 26.2
Figure 104: Cell Style dialog – Background tab
Cell Protection tab
In this tab you can set some basic protection to you spreadsheet.
Protection
• Hide all – hides formulas and contents of the selected cells.
• Protected – prevents the selected cells from being modified. This cell protection only
takes effect if you also protect the sheet.
• Hide formula – hides formulas in the selected cells.
Print
• Hide when printing – prevents the selected cells from being printed.
Chapter 4 Using Styles and Templates | 133
Figure 105: Cell Style dialog – Cell Protection tab
Resetting cell style attributes
The buttons at the bottom of the Cell Style dialog have the following functions:
• Reset – returns values on the current tab to those applicable when the dialog was
opened.
• Standard – for a style that inherits settings from a parent style, updates the settings on
the current tab to match those of the parent style.
• Cancel – cancels any changes made (to all tabs in the dialog) since the last save of this
dialog (by clicking OK).
• OK – saves all changes made (to all tabs in the dialog).
Drawing style attributes
The Drawing Style dialog (Figure 106) in Calc is equivalent to the Graphics Styles dialog in
LibreOffice Draw. The Graphics Styles dialog is described in the Draw Guide, Chapter 4,
Changing Object Attributes, section entitled “Drawing Styles”.
The following tabbed pages are provided on the Drawing Style dialog (Figure 106).
• General. This tab is similar to the General tab of the Cell Style dialog (Figure 97).
• Line. Set line properties (style, color, width, and transparency), arrow styles, and corner
and cap styles.
• Area. Set the fill options (none, color, gradient, image, pattern, or hatch).
• Shadowing. Add a shadow and set the properties of the shadow (position, color,
distance, blur, and transparency).
134 | Calc Guide 26.2
• Transparency. Set the area transparency mode. This may be no transparency, fixed
transparency (expressed as a percentage), or gradient transparency (linear, axial,
radial, ellipsoid, square, or rectangular).
• Font. This tab is similar to the Font tab of the Cell Style dialog (Figure 99).
• Font Effects. This tab is similar to the Font Effects tab of the Cell Style dialog (Figure
100).
• Indents & Spacing. Set paragraph indenting, paragraph spacing and line spacing
options.
• Text. Set layout and anchoring properties for text, covering drawing object text, custom
shape text, spacing to borders, and text anchor type.
• Text Animation. Add a text animation effect (blink, scroll through, scroll back and forth,
or scroll in) and set its properties.
• Dimensioning. Set line and legend properties for dimension lines.
• Alignment. Set the alignment of paragraphs relative to margins and select the text
direction.
• Asian Typography. This tab is similar to the Asian Typography tab of the Cell Style
dialog (Figure 102).
• Tabs. Set the position, type, and fill character for tab stops.
• Highlighting. This tab is similar to the Background tab of the Cell Style dialog (Figure
104).
Additional information can be found in the Draw Guide and the system help.
Figure 106: Drawing Style dialog - Line tab
Page style attributes
The following attributes are available on the tabs of the Page Style dialog (Figure 107).
Chapter 4 Using Styles and Templates | 135
Figure 107: Page Style dialog – Page tab
General tab
This tab is similar to the General tab for the Cell Style dialog, although page styles cannot inherit
settings from other styles.
• Name – displays the name of the selected style. If you are creating or modifying a
custom style, you can enter or change the name of the style. You cannot change the
name of a predefined style.
• Category – displays the category of the current style. If you are creating or modifying a
new style, select Custom Styles in the list. You cannot change the category for a
predefined style.
• Contains – describes the formatting used in the style.
Page tab
You can define page layouts for single and multiple-page spreadsheets, as well as page
numbering and paper formats.
• Paper Format – select from a list of predefined paper sizes, or define a custom paper
format.
– Format – select a predefined paper size, or create a custom format by entering the
dimensions for the paper in the Height and Width boxes.
– Width – displays the width of the selected paper format. To define a custom (user)
format, enter a width here.
– Height – displays the height of the selected paper format. To define a custom (user)
format, enter a height here.
– Orientation – Portrait displays and prints the spreadsheet with the paper oriented
vertically. Landscape displays and prints the spreadsheet with the paper oriented
horizontally.
136 | Calc Guide 26.2
– Text direction – select the text direction that you want to use in your document. The
"right-to-left (vertical)" text flow direction rotates all layout settings to the right by 90
degrees, except for the header and footer. This option is only available if Complex
text layout is selected at Tools > Options > Languages and Locales > General.
– Preview Field – displays a preview of the current selection.
– Paper tray – select the paper source for your printer. You can assign different paper
trays to different page styles. For example, you can assign a different tray for the
first page style in the spreadsheet and load the tray with your company letterhead
paper.
• Margins – specify the amount of space to leave between the edges of the paper and
the spreadsheet contents.
– Left/Inner – the space between the left edge of the page and the spreadsheet. If you
are using Mirrored page layout, enter the space between the inner edge of the
paper and the spreadsheet. You may want to have a wider space as the left/inner
margin if you will be punching or binding the pages.
– Right/Outer – the space between the right edge of the paper and the spreadsheet. If
you are using Mirrored page layout, enter the space between the outer edge of the
paper and the spreadsheet.
– Top – enter the space between the upper edge of the paper and the spreadsheet.
– Bottom – enter the space between the lower edge of the paper and the spreadsheet.
• Layout settings – select the page layout style to use for the spreadsheet.
– Page layout – Right and left – both odd (right) and even (left) pages have the same
margins on all four sides. Mirrored – odd and even pages with inner and outer
margins as specified (Use this layout if you want to bind the printed pages like a
book. Enter the binding space as the Inner margin). Only right – the current page
style shows only odd (right) pages (Even pages are shown as blank pages). Only
left – the current page style shows only even (left) pages (Odd pages are shown as
blank pages).
– Page numbers – select the page numbering format to use for the page style.
Typically, this will be 1,2,3; or a,b,c; or i,ii,iii.
– Table alignment – Horizontal centers the cells horizontally on the printed page.
Vertical centers the cells vertically on the printed page (the Preview Field will change
according to the selected in this option).
Borders and Background tabs
The Borders and Background tabs of the Page Style dialog are similar to those on the cell Style
dialog. See “Borders tab” and “Background tab” in “Cell style attributes” above for information on
how to set the borders and background for page styles. Page styles can have a bitmap
background, which is not available for cell styles.
Header and Footer tabs
Adds a header or footer to the page style. A header is an area in the top page margin where you
can add text or graphics. A footer is a similar area in the bottom page margin. See Chapter 8,
Printing, Exporting, Emailing, and Signing for details.
Sheet tab
Specifies the elements to be included in the printout of all sheets with the page style.
Additionally, you can set the print order, the first page number, and the page scale. See
Chapter 8, Printing, Exporting, E-mailing, and Signing for details.
Chapter 4 Using Styles and Templates | 137
Using themes
Using spreadsheet themes
Calc includes a set of built-in formatting themes you can use in spreadsheets. You can't add new
themes or change the built-in ones. However, you can edit a theme after applying it, but those
changes only apply to the current spreadsheet.
To apply a theme to a spreadsheet:
1) Go to Format > Spreadsheet Theme on the Menu bar, or click the Spreadsheet
Theme icon on the Tools toolbar, to open the Theme Selection dialog (Figure 108),
which 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.
Using spreadsheet themes is effective when you format a range in the spreadsheet as a table.
Selecting a spreadsheet theme adds new cell styles to the spreadsheet and modifies the Default
cell style. The added cell styles are:
• “Card” cell styles: Column Header, Card, Card B (bottom), Card BL (bottom left), Card
BR (bottom right), Card L (left), Card R (right), Card T (top), Card TL (top left), and Card
TR (top right) of the selected range.
• Background: The background style of the range. Apply this style to the table contents
not in the table edges.
• Input: Used for data input. This cell style has the cell protection property unchecked.
• Result2: A secondary option for formula results.
Figure 108: Theme Selection dialog
If required, you can now use the Styles deck on the Sidebar to modify specific styles. These
modifications do not modify the spreadsheet theme; they only change the appearance of the
style in the spreadsheet you are creating.
138 | Calc Guide 26.2
Using document themes
Document themes collect various format selections into a set that can be applied and changed
quickly. LibreOffice supplies several sets of theme colors, and you can define other sets (see
Chapter 16, Setting up and Customizing). Theme colors have names like Dark 1, Light2, Accent
3, and so on. They can be used in styles or applied manually.
To set up a spreadsheet to use themes, choose colors for fonts, backgrounds, or objects from
the Theme colors palette (Figure 109), not an ordinary color palette. The first row of the palette
contains the theme colors, with other rows containing modifications. For example, the top-left
color in the palette is the currently selected theme’s Dark 1 color; the leftmost color in the second
row is a 50% lighter version of Dark 1; the entry at the intersection of the second column and
third row is a 15% darker version of Light1; and so on. You can hover the pointer over any
palette cell to see a tooltip indicating the detail of that color.
Figure 109: A palette of theme colors
To change the set of theme colors, choose Format > Theme on the Menu bar and select a
different theme in the Theme dialog (Figure 110). Colors defined as theme colors change in the
document. You need not change any style and need not change any object individually.
Figure 110: Theme dialog
Figure 111 shows an example in which the background colors of cells in the range B3:B14 have
been set to the theme color indicated by the corresponding labels in cells A3:A14. Initially, the
default LibreOffice theme was applied and this is shown on the left of the figure. The transition to
the configuration on the right of the figure requires only a cosmetic change to the text in cell B1
and selection of the Sunset theme via Format > Theme on the Menu bar.
Chapter 4 Using Styles and Templates | 139
Figure 111: Example of changing a document's theme
Managing styles
Modifying styles
1) Go to the Styles deck on the Sidebar and click the icon for the type of style you want to
modify.
2) Right-click on the name of the style and select Modify in the context menu to open
either the Cell Style dialog (Figure 97), or the Drawing Style dialog (Figure 106), or the
Page Style dialog (Figure 107).
3) Make the necessary changes to the style attributes. For more information on style
attributes, see “Cell style attributes”, Drawing style attributes, and “Page style
attributes”.
4) Click OK to save the changes and close the dialog.
Note
The Modify command is unavailable if one or more sheets are protected, even if the
cell style to be modified is being used in an unprotected sheet.
Renaming styles
You can rename custom styles, but not the styles supplied with Calc.
1) Go to the Styles panel on the Sidebar (Figure 93) and click the icon for the type of style
you want to rename.
2) Right-click on the style you want to rename and select Modify in the context menu to
open either the Cell Styles dialog, the Drawing Style dialog, or the Page Styles dialog.
3) On the Organizer tab, rename the style, and click OK.
Deleting styles
You can delete custom styles, but not the styles supplied with Calc. Custom cell styles can only
be deleted if they are not applied. If an applied page style is deleted, affected sheets revert to
the Default page style.
1) Go to the Styles deck in the Sidebar (Figure 93) and click the icon for the type of style
you want to delete.
2) Right-click on the style you want to delete and select Delete in the context menu.
140 | Calc Guide 26.2
3) Select Yes on the warning message, if displayed.
Hiding and showing cell styles
You can shorten the list of cell styles by hiding some of them. Only styles that are not being used
in the spreadsheet can be hidden.
1) Go to the Styles deck in the Sidebar and click on the Cell Styles icon.
2) Right-click on an unused cell style and select Hide in the context menu. The style is
then moved to the Hidden Styles category in the Styles deck.
To show hidden cell styles:
1) Go to the Styles deck on the Sidebar.
2) Click on the drop-down list at the bottom of the panel and select Hidden Styles in the
list.
3) To revert, right-click on the hidden style you want to show and select Show in the
context menu.
Filtering the list of styles
You can filter the list of styles as follows:
1) Go to the Styles deck on the Sidebar.
2) Click on the drop-down list at the bottom of the panel.
3) Select the category of styles to display on the Styles deck:
– Hierarchical – lists the styles in their hierarchical relationship, for example Heading
1 and Heading 2 under Heading, or Accent 1, Accent 2, Accent 3 under Accent.
– All Styles – lists all the styles that are available in Calc and in the spreadsheet,
except for hidden styles, in alphanumeric order.
– Hidden Styles – lists all the styles that have been hidden in the spreadsheet.
– Applied Styles – lists only the styles that have been applied to the spreadsheet.
Not applicable for page styles.
– Custom Styles – lists only the user-defined styles defined for the spreadsheet.
Introduction to Templates
A template is a model that you use to create other documents in a standard format. For example,
you can create a template for invoices that has your company logo and address at the top of the
page. This means that any new spreadsheets (invoices) created from this template will have the
company logo and address on the first page of the spreadsheet.
A significant advantage of using templates is that when a spreadsheet is created, the custom
styles of the template are integrated into the new spreadsheet, so you will already have your
styles defined without needing to create or modify them.
Templates can contain anything that regular documents can contain, such as text, graphics,
styles; user-specific setup information such as measurement units, language, default printer; and
toolbar and menu customization.
All documents in LibreOffice 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 spreadsheet,
then that new spreadsheet is based on the included Calc default template. This default template
Chapter 4 Using Styles and Templates | 141
consists of a blank spreadsheet which you can customize to your needs and then, if you wish,
use as a basis to create a custom default template.
Using a template to create a spreadsheet
A new installation of LibreOffice may not include any spreadsheet templates other than the Calc
default, but you can create your own (see “Creating a template” on page 143) or install
templates obtained from other sources (see “Adding templates obtained from other sources” on
page 145).
When you have an available spreadsheet template, you can use it to create a new spreadsheet
from the Templates dialog or the LibreOffice Start Center.
Creating a spreadsheet from the Templates dialog
To use a template to create a spreadsheet:
1) On the Menu bar, choose File > New > Templates, or click the small arrow next to the
New icon on the Standard toolbar and select Templates, or press Ctrl+Shift+N. The
Templates dialog (Figure 112) opens.
2) In the Filter lists at the top of the Templates dialog, select Spreadsheets and the
category of template you want to use. All the templates in that category are then listed
on the page, as shown in Figure 112.
3) Select the required template and click Open, or double-click the required template, or
right-click the required template and select Open in the context menu. A new
spreadsheet based on the template opens in Calc.
In the spreadsheet, the template it is based upon is listed in File > Properties > General. The
connection between a template and a spreadsheet remains until that template is modified. The
next time a spreadsheet based on that template is opened, you can choose either to update, or
not update, the spreadsheet to match the modifications.
Figure 112 shows the default configuration for the Templates dialog, with the available templates
represented by thumbnails. It is also possible to view the available templates in a list format that
includes additional information which may help identify the template of interest, as shown in
Figure 113. To switch between these two views, use the Thumbnail View and List View icons
located at the bottom left of the dialog.
Figure 112: Templates dialog, showing a selected template in thumbnail view
142 | Calc Guide 26.2
Figure 113: Templates dialog, list view
Creating a spreadsheet from a template in the Start Center
You can create a spreadsheet from the Template view of the LibreOffice Start Center, which is
visible when no other document is open.
Click the Templates button in the left pane and icons are displayed in the Start Center for all
available LibreOffice templates. At the top left of the Start Center is a Filter drop-down list to
select the templates of a given type of document. If you select the Spreadsheets option on the
list, only the available spreadsheet templates are displayed in the Start Center. Click on the
required template to create a new document based on that template.
Creating a template
From any spreadsheet:
1) Open a new or existing spreadsheet that you want to use as a base for the template.
2) Add any necessary predefined content that you want to appear in a spreadsheet each
time you use the new template, for example company logo and name, company
information, page numbers, and so on. Delete any information that you do not want in
the template.
3) Create or modify the cell, drawing, and page styles that you want to use in the template.
4) On the Menu bar, choose File > Templates > Save as Template, or click the down
arrow at the right of the Save button on the Standard toolbar and select Save as
Template, or press Shift+F11. The Save As Template dialog (Figure 114) opens,
displaying the existing template categories and a name box.
5) Type a name for the new template and select the required template category. You can
also choose to make this the default template (see “Setting the default template” on
page 147 for more information).
6) Click Save to save the new template.
Note
Although the Save as Template dialog shows no document type when saving a new
template of any type, the template will appear on the correct tab (Spreadsheets, in
this case) when you return to the Templates dialog. It is unnecessary to save or do
anything further with the spreadsheet file you have been using to create the new
template. It can be safely closed without saving.
Chapter 4 Using Styles and Templates | 143
Figure 114: Save As Template dialog
Note
You can also save a template through the Save As dialog, accessed by a variety of
interactions including selecting File > Save As on the Menu bar or pressing
Ctrl+Shift+S. Select the ODF Spreadsheet Template option in the Save as type
menu and navigate to the appropriate template folder before clicking the Save
button.
Editing a template
You can edit a template’s styles and content. If you wish, you can then apply the new styles to
spreadsheets that were created from the original template (see below for details).
To edit a template:
1) On the Menu bar, choose File > Templates > Manage Templates, or press
Ctrl+Shift+N, to open the Templates dialog. You can also manage templates from the
Start Center.
2) Navigate to the spreadsheet template that you want to edit. Right-click to open the
context menu and choose Edit (Figure 115). The template opens in Calc.
Figure 115: Templates dialog – Editing templates
144 | Calc Guide 26.2
3) Edit the template as you would edit any other spreadsheet. To save the changes,
choose File > Save on the Menu bar or perform any equivalent action. To save the
edited template as a new template, choose File > Save As Template or perform any
equivalent action.
Updating styles from a changed template
If you make any changes to a template and its styles, the next time you open a spreadsheet that
was created before you changed the template, a confirmation message is displayed.
1) Click Update Styles to apply the changed styles in the template to the spreadsheet.
2) Click Keep Old Styles if you do not want to apply the changed styles in the template to
the spreadsheet.
Caution
If you select Keep Old Styles, the confirmation message will not appear again the
next time you open the spreadsheet using the same changed template. Although the
template is still listed under File > Properties > General, the spreadsheet is no
longer connected to the template, so it will not update. You can still import styles
manually from the template, but to reconnect the spreadsheet to the template, you
need to use one of the procedures described in “Changing the template assigned to
a document” below.
Changing the template assigned to a document
Changing the template assigned to a document or reconnecting a document to a template can
be accomplished either manually or by using the Template Changer extension. The Template
Changer extension works with Writer, Calc, Draw, and Impress.
Manual method:
1) Create a new, blank document from the required template as described above.
2) Copy the contents of the old document into the new document.
Extension method:
1) Download the Template Changer extension from [Link]
2) Install the extension.
3) Restart LibreOffice to activate it.
4) Open the document.
5) From the Menu bar, use File > Templates > Change template (current document).
Adding templates obtained from other sources
LibreOffice refers to sources of templates as repositories. A repository can be local (a directory
on your computer to which you have downloaded templates) or remote (a URL from which you
can download templates).
To get to the official LibreOffice template repository, type [Link] in
your browser’s address bar. This opens the Extensions web page. In the Search section, click
the Templates tag filter. You can narrow your search by also choosing other tag filters. After
setting the filters, click the Search button. In the search results, find the required template and
Chapter 4 Using Styles and Templates | 145
click on its name to display a page with details; click the Download button to put the template
anywhere on your computer. Proceed to “Installing templates” below.
You can also use the Extensions button in the Manage menu of the Templates dialog, as shown
in Figure 116. In this version of LibreOffice, there is no easy way to filter this list, so you may
prefer to go directly to the web page, as described above.
Figure 116: Getting more templates for LibreOffice
Installing templates
You can import and add templates to your collection as follows:
1) Find and download the template you want to use, as described in the previous section.
2) Open the Templates dialog and click the Import button in the Manage menu.
3) In the pop-up dialog, select the category where you want to store the template. (You
can change this later, as described in “Moving a template” below.)
4) A file browser opens. Navigate to the location of the downloaded template on your
computer.
5) Select the template and click Open. After import, the template becomes available in the
Templates dialog.
Tip
You can manually copy new templates into the template folders. The location varies
with your computer’s operating system. To learn where the template folders are
stored on your computer, go to Tools > Options > LibreOffice > Paths.
Installing collections of templates
The Extension Manager may be used to install collections of templates as follows:
1) Download the extension package (.OXT file) and save it anywhere on your computer.
2) In LibreOffice, select Tools > Extension Manager on the Menu bar, or press
Ctrl+Alt+E. In the Extension Manager dialog, click Add to open a file browser window.
3) Find and select the package of templates you want to install and click Open. The
package begins installing. You may be asked to accept a license agreement.
4) When the package installation is complete, you may need to restart LibreOffice. The
templates are available for use through the Templates dialog and the extension is listed
in the Extension Manager.
See Chapter 16, Setting up and Customizing, for more about the Extension Manager.
Tip
Some extensions are packaged as .ZIP files.
146 | Calc Guide 26.2
Setting the default template
If you create a new spreadsheet using File > New > Spreadsheet on the Menu bar or an
equivalent action, Calc creates the document from the default template for spreadsheets. You
can set any template as the default template. You can also reset the default template to the Calc
default template.
Setting a template as the default
Most default settings, such as page size and page margins, can be changed but those changes
normally apply only to the spreadsheet you are working on. To make those changes the default
settings for spreadsheets, you need to replace the default Calc template with a new one.
You can set any template displayed in the Templates dialog to be the default for that document
type:
1) On the Menu bar, choose File > Templates > Manage Templates or press
Ctrl+Shift+N.
2) In the Templates dialog, open the category containing the template that you want to set
as the default.
3) Right-click on the template and click the Set as Default option (Figure 115). The
template is now indicated by a green check mark in the upper left.
The next time you create a spreadsheet by choosing File > New, by clicking the New icon on the
Standard toolbar, or by pressing Ctrl+N, it will be created from this template.
Resetting the default template
To set the default spreadsheet template back to the default template supplied with Calc:
1) In the Templates dialog, click the Manage button on the upper right (Figure 117).
2) Point to Reset Default Spreadsheet in the drop-down menu. The green check mark is
removed from the template.
This choice does not appear unless a custom template has been set as the default, as described
in the previous section.
Figure 117: Resetting the default template for spreadsheets
You can also reset the default template as follows:
1) Go to the Templates dialog and open the category containing the template you set as
default. It is indicated by a green check mark.
2) Right-click on this template and select Reset Default in the context menu. The next
time that you create a new spreadsheet, it will be created using the Calc default
template.
Chapter 4 Using Styles and Templates | 147
Note
Resetting the default template back to the Calc default template is only available if
the default has been changed previously.
Organizing templates
LibreOffice manages templates that are stored in its designated template folders, also known as
categories. However, you can still create a spreadsheet from a template located outside these
folders. To better organize your templates, you can create new template folders and import
templates into them. For instance, you might set up one folder for sales templates and another
for invoice templates. Templates can also be exported when needed.
Tip
The location of template folders in LibreOffice depends on the operating system of
your computer. If you want to know where the template folders are located, go to
Tools > Options > LibreOffice > Paths.
To begin, choose File > Templates > Manage Templates, or press Ctrl+Shift+N, to open the
Templates dialog.
Creating a template category
1) Click the Manage button on the Templates dialog and select New Category in the drop-
down menu (Figure 118).
2) In the pop-up dialog (not shown), type a name for the new category and click OK. The
new category now appears in the list of categories.
Note
You cannot create a sub-category inside a template category.
Figure 118: Creating a new category
Deleting a template category
You cannot delete template categories supplied with LibreOffice. Nor can you delete categories
added by the Extension Manager unless you first remove the extension that installed them.
However, you can delete a category that you created:
1) Click the Manage button on the Templates dialog and select Delete Category in the
context menu (Figure 118).
2) Select the category to be deleted in the Delete Category dialog (not shown) and click
OK.
148 | Calc Guide 26.2
3) Select Yes in the confirmation dialog to confirm the deletion.
4) Calc displays a warning if it is unable to delete the category.
Moving a template
To move a template from one template category to another:
1) Open the Templates dialog and select the template you want to move.
2) Right-click the template you want to move and select the Move option from the context
menu, select the destination category from the popup dialog (Figure 119), and click OK.
The selected template is moved to the folder. You can also create a new category into
which to move the template.
Figure 119: Moving a template to another category
Deleting a template
You cannot delete templates supplied with LibreOffice. Nor can you delete any templates
installed by the Extension Manager except by removing the extension that installed them. You
can only delete templates that you have created or imported.
1) In the Filter drop-down lists at the top of the Templates dialog, select the category that
contains the template you want to delete.
2) Right-click on the template that you want to delete to open the context menu and click
Delete (Figure 115).
3) A message box appears and asks you to confirm the deletion. Click Yes.
Note
Moving or deleting a template has no impact on any document that was created from
that template. The spreadsheet will retain the style definitions that it inherited from
the moved or deleted template. The Template field on the File > Properties >
General page can continue to show the name of a template that no longer exists.
Chapter 4 Using Styles and Templates | 149
Exporting a template
The easiest way to send a template to someone else, or to store it on a network, is to export it:
1) Open the Templates dialog and find the template that you want to export.
2) Right-click the template you want to export and select the Export option from the
context menu.
3) The Select Folder dialog opens. Navigate to the location where you want to export the
template and click Select Folder. You can also rename the template.
Note
Exporting a template does not remove it from the Templates dialog. The action
places a copy of the template in the location you specify.
150 | Calc Guide 26.2
Calc Guide 26.2
Chapter 5
Using Images and
Graphics
Introduction
Calc is a powerful tool for presenting and analyzing data, as well as making forecasts and
predictions. Incorporating graphics can transform a standard spreadsheet into a more engaging
and memorable document. Calc supports importing a wide range of vector (line drawing) and
raster (bitmap or photo) file formats. Commonly used formats include GIF, JPG, PNG and now
WEBP. For a complete list of supported formats, refer to the LibreOffice Help documentation.
There are three basic types of graphics:
• Image files, such as photographs, drawings, and scanned images
• Diagrams created using LibreOffice’s drawing tools
• Charts and graphs created using LibreOffice’s Chart facility; see Chapter 6, Creating
Charts and Graphs, for more information
Using graphics in Calc is similar to using graphics in other components of LibreOffice. For more
detailed descriptions, please refer to the Getting Started Guide or the Draw Guide.
Note
In LibreOffice, the terms graphics and images refer to both pictures and drawing
objects. Often the word images is used when referring to pictures and other graphics
that are not drawing objects.
Adding graphics to a spreadsheet
Images, such as corporate logos and photographs, are probably the most common types of
graphics added to a spreadsheet. They may be downloaded from the Internet, scanned, created
with a graphics program, photographs taken with a digital camera, or clip art in the Gallery.
Embedding an image into a spreadsheet makes the image a permanent part of the spreadsheet
file. Any changes you make to an embedded image will appear only in that spreadsheet; the
original image will not be affected.
Inserting an image file
Locally stored images can be inserted into a spreadsheet using one of the following methods.
Drag and drop
1) Drag an image from the file browser into the spreadsheet and drop it in the appropriate
cell.
Insert Image dialog
1) Click in the spreadsheet where you want the image to appear.
2) Choose Insert > Image on the Menu bar.
3) On the Insert Image dialog (Figure 120), navigate to the file to be inserted, and select it.
4) Select the Link option if you want to link the file instead of embedding it.
5) Select the required option in the Anchor menu: To cell, To cell (resize with cell), or To
page. See “Anchoring images” below for more information about these options.
6) Click Open. The image is inserted into the spreadsheet.
152 | Calc Guide 26.2
Figure 120: Insert Image dialog
Note
Both methods embed a copy of the image file into the document. To create a link to
the file instead of embedding it, hold down the Ctrl+Shift keys while dragging the
image. Additional details can be found in the section titled “Linking an image file“
below. When linking is selected, Calc may display a confirmation dialog offering the
choice to proceed with linking or to embed the image instead. This dialog also
includes an option to prevent it from appearing in the future.
Inserting an image from the clipboard
Using the clipboard, you can copy images into a Calc spreadsheet from another LibreOffice
document and from other programs. To do this:
1) Open both the source document and the target document.
2) In the source document, copy the image to the clipboard – the exact interactions will
vary from program to program.
3) Switch to the target document and click to place the cursor in the cell where the image
is to be anchored.
4) Select Edit > Paste on the Menu bar, or click the Paste icon on the Standard toolbar, or
right-click and select Paste in the context menu, or press Ctrl+V.
Caution
If the application from which the image was copied is closed before the image is
pasted into the target, the image stored on the clipboard could be lost.
Inserting an image using a scanner
If a scanner is connected to your computer, Calc can call the scanning application and insert the
scanned item into the document as an image. To start this procedure, choose Insert > Media >
Chapter 5 Using Images and Graphics | 153
Scan > Select Source. After selecting the scanner, place the cursor where you want the image
to be inserted, and choose Insert > Media > Scan > Request.
Although this practice is quick and easy, it is unlikely to result in a high-quality image of the
correct size. You may get better results by passing scanned material into a graphics program
and cleaning it up there, before inserting the resulting image into Calc.
Inserting an image from the Gallery
The Gallery (Figure 121) provides a convenient way to group reusable objects such as images
and sounds that you can insert into your documents. The Gallery is available in all components
of LibreOffice. You can add your own images as well as using the ones supplied with LibreOffice.
For more information, see the Getting Started Guide.
Figure 121: The Gallery in the Sidebar
To insert an image from the Gallery:
1) Click the Gallery icon on the Sidebar, or select View > Gallery on the Menu bar.
2) Select a theme.
3) Select an object with a single click.
4) Drag and drop the image into the document.
5) Alternatively right-click on the object in the Gallery and choose Insert in the context
menu, in which case the image will be positioned according to the cells selected in the
spreadsheet.
Tip
To use gallery images from earlier versions of LibreOffice, go to
[Link] and search for items with a tag filter of “Gallery” or
click on the Add more galleries via extension button, on the bottom right of the
Gallery to open the Extensions: Gallery dialog.
154 | Calc Guide 26.2
Linking an image file
When the Link option is selected in the Insert Image dialog, or when the Ctrl+Shift keys are
held during a drag-and-drop action, Calc creates a link to the image file rather than embedding
it. The image appears in the document, but only a reference to the file is saved—meaning the
image and the document remain separate. They are combined only when the document is
opened again.
Advantages of Linking:
The image file can be modified independently. Any updates to the image will be
reflected the next time the spreadsheet is opened. This is particularly useful when
images are maintained by another contributor, such as a graphic designer.
Linking also helps reduce the saved file size of the spreadsheet, since the image itself
is not stored within the document. While file size is generally not a concern on modern
systems, this can still be beneficial for managing large documents.
Disadvantage of Linking:
When sharing the document or moving it to another system, the image files must also
be transferred. The original folder structure must be preserved—for example, storing
images in a subfolder named Images within the same directory as the spreadsheet.
Recipients must replicate this structure to ensure the images display correctly.
Note
When inserting the same image several times in a document, it might appear
beneficial to create links. However, this is not necessary, as LibreOffice embeds only
one copy of the image file in the document. Deleting one or more of the copies does
not affect the other copies of the same file.
Embedding linked images
When images are originally linked, they can later be embedded into the document with ease.
1) Open the spreadsheet in Calc.
2) Choose Edit > Links to External Files on the Menu bar to open the Edit Links dialog
(Figure 122), which shows all the linked files.
Figure 122: Edit Links dialog
3) Select the files to convert from linked to embedded.
Chapter 5 Using Images and Graphics | 155
4) Click Break Link and confirm the action. The selected files will then be embedded into
the spreadsheet.
Note
Converting embedded images back to linked ones is more complex. Each image
must be replaced individually, ensuring the Insert as Link option is selected during
reinsertion.
Modifying images
Inserted images may require modification to suit the document. Any changes made in Calc do
not affect the original image regardless of how it was inserted.
Calc provides several tools for working with images. These tools are sufficient for most
requirements. However, for professional results it is generally better to use Draw or other
software designed to modify image files, and then insert the result into Calc.
Using the Image toolbar
When inserting or selecting an image in the spreadsheet, the Image toolbar (Figure 123)
replaces the Formatting toolbar. The Image toolbar can also be shown using View > Toolbars >
Image on the Menu bar. The tools available on the Image toolbar are described below.
Figure 123: Image toolbar
Note
Changes to image properties affect only the display and printing of the image. The
original image file remains unchanged.
• Anchor – choose between anchoring the image to a cell (with or without resize) or to a
page. See “Anchoring images” below.
• Align Objects – adjust the horizontal and vertical alignment of multiple images in
relation to each other. See “Aligning images” below.
• Six buttons for arrangement (positioning images in the stacking order): Bring to Front,
Forward One, Back One, Send to Back, To Foreground, To Background. See
“Arranging images” below.
• Line Style, Line Width, Line Color – set the attributes of the border around the image.
• Area Style / Filling – sets the color or other characteristics of the non-transparent
background area that contains the image, not the image itself. See the Draw Guide for
more information on how to modify areas.
• Shadow – sets the default shadow effect around the image. To adjust the shadow
effect, open the Area dialog (Format > Object > Area) and choose the Shadow tab.
• Filter – opens the Image Filter toolbar. See the Draw Guide for details on image filters.
156 | Calc Guide 26.2
• Image Mode – changes the display of the image from color (Default) to grayscale, black
and white, or a watermark. This setting affects only the display and printing of the
image; the original image file remains unchanged.
• Crop Image – places cropping handles around the image. Drag a handle to crop (hide)
the edges of the image.
• Flip Horizontally and Flip Vertically – changes the orientation of the image.
• Rotate – places rotation handles around the image.
• Transparency – adjusts the degree of transparency of the image between 0% (opaque)
and 100% (fully transparent).
• Color – opens the Color toolbar (Figure 124) to adjust the values of the red, green, blue
colors, brightness, contrast and gamma.
Figure 124: Color toolbar
Using the Properties deck in the Sidebar
Some of the settings in the Image toolbar are also available in the Properties deck on the
Sidebar when an image is selected. The options in the Properties deck include the Image, Line,
Position and Size, and Columns settings.
Adding text
Text can be added directly to an image or drawing object. Once added, the text will move along
with the image when repositioned. For more information on adding text to images, see the Draw
Guide.
1) Double-click on the image. The text cursor flashes in the center of the image. The Text
Formatting toolbar automatically opens at the top of the spreadsheet.
Figure 125: Text Formatting toolbar for images
2) Enter the desired text and use the tools on the Text Formatting toolbar to format it. Most
of these tools are the same as those for formatting text in cells.
3) To adjust the position of the text or how it appears in the image, right-click on the image
while the text cursor is active and select Text in the context menu to open the Text
dialog (Figure 126).
4) Make any necessary changes and click OK to close the dialog.
Chapter 5 Using Images and Graphics | 157
Figure 126: Text dialog
Positioning, resizing, and arranging images
Using the mouse
To move an image to a new position in your spreadsheet, click on the image and drag it to a new
position. The image will still be anchored as it was originally.
To resize an image:
1) Click on the image to display the selection handles.
2) Position the mouse pointer over one of the selection handles. The pointer changes
shape, giving a graphical representation of the direction of the resizing. The corner
handles resize both the width and the height of the image simultaneously. The top,
bottom, left and right handles only resize one dimension at a time.
3) Click and drag to resize the image.
Tip
To retain the original proportions of the image, click and drag one of the corner
handles. If you want to change the original proportions, Shift+Click one of the
corner handles, then drag.
Using the Position and Size dialog
To accurately position and size an image in your spreadsheet, click on the image and then go to
Format > Object > Position and Size on the Menu bar, or right-click on the image and select
Position and Size in the context menu.
The following values can be set using the Position and Size tab (Figure 127) of the Position and
Size dialog:
• Position – the location of the selected image on the spreadsheet.
– Position X – the horizontal distance from the base point selected in the grid.
– Position Y – the vertical distance from the base point selected in the grid.
• Size – the width and height of the image with respect to the selected base point.
158 | Calc Guide 26.2
• Protect – to prevent accidental movement or resizing of the image, select the relevant
option.
The units of measurement used for X / Y coordinates and the width and height of the image are
set by going to Tools > Options > LibreOffice Calc > General > Measurement unit.
By default, the base point for positioning and sizing objects is located in the upper-left corner of
the spreadsheet. This base point can be temporarily changed to simplify alignment or
dimensioning by clicking a position that corresponds to the desired reference point. This
adjustment is valid for a single use only; once the Position and Size dialog is closed, the base
point resets to the default top-left corner.
Images can also be rotated or slanted using the Rotation or Slant & Corner Radius tabs within
the Position and Size dialog. See the Draw Guide for details.
Figure 127: Position and Size dialog – Position and Size tab
Arranging images
Each image inserted into a spreadsheet is stacked above the previous one, regardless of
whether the images overlap. The Arrange commands can be used to modify the stacking order
of these images. Note that the stacking order of text cannot be changed.
1) Select the image to be reordered.
2) Navigate to Format > Arrange on the Menu bar, or right-click on the image and select
Arrange in the context menu. Then select one of the available arrangement options.
3) Alternatively, use one of the six arrangement icons on the Image toolbar to quickly
adjust the image’s position in the stacking order.
The arrangement options are as follows:
• Bring to Front – moves the selected image to the top of the stack, placing it in front of
all other images.
• Forward One – moves the selected image up one level in the stack.
• Back One – moves the selected image down one level in the stack.
• Send to Back – moves the selected image to the bottom of the stack, placing it behind
all other images.
Chapter 5 Using Images and Graphics | 159
• To Foreground – places the selected image in front of text.
• To Background – places the selected image behind text. To modify or replace a
background image, use the Navigator, as direct selection methods such as clicking or
double-clicking will not work.
Anchoring images
Anchor images so they stay in their position in relation to other items.
• To Page – anchor an image to the page to position it in a specific place. The image
does not move when cells are added or deleted; it will always stay in the same position
on the page where it is placed.
• To Cell – anchor an image to a cell to ensure that the image always stays with the
content it is originally anchored to. If an image is anchored to cell B10, and a new row is
inserted above row 10, the image will then be anchored to cell B11.
• To Cell (resize with cell) – similar to To Cell but with the additional property that the
image resizes as you resize the cell to which it is anchored.
To anchor a selected image or change the type of anchor used:
• Navigate to Format > Anchor on the Menu bar, or right-click on the image and select
Anchor in the context menu, or click on the Anchor icon on the Image toolbar.
• Select To Page, To Cell, or To Cell (resize with cell) in the menu.
Tip
Use Fit to Cell Size in the graphic (image) context menu to resize the image to the
cell dimensions, adjusting the row height and column width as needed.
Aligning images
When multiple images are present in a spreadsheet, aligning them can enhance the overall
visual consistency and create a more professional appearance. Alignment options include three
horizontal settings—left, center, and right—and three vertical settings—top, middle, and bottom.
These options help ensure that images are positioned uniformly within the layout.
1) Select all of the images to be aligned (select one and hold down the Shift key while
selecting others).
2) Go to Format > Align Text on the Menu bar, or click the down arrow at the right of the
Align Objects icon on the Image toolbar, or right-click on one of the images and select
Align Objects in the context menu.
3) Select one of the options available for alignment.
Tip
Press the main area of the Align Objects icon on the Image toolbar (to the left of its
down arrow) to quickly left align the selected images.
Grouping and ungrouping images
To group several images so that they become a single object in the spreadsheet:
1) Select the images you want to group (select one and hold down the Shift key while
selecting others).
160 | Calc Guide 26.2
2) Go to Format > Group > Group on the Menu bar, or right-click on one of the selected
images and select Group in the context menu.
Note
When grouping images, the resulting image is anchored To Page. You can change
the anchor as usual.
To ungroup images:
1) Select the image group you want to ungroup.
2) Go to Format > Group > Ungroup on the Menu bar, or right-click on one of the
selected images and select Ungroup in the context menu.
To edit an image in a group:
1) Select the image group where you want to edit an image within the group.
2) Go to Format > Group > Enter Group on the Menu bar, or right-click on one of the
selected images and select Enter Group in the context menu.
3) Select the target image and make the changes.
4) Navigate to Format > Group > Exit Group on the Menu bar, or right-click on one of the
selected images and select Exit Group in the context menu.
Using LibreOffice’s drawing tools
Calc, like other components of LibreOffice, includes a variety of tools for creating drawings such
as simple diagrams using rectangles, circles, lines, text, and other shapes. Multiple drawing
objects can be grouped to maintain their relative position and proportions when moved or
resized.
These drawing tools can also be used to annotate photographs, screen captures, or illustrations
created in other programs; however, this practice is not recommended. For more complex
drawings, it is advisable to use LibreOffice Draw and then insert the completed drawing into the
spreadsheet. For a more detailed explanation, see the Draw Guide.
Figure 128: Graphic connectors in Calc
Drawing toolbar
To begin using the drawing tools, go to View > Toolbars > Drawing to open the Drawing toolbar.
It appears at the bottom of the spreadsheet by default, but it may be moved to a more
convenient position as needed.
When the Drawing toolbar opens, it displays a default set of tools as shown in Figure 129. Hover
the mouse pointer over a tool to see a tooltip describing its function. Icons with small arrows on
the right side open with palettes of tools. To add tools to the Drawing toolbar, right-click in an
empty area on the toolbar and select Visible Buttons from the context menu.
Chapter 5 Using Images and Graphics | 161
Figure 129: Drawing toolbar
To use a drawing tool:
1) Click on the tool in the Drawing toolbar (Figure 129). The mouse pointer changes to a
drawing-functions pointer and the normal Formatting toolbar changes to the Drawing
Object Properties toolbar (Figure 130).
Figure 130: Drawing Object Properties toolbar after inserting an object.
2) Move the cross-hair pointer to the target cell and then click and drag to create the
object.
3) To cancel the active drawing function, click on the tool’s icon again, press the Esc key,
or click on the Select (cursor) icon on the Drawing toolbar.
4) To change the fill color, line type and weight, anchoring, and other properties of the
drawing object, use the Drawing Object Properties toolbar (Figure 130) or the
Properties deck on the Sidebar (Figure 131). Some properties may be adjusted by right-
clicking on the drawing object.
162 | Calc Guide 26.2
Figure 131: Properties deck in Sidebar for drawing object
Presetting drawing object defaults
The default properties for a drawing object may be defined before the object is drawn. Such
default properties are applied only to the current spreadsheet and are not retained when the
spreadsheet is closed. To preset the default properties for a drawing object:
1) Click Select on the Drawing toolbar (Figure 129).
2) Use the active controls on the Drawing Object Properties toolbar (Figure 132) to set the
default value for each property. Area and line properties such as color and thickness are
set using a palette menu.
Figure 132: Drawing Object Properties toolbar
For more information on the properties of drawing objects, see the Draw Guide.
Resizing drawing objects
Select the object and click on one of the selection handles then drag the object to its new size.
For a scaled resizing, select one of the corner handles and keep the Shift key pressed while
dragging the handle. For more information, see “Positioning, resizing, and arranging images”
above.
Chapter 5 Using Images and Graphics | 163
Grouping and ungrouping drawing objects
For grouping, ungrouping, and editing grouped drawing objects, see “Grouping and ungrouping
images” above.
Additional tools
Right-clicking on an image or drawing object opens a context menu with additional tools.
Description:
Add metadata in the form of a title and description to an image. This information is used
by accessibility tools (such as screen reader software) and as ALT (alternative text)
attributes if you export the document to HTML.
Name:
Adding a custom name to be assigned to an image will make the image easier to find in
the Navigator.
Rotate or Flip:
Rotate the image or flip it horizontally or vertically.
Assign Macro:
Add programmable functionality to the graphic. For more information, see Chapter 14,
Macros.
Edit Hyperlink:
Define a hyperlink from an image to another location in the spreadsheet, another
document, or a web page. Select Edit Hyperlink in the context menu to open the
Hyperlink dialog. See Chapter 12, Linking Data, for more information on hyperlinks.
Compress:
Compress images to reduce the file size of the spreadsheet. Select Compress in the
context menu to open a Compress Image dialog where you can set the compression
options. (Option not available for drawing objects.)
Edit with External Tool:
Edit an image with an external tool. The dialog that opens will depend on your computer
setup. (Option not available for drawing objects.)
Using Fontwork
Fontwork allows the creation of graphical text art objects that can enhance the visual appeal of a
document. A wide variety of customization options are available, including settings for line, area,
position, size, and more, offering extensive creative flexibility.
Fontwork is included in every component of LibreOffice. However, slight differences may be
observed in how it is displayed or accessed across the various components.
Creating a Fontwork object
1) On the Fontwork toolbar (View > Toolbars > Fontwork, see Figure 133) or the Drawing
toolbar (View > Toolbars > Drawing), click the Insert Fontwork Text icon.
Figure 133: Fontwork toolbar
164 | Calc Guide 26.2
2) In the Fontwork Gallery (Figure 134), select a Fontwork style, then click OK. The
Fontwork object will appear in the document.
3) Double-click the object to edit the Fontwork text (Figure 135). Select the text and type
over the black Fontwork text that appears in front of the object.
4) Click anywhere in a free space or press Esc to apply your changes.
Figure 134: The Fontwork Gallery
Editing a Fontwork object
Fontwork object attributes may be changed using the Fontwork toolbar, the Formatting toolbar,
or menu options. For more information, see the Getting Started Guide.
Figure 135: Editing Fontwork text
Generating a QR or Barcode
The QR and Barcode generation feature may be used to encode any text string or URL as a
barcode or QR code that can be inserted into the spreadsheet as an image.
Choose Insert > OLE Object > QR and Barcode on the Menu bar to open the QR and Barcode
dialog (Figure 136).
Chapter 5 Using Images and Graphics | 165
Figure 136: QR and Barcode dialog
Fill in the URL/Text field, select an Error correction factor (the complexity of the graphic
generated), enter the width in dots of the surrounding border, and then click OK. Figure 137
shows the code generated by the inputs in Figure 136.
Figure 137: QR code example
After the QR or Barcode has been generated, it is possible to edit it by right-clicking in its image
and selecting Edit Barcode.
166 | Calc Guide 26.2
Calc Guide 26.2
Chapter 6
Creating Charts and
Graphs
Presenting information visually
Introduction
Calc offers a variety of ways to present data in the form of customizable charts and graphs.
For readers interested in effective ways to present information graphically, two excellent
introductions to the topic are William S. Cleveland’s The Elements of Graphing Data, 2nd edition,
Hobart Press (1994) and Edward R. Tufte’s The Visual Display of Quantitative Information, 2nd
edition, Graphics Press (2001).
Chart Wizard
Calc’s Chart Wizard may be used to create an initial chart from spreadsheet data. The Chart
Wizard includes options for changing the type of chart, adjusting data ranges, and editing chart
elements. Each change is immediately seen in the underlying chart.
The data shown in Figure 138 is used in the following sections to demonstrate Chart Wizard
functionality.
Figure 138: Example data for creating a chart
To create a chart using the provided data:
1) Select the cells containing all the data—including names, categories, and labels—to be
included in the chart. The selection can be a single block, individual cells, or groups of
cells (columns or rows). In this example, it may be best to select the cell range A2:D8,
which will intentionally omit the overall title “Equipment Rentals” from the chart.
Tip
When the data is in one place, the Chart Wizard can guess the range and create an
initial chart even if all the data is not selected. Before opening the Chart Wizard, just
place the cursor or select a cell anywhere in the area of the data.
2) To place a chart on the spreadsheet as an object (Figure 139) and open the Chart
Wizard dialog (Figure 140), do one of the following.
– Go to Insert > Chart on the Menu bar.
– Click the Insert Chart icon on the Standard toolbar.
3) Choose the chart type and make any other selections desired. The options are
explained below.
4) Click Finish to save the selections and close the Chart Wizard.
168 | Calc Guide 26.2
Figure 139: Example chart automatically created using the Chart Wizard
Selecting chart type
Ten basic chart types are available in Calc. The options for customization vary by the type of
chart selected. For more information about the different chart types, see Chapter 7 Gallery of
Chart Types.
Figure 140: Chart Wizard dialog – selecting chart type
The initial chart created using the Chart Wizard is a 2D column chart. A small preview of the
selected variant is highlighted with a surrounding border, as shown in Figure 140. The name of
the variant (Normal in Figure 140) is shown below the preview.
To change chart types and options:
1) Select the type of chart from the list under Choose a Chart Type.
2) If needed, select a chart variant in the preview box by clicking on it. The options
available depend on the type of chart selected. The chart changes instantly to reflect
the selection.
Chapter 6 Creating Charts and Graphs | 169
To use a 3D chart, select the checkbox 3D Look and select the type of 3D view (Realistic or
Simple). This option is available only for column, bar, pie, or area charts.
1) Click Next to make changes to data range, data series, and chart elements, explained
in greater detail below.
2) When satisfied with the chart, click Finish to close the Chart Wizard.
Note
To recreate many of the charts shown in the following sections, select the Column
chart type, Normal variant, with the 3D Look option unchecked.
Selecting data range
The data range contains all the cells with data (including labels and categories) that should be
included in the chart. In the Data Range step of the Chart Wizard (Figure 141), manually correct
any mistakes in data selection for the chart.
Figure 141: Chart Wizard dialog – selecting data range
To use the Data Range page:
1) If necessary, change the rows and columns used as data for the chart by editing the cell
references in the Data range text box. Edit the cell references in one of these two ways:
– Directly modify the text in the Data range text box.
– Click the Select data range button to the right of the Data range box. Then use the
pointer to select the data range(s) on the spreadsheet.
2) Specify whether the data series are arranged in rows or in columns. In the example
data, shown in Figure 138, the data series are in columns.
3) Select whether to use the first row, or first column, or both, as labels.
4) Click Next to move to making changes to the data series (Figure 142).
5) When satisfied with the chart, click Finish to close the Chart Wizard.
Note
If the syntax for a data range is not correct, Calc highlights the Data range text box to
indicate the error and disables the Back, Next, and Finish buttons.
Selecting non-adjacent data
To create a complete data range from multiple cells that are not next to each other, use a
delimiter between individual ranges. For example, the English (USA) locale uses a comma as a
170 | Calc Guide 26.2
delimiter and “$Sheet1.A1:A5,$Sheet1.D1:D5” is a valid data range. A semicolon is another
commonly used delimiter.
The appropriate delimiter depends on the option selected in the Locale setting menu on the
Formats section at Tools > Options > Languages and Locales > General. See or change the
default delimiter for a locale at Tools > Options > LibreOffice Calc > Formula. In the
Separators section, Array column shows the default delimiter.
Note
The options under Tools > Options may not be available when the chart is in edit
mode. If desired, click outside the chart to leave edit mode and see the options. Click
the chart twice to enter edit mode again.
To select non-adjacent data, do one of the following while in step 1) above:
• Manually enter the data ranges in the text box with delimiter(s) between them.
• Select the data with the mouse pointer by first clicking the Select data range button to
the right of the Data range box. Place the pointer at the end of the first data range in the
text box (otherwise the first range is selected and then deleted) and enter the delimiter.
Then drag the pointer in the spreadsheet to select the next data range.
Note
When the data is in the same document as the chart, changes to the data are
instantly reflected in the chart.
Linking to external data
Calc offers several options for linking data to external sources. This enables data (and the chart
using the data) to automatically update when the external data changes. The following types of
files can be linked: HTML, Calc, Base, CSV, Excel, and registered data sources. For further
information, refer to Chapter 12, Linking Data.
Selecting data series
The Data Series page of the Chart Wizard (Figure 142) enables fine-tuning of the data. Each
data series contains a set of data that have something in common, such as the types of rental
equipment listed in Figure 138. Use the Data Series page to change the source range of each
data series and to organize how the data is presented in the chart. This includes removing
unnecessary data and specifying how data is plotted along the axes.
Organizing data series
Tip
The Chart Wizard makes initial assumptions about how the data should be
displayed, but the assumptions could be incorrect. If a chart does not look as
expected, the first thing to check is if all data series are defined correctly.
Also, check the settings on the Data Range page that define whether the data are in
rows or columns and whether the first row or first column should be considered
labels.
Chapter 6 Creating Charts and Graphs | 171
The names of each data series appear in the Data series list box (the middle box in Figure 142).
To organize the data series, select an entry in the Data series list and do one or more of the
following:
• To change the name of the data series, select Name in the Data ranges list on the right.
Edit the cell references in the Range for Name text box below.
• To change the cell references for data series categories, edit the cell references in the
Categories text box below the Data ranges box.
• Click Add to add another data series below the selected entry. The data ranges for the
new data series will then need to be defined.
• Click Remove to remove the selected entry from the Data series list.
• Click the Up or Down button to move the selected entry up or down in the Data series
list. This does not change the order in the data source table, but changes the
arrangement in the chart.
Note
Different data series must be in separate columns or rows. Otherwise, Calc will
assume that they are the same data series.
Setting data series ranges
To understand how Calc treats data in charts, it is important to understand the distinction
between values and categories. Values are numeric data that vary continuously. By contrast,
categories have no mathematical relationship with each other. For example, the categories for
the chart data referred to in Figure 142 and the chart shown in Figure 139 are months of the
year.
Most Calc charts require both value and category data, with values plotted along the Y axis and
categories plotted along the X axis. The exceptions are XY (scatter) charts and bubble charts,
which use value data along both axes.
Figure 142: Chart Wizard dialog - selecting data series
Data ranges that may be defined for a specific chart type appear in the Data ranges box on the
right side of the Data Series page, shown in Figure 142. Not all data ranges may need to be
filled in.
172 | Calc Guide 26.2
The data ranges may include:
Border Color and Fill Color
Border and fill colors for each data point in the data series can be specified here using
numeric values for the RGBA color system. If not specified here, Calc will use default
colors. Conditional formatting can also be used. This enables data point colors to vary,
depending on whether they meet certain conditions or values. For further information,
refer to “Assigning colors” on page 191.
Name
When Data series in columns and First row as label are selected on the Data Range
page, Calc assumes that the column labels of the selected data are the data series
names. Thus, Calc assumes that the data series names of the data in Figure 138 are
“Canoes”, “Boats”, and “Motors”. Similarly, when Data series in rows and First
column as label are selected, Calc assumes that the row labels of the selected data
are the data series names.
The only way to change a data series name is by selecting Name in the Data ranges
box in the upper right of the Data Series page (Figure 142). To change it enter a
different cell range in the Range for Name box that appears below the Data ranges box.
(Note that the data series name is often contained in a single cell, rather than a range of
cells.)
Y-Values
These are numeric values that are often plotted along the vertical axis. However, this is
not always the case. For example, while Y-values are plotted on the vertical axis in
column charts, they are plotted along the horizontal axis in bar charts.
Categories
The range for category data is defined in a separate Categories box below the Data
ranges box. Note the difference between categories and data series names. For the
data in Figure 138, the categories are the row labels while the data series names are
the column labels.
Note
XY (scatter) and bubble charts differ from other chart types because they use value
data for the X axis rather than category data. For the XY (scatter) and bubble chart
types, the Data Series page of the Chart Wizard includes a Data labels box instead
of the Categories box displayed for other chart types. To create a set of data labels
(one for each data point), enter the required text strings into a range of spreadsheet
cells and then enter details of that cell range into the Data labels box. The labels can
then be displayed on the chart by selecting the Show category option on the Data
Labels dialog (see Figures 173 and 174).
Depending on the type of chart, other data ranges may need to be defined in addition to those
shown in Figure 142.
Selecting chart elements
On the Chart Elements page of the Chart Wizard dialog (Figure 143), add or change the title,
subtitle, axes names, and grids. Use titles that draw the attention of viewers to the purpose of
the chart and describe what they should focus on.
Chapter 6 Creating Charts and Graphs | 173
Figure 143: Chart Wizard dialog – selecting and changing chart elements
The chart elements for 2D and 3D charts are illustrated in Figure 144.
• The chart wall contains the graphic displaying the data.
• The chart area is the background of the entire chart.
• The chart title and subtitle, chart legend, axes labels, and axes names are in the chart
area.
• The chart floor is only available for 3D charts.
Figure 144: Chart elements
To add elements to a chart, do one or more of the following on the Chart Elements page (Figure
143):
• Enter a title and subtitle (if desired) in the Title and Subtitle text boxes.
• Enter names to be used in the X axis and Y axis text boxes. The Z axis text box is only
active if creating a 3D chart.
174 | Calc Guide 26.2
• Select the Display legend checkbox (turned on by default) and choose where to
display the legend – Left, Right, Top, or Bottom. The names in the legend are the data
series names. Specify the names in the Range for Name field on the Data Series page.
• Under Display Grids, select the Y axis or X axis check boxes to display horizontal or
vertical grid lines respectively. For some charts, the axis grids are displayed by default.
Grids are not available for pie charts. The Z axis checkbox is only active when creating
a 3D chart. For further information about grids, refer to Grids on page 208.
Note
While clicking Finish closes the Chart Wizard, the chart remains in edit mode,
indicated by gray borders, and can still be modified. Click outside the chart in any cell
to exit the edit mode.
Using the Sidebar to change chart settings
The Properties deck of the Sidebar (Figure 145) may be used to set the basic appearance of
charts. To open the Sidebar, first click outside the chart to deselect it, then go to View > Sidebar
on the Menu bar or press Ctrl+F5. By default, the Sidebar opens on the right side of the
screen.
Figure 145: Sidebar Properties deck with chart selected (left) and in edit mode (right)
Chapter 6 Creating Charts and Graphs | 175
The contents of the Sidebar depend on whether the chart is selected or is in edit mode. The
Sidebar on the left in Figure 145 shows the Properties deck when a chart is selected (by clicking
on it once). When a chart is in edit mode (by clicking on it twice), the Properties deck on the right
in Figure 145 appears.
Tip
If the Properties deck of the Sidebar does not appear using the steps above, click
the Properties icon on the upper right of the Sidebar to launch it.
The options available on the Properties deck of the Sidebar are also available elsewhere. They
may be found in the Menu bar, the Formatting toolbar, or context menus (made available by
right-clicking a chart element).
Note
The Sidebar can be quite useful. However, because the options are easy to see and
are available elsewhere, further references to it are not included in this chapter.
Modifying charts
Calc provides many options for formatting and fine-tuning the appearance of charts. This
includes tools for editing the chart type, chart elements, data ranges, fonts, colors, and many
other options.
Modify charts in one of two ways, depending on what needs to be changed.
Edit object properties
Click on a chart once to edit its object properties. These include size, position on the
page, alignment, outer borders, copying, exporting, and more. See the sections starting
with “Resizing, moving, and positioning charts.” on page 223 for more information.
Use edit mode
Use edit mode to change data selection and chart type as well as elements such as
axes, titles, backgrounds, grids, data series, data labels, trend lines, and more.
Overview of using edit mode
Here are some general ways to modify charts in edit mode. These are discussed in greater detail
in the following sections.
• To add an element not already in the chart, use the Insert menu on the Menu bar. Insert
titles, legends, axis labels, grids, data labels, trend lines, mean value lines, error bars,
and special characters.
• To move or change the size of titles, axis names, chart walls, and legends, click on
them once. The pointer changes to a move icon (appearance depends on the system).
Drag the element to the new location. To change the size, drag the selection handles.
• Modify elements in a few basic ways. The following methods may open the appropriate
dialog or menu. Not all of these methods will work for every element:
– Double-click the element (see an exception below).
– Select the element from the Insert menu (Figure 146) or from the Format menu
(Figure 147) on the Menu bar.
– Click the element once, then click on the Format Selection icon on the Formatting
toolbar (Figure 148).
176 | Calc Guide 26.2
– Select the element from the Select Chart Element drop-down list, then click the
Format Selection icon next to it on the Formatting toolbar.
– Right-click the element to open the context menu.
• Double-click titles and axis names to change their spelling. To modify the spelling of
other text, such as categories, data labels, and legend entries, change the text in the
data on the spreadsheet.
• Click once on a data point (such as a column or bar) to select and edit the associated
data series.
– With a data series selected, double-click a single data point to edit its properties (for
example, a single column in a column chart).
Entering edit mode
To edit or format charts, double-click on the chart to place it in edit mode. The chart is now
surrounded by a gray border. In edit mode, the Menu bar changes and the Formatting toolbar
contains a number of formatting options and icons, as discussed in the following sections.
Note
The next several sections (until “Resizing, moving, and positioning charts.” on page
223) require a chart to be in edit mode.
Insert menu
In edit mode, the Insert menu on the Menu bar displays the options shown in Figure 146.
Figure 146: Insert menu when chart is in edit mode
Titles
Provides text boxes for entering chart title and subtitle as well as titles for X-, Y-, and Z-
axes, including secondary axes. For more information, see “Titles, subtitles, and axis
names” on page 182.
Legend
Specifies if a legend should be included and if so, where. For more information, see
“Legends” on page 183.
Chapter 6 Creating Charts and Graphs | 177
Axes
Provides options for showing or not showing axis labels. The Chart Wizard shows the
labels by default. For more information, see “Axes” on page 194.
Grids
Provides options for showing or not showing major and minor grids for X, Y, and Z axes.
To format grids, see “Grids” on page 208.
Data Table
Inserts a Chart Data Table and configure its appearance. Chart data tables allow to
visualize the data represented by the chart. A table containing the data is placed at the
bottom of the chart. See “Chart Data Tables” on page 205.
Data Labels
Provides options for text attributes, whether to show categories, and the position and
rotation of the labels. These labels appear on each data point. For more information,
see “Data labels” on page 201.
Trend Line
Specifies the type of regression line to be used, options for extrapolation, where the
axes should intersect, the name of the trend line, and whether and how the equation
should be displayed. The option is grayed out until a data series is selected. For more
information, see “Trend and mean value lines” on page 213.
Mean Value Lines
Displays mean value lines for selected or all data series. For more information, see
“Mean value lines” on page 217.
X Error Bars and Y Error Bars
Specifies the error category to be used, parameters, and display options for positive
and negative indicators. For more information, see “Error bars” on page 218.
Special characters
Enables the input of special characters in text strings (for example, title and subtitle).
The option is disabled if not relevant for the selected chart element. See Chapter 2,
Entering and Editing Data, for more information about inserting special characters.
Format menu
In edit mode, these settings appear on the Format menu (Figure 147) of the Menu bar.
Title
Formats the title and subtitle for the chart as well as axis names. The text must first be
entered on the Chart Elements page of the Chart Wizard or by going to Insert > Titles.
Legend
Formats the appearance and position of the legend. The legend must first be turned on
by using the Chart Elements page of the Chart Wizard or by going to Insert > Legend.
Axis
Formats properties such as where the axes cross each other, the scale of units, and
formatting of the axis labels.
Grid
Formats the grid lines. Use the Chart Elements page of the Chart Wizard to turn on
grids or go to Insert > Grids to turn grids on or off.
178 | Calc Guide 26.2
Figure 147: Format menu when chart is in edit mode
Chart Wall, Chart Floor, or Chart Area
Formats borders, area, and transparency of these elements. Note that the chart floor is
available only for 3D charts. See “Formatting chart backgrounds” on page 185 for more
information.
Chart Type
Changes the type of chart and whether it is a 2D or 3D chart. The various chart types
are explained in Chapter 7 “Gallery of Chart Types”.
Data Ranges
Sets ranges for all data in the chart and for individual data series, as explained in
“Selecting data range” on page 170, and “Selecting data series” on page 171.
3D View
Formats 3D charts and is only available for 3D charts. Note that only column, bar, pie,
and area charts can be displayed as 3D charts. See “3D charts” on page 209 for
information.
Format Selection
Opens a dialog with settings for whatever element is selected. Options may include
area fill, borders, positioning, transparency, fonts, labels, scale, and other attributes.
Character
Specify the formatting and the font that you want to apply. The changes are applied to
the current selection, to the entire word that contains the cursor, or to the new text that
you type.
Position and Size
Enables precise specification of the position and size of a selected element. The
position is defined in relationship to the chart. See “Position and Size dialog” on page
224 for more information.
Chapter 6 Creating Charts and Graphs | 179
Arrangement
Provides two options: Bring Forward and Send Backward. Only one option may be
active for some items. Use these options to arrange overlapping data series.
Formatting toolbar
In edit mode, the Formatting bar appears as in Figure 148. Click one of the icons to open a
dialog or turn an option on or off. The Insert and Format menus on the Menu bar, described
above, contain the same options, with one exception.
Figure 148: Formatting toolbar when chart is in edit mode
(8) Select Chart Element (14) Data Ranges (20) Vertical Grids
(9) Format Selection (15) Data Table (21) X Axis
(10) Chart Type (16) Titles (22) Y Axis
(11) Chart Area (17) Legend On/Off (23) Z Axis
(12) Chart Wall (18) Legend (24) All Axes
(13) 3D View (19) Horizontal Grids
The option Select Chart Element drop-down list does not appear elsewhere. Use it to easily
select individual chart elements. It can be especially helpful when the chart is crowded, or it is
otherwise difficult to select elements using the pointer. Note that options such as Data Labels or
Trend Line do not appear on this list unless they have already been inserted using the Insert
menu.
Selecting and moving chart elements
Selecting chart elements
After double-clicking on the chart to enter edit mode, select chart elements using one of the
following methods:
• Click once on the element in the chart (to select individual data points, click twice—but
not too quickly—after clicking once on the data series).
• Select the element from the Select Chart Element drop-down list that appears on the
left of the Formatting toolbar, as shown in Figure 148.
When selected, the chart element will be highlighted with square selection handles.
180 | Calc Guide 26.2
Tip
Hovering the cursor over an element will display the element name, making it easier
to select the correct element. The name of the selected element also appears in the
Status Bar, and it is displayed in the Select Chart Element area of the Formatting
toolbar.
Moving chart elements
It is possible to move individual elements of a chart, such as the title or axis names, independent
of other chart elements as follows:
1) Select the element as described above.
2) Keep pressing the mouse button. The pointer changes to the move icon (appearance
depends on computer setup).
3) Drag the pointer to move the element.
4) Release the mouse button when the element is in the desired location.
Alternatively, use the Position and Size dialog for some elements, as described on page 224.
Individual points or data series cannot be moved, except pie charts. Individual wedges of a pie
can be moved, or the entire pie can be exploded.
To move axis labels, see “Positioning axis, labels, and interval marks” on page 197. To move
data labels, see “Adding and formatting data labels for a data series” on page 201.
Tip
For some chart elements (such as title, subtitle, axis name, and legend), press the
arrow keys to move the object in small steps.
Note
When a 3D chart element is selected, round selection handles may appear. These
handles control the 3D angle of the element. Elements cannot be resized or
repositioned while they are showing. Clicking again obtains the square selection
handles that allow resizing and repositioning of the 3D chart graphic.
Changing chart type
To change the type of chart (bar, column, pie, line, and so on):
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Open the Chart Type dialog using one of these methods:
– Go to Format > Chart Type on the Menu bar.
– Click the Chart Type icon on the Formatting toolbar.
– Right-click on the chart and select Chart Type in the context menu.
The dialog is the same as the first page of the Chart Wizard dialog shown in Figure 140.
3) Select the chart type and variant desired.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Chapter 6 Creating Charts and Graphs | 181
For further information about the types of charts, please refer to the Chapter 7 “Gallery of Chart
types”.
Titles, subtitles, and axis names
Creating or changing text
To create or change the text of a chart title, subtitle, or axis name:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Use one of these methods to open the Titles dialog (Figure 149):
Figure 149: Titles insertion dialog
– Go to Insert > Titles on the Menu bar.
– Click on the Titles icon on the Formatting toolbar.
– Right-click in the chart area and select Insert Titles in the context menu.
3) Enter or edit the text in the appropriate text box.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Tip
The text of a title (but not formatting) can be modified directly. With the chart in edit
mode, double-click on the text to directly change it. Use Shift+Enter at the end of
the line to create an additional line that splits the text.
Formatting text
Use a more extensive Titles dialog to format the appearance of a chart title, subtitle, or axis
name. To access this dialog:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following to open the Titles dialog for formatting (Figure 150):
– Click Format > Title and select the desired type of title or the All Titles option.
182 | Calc Guide 26.2
– Click on the element in the chart, right-click, and select Format Title (or appropriate
element) from the context menu.
– Click on the element in the chart or select it in the Select Chart Element drop-down
list on the Formatting toolbar. Then select Format > Format Selection on the Menu
bar or click on the Format Selection icon on the Formatting toolbar.
3) Format titles or names as needed. The options are self-explanatory or easily
researched.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Figure 150: Titles formatting dialog (after selecting All Titles option)
Text inside chart's titles, text boxes and shapes (and parts thereof) can be formatted with the
Character dialog (available with the Character button in the Formatting toolbar, with the right-
click context menu, or with the top-bar menu: Format > Character). This allows, for example, to
use subscripts and superscripts in formulas annotating the chart.
Legends
When a legend is displayed, it shows data series names along with their graphical
representations, such as bars, lines, or points. It will also show trend and mean lines when those
are turned on, as shown in Figure 151.
Figure 151: Example of a chart legend at the bottom of a chart
Positioning, inserting, or deleting legends
Inserting or deleting only
To only insert or delete a legend:
1) Enter edit mode by double-clicking the chart. The chart should now be surrounded by a
gray border.
2) Do one of the following:
– Click on the Legend On/Off icon on the Formatting toolbar. The default position for
inserting a legend is on the right side of the chart.
Chapter 6 Creating Charts and Graphs | 183
– Right-click in the chart area and select Insert Legend or Delete Legend in the
context menu.
3) If desired, click outside the chart to leave edit mode.
Note
The names in the legend are the data series names. They are taken from the Name
data range, discussed in “Selecting data series” on page 171. Change a legend
name by changing the text in the spreadsheet.
Positioning, inserting, and deleting
To position a legend using the Legend dialog (Figure 152) as well as insert or delete it:
1) Enter edit mode by double-clicking the chart. The chart should now be surrounded by a
gray border.
2) Go to Insert > Legend on the Menu bar to open the basic Legend dialog.
Figure 152: Legend insertion dialog
3) Select or deselect the Display legend checkbox to either display or not display the
legend.
4) Select the desired location for the legend – Left, Right, Top, or Bottom.
5) Click OK to close the dialog.
6) If desired, click outside the chart to leave edit mode.
Tip
For finer positioning of the Legend, use one of the methods described in “Moving
chart elements” on page 181.
Formatting legends
For advanced editing of a legend’s appearance, a more extensive Legend dialog (Figure 153)
has several options for formatting borders, fill, fonts, transparency, and position.
1) Enter edit mode by double-clicking the chart. The chart should now be surrounded by a
gray border.
2) Do one of the following to open the Legend dialog (Figure 153):
– Click on the Legend icon on the Formatting toolbar.
– Select Format > Legend on the Menu bar.
184 | Calc Guide 26.2
– Right-click on the legend and select Format Legend in the context menu.
– Click on Legend in the Select Chart Element drop-down list on the Formatting
toolbar or click the legend in the chart to select it. Then click on the Format
Selection icon on the Formatting toolbar or select Format > Format Selection.
3) Make any desired changes. The options are self-explanatory or easily researched.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Figure 153: Legend formatting dialog
Formatting chart backgrounds
The background of a chart is divided into chart area, chart wall, and chart floor, as shown in
Figure 144. To set border, area, and transparency options for these areas:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following to open the appropriate dialog (such as Figure 154):
– Go to Format on the Menu bar and select Chart Wall, Chart Floor, or Chart Area.
– Right-click the chart wall, chart floor, or chart area in the chart and select Format
Wall, Format Floor, or Format Chart Area in the context menu. (For help with
selecting these areas, see “Selecting chart elements” on page 173.)
– On the Formatting toolbar, click on the Chart Area icon or the Chart Wall icon
(there is no icon for chart floor).
– Click on Chart Area, Chart Wall, Chart Floor, or Chart in the Select Chart Element
drop-down list on the Formatting toolbar. Then click the adjacent Format Selection
icon or select Format > Format Selection.
– Double-click on the chart area, chart wall, or chart floor.
3) Select the desired settings from the Borders, Area, and Transparency tabs.
4) Click OK to save the changes and close the dialog. If desired, click outside the chart to
leave edit mode.
In the steps above, references to the chart floor are only applicable for 3D charts.
Chapter 6 Creating Charts and Graphs | 185
Figure 154: Chart Area dialog – Transparency tab
Data range and series
Calc provides several ways to define and present data for charts. The following sections discuss
topics such as defining and changing data ranges, aligning data to a secondary Y axis, and
formatting the appearance of the data series.
Changing data ranges
When data ranges change in the spreadsheet, modify the chart settings to reflect those
changes. Use one of the following methods.
Note
The chart automatically reflects changes in the spreadsheet data. Thus, changing a
number from 5 to 50 in the data will instantly show the new number in the chart.
Replacing data by dragging
It is easy to manually replace one set of data with another set of data. Do this in the following
way:
1) Use the mouse to select all the new data.
2) Drag the data over the chart, then release the mouse. This opens the Change Source
Data Range dialog shown in Figure 155.
3) Specify whether or not the first column or row contains labels, then click OK.
186 | Calc Guide 26.2
Figure 155: Change Source Data Range dialog
Modifying the data range and data series
To change the data range or data series, do the following:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Open the Data Ranges dialog using one of these methods:
– Go to Format > Data Ranges on the Menu bar.
– Click on the Data Ranges icon on the Formatting toolbar.
– Right-click on the chart and select Data Ranges from the context menu.
3) Edit the data range on the Data Range tab, which is similar to the Choose a Data
Range area shown in Figure 141.
4) Edit data series on the Data Series tab, which is similar to the Customize Data Ranges
for Individual Data Series area shown in Figure 142.
5) Click OK to save changes and close the dialog. If desired, click outside the chart to
leave edit mode.
Tip
It may be faster to initially organize the chart using only part of the data. Once the
chart is properly formatted, all of the data can be selected.
For further information, see “Selecting data range” on page 170, and “Selecting data series” on
page 171.
Opening the Data Series dialog
The Data Series dialog offers several options for presenting data in the chart. Note that only one
data series can be selected at a time.
To open the Data Series dialog (Figure 156):
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following to select the data series:
– Click on the data series in the chart.
– Click the data series name in the Select Chart Element drop-down list on the
Formatting toolbar.
3) Do one of the following to open the Data Series dialog:
– Go to Format > Format Selection on the Menu bar.
Chapter 6 Creating Charts and Graphs | 187
– Click on the Format Selection icon on the Formatting toolbar.
– Right-click on the data series and select Format Data Series.
4) Click on the tab of the appropriate page to make the changes needed. The options for
each page are explained below.
5) Click OK to save changes and close the dialog. If desired, click outside the chart to
leave edit mode.
Figure 156: Data Series dialog – Options tab
Note
The tabs that appear on the Data Series dialog depend on the type of chart selected.
Similarly, the controls that appear on each tab may differ depending on the type of
chart.
Alignment, spacing, and plot options
Aligning data to secondary Y axis
A secondary axis may be helpful when data differs in units or scale. As shown in the Figure 157
example, one of the data series (kayaks) has considerably larger numbers than the others. To
plot all three data series on the same chart, and keep the plotted lines close to each other, the
kayak data series is aligned to a secondary Y axis, which has a wider scale. The color of the
secondary Y axis and the axis titles help to show this relationship.
Note
A data series can be associated with a secondary Y axis only after the Chart Wizard
has finished creating the chart.
188 | Calc Guide 26.2
Figure 157: Data series aligned to a secondary Y axis
To align a data series to a secondary Y axis:
1) Select the data series and open the Data Series dialog as described in the previous
section.
2) On the Options tab, under Align Data Series to, select Secondary Y axis.
3) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Aligning data series to a secondary Y axis is not possible for pie and net charts.
Data can only be aligned to a secondary Y axis, not a secondary X axis. However, it is possible
to create secondary X and Y axes that duplicate the primary axes on the opposite sides of a
chart. This is described in “Add or remove axis labels” on page 194. It is also possible to show
different units or scales on the secondary axis (with or without aligning data to it), as described
under “Defining scales” on page 196.
Spacing and plot options
The Options tab of the Data Series dialog (Figure 156) contains additional settings that depend
on the type of chart. These include:
Spacing
Sets the spacing interval of columns or bars between category settings, such as time.
Values above 100% increase the spacing while values below 100% decrease the
spacing. Maximum spacing is 600%.
Overlap
Sets overlap of columns or bars within the same category setting, such as a specific
time. The higher the percentage, the greater the overlap (maximum of 100%). Negative
percentages increase the separation (minimum of -100%).
Show bars side by side
When checked, shows no gap in columns or bars in the interval between categories.
When this option is not checked, data aligned to a secondary Y axis may hide other
data. Enable the option to prevent this.
Connection lines
For stacked and percent column (vertical bar) charts, mark this checkbox to connect the
column layers that belong together with lines.
Chapter 6 Creating Charts and Graphs | 189
Plot missing values
Specifies handling of missing values, with options depending on the type of chart.
Include values from hidden cells
Enables data from hidden cells to be included or not included.
Hide legend entry
Enables the name of the selected data series to be included or removed from the
legend.
For pie or donut charts, in addition to the Include values from hidden cells option, two more
are available (not shown in Figure 156):
Orientation
Specifies the order of the pie sections (data points) – clockwise or counterclockwise.
The default direction is counterclockwise.
Starting Angle
Specifies the starting angle of the first pie section (data point), in the range 0 to 359
degrees. Drag the small dot around the circle or enter a number for the degrees. Use 0
degrees to start the first section at the 3 o’clock position and 90 degrees to start the first
section at 12 o’clock.
Area, transparency, and borders
For chart types other than line and scatter, the Data Series dialog (Figure 158) contains tabs for
formatting the fill and borders of graphical representations such as columns and bars. The Area
tab offers options for selecting color by clicking directly on a color in a palette, adding a custom
palette, specifying the RGB or Hex color codes, or by selecting a custom color using the Pick
button. Other pages contain options for gradient, bitmap, pattern, hatch, transparency, and
borders.
Figure 158: Data Series dialog – Area tab, Gradient page
190 | Calc Guide 26.2
Tip
When working with gradients, it may be helpful to create a custom gradient. To do so,
select the desired options on the Gradient page, click Add, provide a name for the
gradient, and click OK.
Lines, areas, and data point icons
For some chart types (such as line charts and xy (scatter) charts), the Data Series dialog
contains only an Options tab and a Line tab (Figure 159).
Figure 159: Data Series dialog for line and scatter charts – Line tab
Specify style, color, width, and transparency of the line in the Line Properties section on the left
side of the Line tab. In the Icon section, select an option for the symbol from the drop-down list:
No Symbol, Automatic, From file, Gallery, or Symbols.
• From file opens a browser for selecting the file that contains the desired symbol.
• Gallery opens a list of available graphics that can be selected.
• Symbols opens a list showing available symbols that can be selected.
A preview of the selection is shown in the preview box at the bottom of the dialog. Enter the
desired width and height of the symbol. Select Keep ratio if the ratio of width to height of the
symbol should be maintained.
Assigning colors
Colors for the display of data series can be specified in four ways: changing the default color
scheme, applying a color theme from the Sidebar, using the Data Series dialog, or using data
ranges to set colors for border and fill.
Changing default color scheme
To modify the default color scheme for data series, go to Tools > Options > Charts > Default
Colors to specify colors for each data series. Changes made here affect the default colors for
any future chart.
Chapter 6 Creating Charts and Graphs | 191
Applying a color palette
LibreOffice Calc offers a selection of color palettes to apply themed colors to your data series.
First, select the data series you want to customize. Then, open menu Format - Format
Selection - Color Palette tab, or, open the Colors section in the Sidebar’s Properties panel.
Click the Colors dropdown menu to view and choose from the available color palette.
Figure 160: Color panel in Properties deck
Hover your mouse over a color in the Sidebar’s palette to see a live preview of how it will look in
the active chart.
Colors are assigned to data series in order, from left to right and top to bottom. Currently, you
cannot create a new theme or modify the colors in existing themes.
Using Data Series dialog
As discussed in the previous section, the Data Series dialog has options for assigning colors for
lines, areas, and borders. Available options depend on the type of chart.
Using data ranges to assign colors
Use the COLOR function in the Function Wizard (described in Chapter 9, Using Formulas and
Functions) to specify colors with numbers based on combined RGB values. Then assign the
numbers to data ranges for border and fill colors in the Data Series page of the Chart Wizard
(see “Selecting data series”) or in the Data Series tab of the Data Ranges dialog (see “Changing
data ranges” on page 186).
For example, using the COLOR function in the Function Wizard, enter 255 for R (red), 0 for G
(green), and 255 for B (blue). The COLOR function calculates a combined RGB value of
16711935. Then, when defining data ranges, enter the RGB value(s) in the cell range for border
or fill color. Optionally, include a value for the alpha channel (A) in the COLOR function. The
value of A can range from 0 (fully transparent) to 255 (fully opaque).
Note
Data ranges for border color and fill can only be specified for column, bar, pie,
bubble, and column and line charts.
Conditional formatting may also be used to define criteria for when specific colors will be used.
Conditional formatting is described in Chapter 3, Formatting Data.
192 | Calc Guide 26.2
Figure 161 shows an example of using conditional formatting to specify colors. The COLOR
function in the Formula Wizard was used to create the conditional formula
=IF(B2>100,COLOR(240,240,0,20),COLOR(150,0,150,20))
Using this formula, when the value in column B is over 100, the first RGB setting is used to color
that data point in the chart. When the value in column B is 100 or less, the default color (150, 0,
150) is used. This formula is in all cells of column C. The numbers appearing in column C are
the RGB values calculated using the conditional formula (with cell references changed
accordingly).
Figure 161: Using the COLOR function and a conditional formula to specify colors
The chart on the right in Figure 161 shows how the colors change to reflect the conditional
formatting.
Formatting data points
Modify the appearance of an individual data point such as a column or bar using the Data Point
dialog. For most chart types, the dialog contains the same Area, Transparency, and Borders tabs
as the Data Series dialog shown in Figure 158. For line, scatter, net, and stock charts, the dialog
contains the same options as the Line tab of the Data Series dialog shown in Figure 159.
To format data points:
1) Enter edit mode by double-clicking the chart. The chart should now be surrounded by a
gray border.
2) Click two times (but not too quickly) on the data point to be formatted. The data point
will show square selection handles.
3) To open the Data Point dialog, do one of the following:
– Go to Format > Format Selection.
– Right-click on the data point and select Format Data Point in the context menu.
– Click the Format Selection icon on the Formatting toolbar.
4) Apply formatting options as desired.
5) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Tip
As shown in Figure 162, hover the pointer over a data point to show the number of
the data point, the number of the series, and the X and Y values of the data point.
Chapter 6 Creating Charts and Graphs | 193
Figure 162: Tooltip showing information about a data point
Axes
Add or remove axis labels
Use the Axes dialog shown in Figure 163 to add or remove axis labels, such as numbers or
categories. (To change the name of an axis, see “Titles, subtitles, and axis names” on page
182).
Figure 163: Axes insertion dialog
To use the Axes dialog:
1) Enter edit mode by double-clicking the chart. The chart should now be surrounded by a
gray border.
2) Open the Axes dialog by doing one of the following:
– Go to Insert > Axes on the Menu bar.
– Right-click on the chart and select Insert/Delete Axes in the context menu.
3) Select or deselect the checkboxes for axis labels. The Z-axis checkbox is only active
when editing a 3D chart.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Selecting a secondary X axis or a secondary Y axis in this dialog creates duplicate labels on the
opposite side of the chart, as shown in Figure 164. To specify different units or intervals for the
secondary axis, use the Scale tab of the more extensive Axis dialog described in the following
section.
It is also possible to align one or more data series to the secondary Y axis. Do this using the
Data Series dialog, described in “Aligning data to secondary Y axis” on page 188.
194 | Calc Guide 26.2
Figure 164: Both secondary axes enabled
Edit and format axes
In addition to the simple dialog above, a more extensive Axis dialog contains options for grid
intervals, positioning the axis, formatting the axis line and axis labels, and defining the scale,
among other settings. Use a dialog for a specific axis, or use a dialog that applies to all axes.
The options in the dialog depend on which axis was selected, type of chart, and whether the
chart is 2D or 3D.
To open the more extensive Axis dialog:
1) Enter edit mode by double-clicking the chart. The chart should now be surrounded by a
gray border.
2) Open a specific axis dialog (Figure 165) by doing one of the following (some options do
not allow choosing all axes):
– Go to Format > Axis on the Menu bar and select the desired axis (X Axis, Y Axis, Z
Axis, Secondary X Axis, Secondary Y Axis, or All Axes).
– Right-click on the desired axis in the chart to open the context menu. Then select
Format Axis.
– Click the axis on the chart or select the axis in the Select Chart Element drop-down
list on the Formatting toolbar and click the adjacent Format Selection icon or select
Format > Format Selection on the Menu bar.
– Click on the icon for X Axis, Y Axis, or Z Axis on the Formatting toolbar. Or click on
the All Axes option to the right of the other icons.
3) Click the tab of the appropriate page to make the changes needed. The options for
each page are explained below.
4) Click OK to save changes and close the dialog. If desired, click outside the chart to
leave edit mode.
Chapter 6 Creating Charts and Graphs | 195
Figure 165: Y Axis formatting dialog – Scale tab
Defining scales
Use the Scale tab to modify the automatically generated scale for a primary axis. In addition, use
the Scale tabs for secondary axes to specify scales that are different from the scales for primary
axes. This can be quite useful for showing Celsius and Fahrenheit scales on the same chart, for
example, or for when data are aligned to a secondary Y axis (see “Aligning data to secondary Y
axis” on page 188).
Figure 166: Result when direction is reversed on the Y axis
The contents of the Scale tab (Figure 165) vary with chart type but may contain the following
options:
Reverse direction
Defines the order of lower and higher values along the axis. When not selected, the X
axis shows the lower values on the left and the Y axis shows the lower values at the
bottom. When selected, the orientation of the data display is reversed, as shown in the
Y axis in Figure 166.
Logarithmic scale
Specifies that the axis is to be subdivided logarithmically. Logarithmic scaling makes the
grid lines of the axis equidistant from each other, but the values between the lines are
not equal. Use this option when working with values that differ sharply from each other.
Minimum/Maximum
Sets the first/last value for the axis. Automatic must be deselected to set this option
manually.
196 | Calc Guide 26.2
Major interval
Defines the intervals between major divisions of the axis. These intervals will be used
for interval marks (specified on the Positioning tab of the Axis dialog) and grid lines.
Automatic must be deselected to set this option manually.
Minor interval count
Defines the number of intervals (not the values between intervals) that subdivide the
major intervals. The same as for major intervals, the interval count defined here will be
used for interval marks (specified on the Positioning tab of the Axis dialog) and grid
lines. Automatic must be deselected to set this option manually.
For some types of charts, additional options may be available:
Type
Specifies whether the labels are text, date, or should be detected automatically.
Resolution
For dates, specifies that the interval steps should be days, months, or years.
Tip
If the X axis is not displaying time as expected, manually entering the minimum and
maximum times on the Scale tab may solve the problem.
Positioning axis, labels, and interval marks
The Positioning tab (Figure 167) controls the position of axis labels and interval marks.
Figure 167: Axis formatting dialog – Positioning tab
Axis Line
Sets where the axis crosses the other axis, as shown in Figure 168. The options on the
drop-down list are Start, End, or Category. If Category is selected, a further drop-down
menu is displayed enabling selection of the value required.
Chapter 6 Creating Charts and Graphs | 197
Figure 168: Y axis set to cross X axis at specified value
Labels
Sets where axis labels are placed, using the Place labels drop-down list. The Outside
end and Outside start options are useful for positioning labels on axes with negative
numbers, as shown in Figure 169.
Figure 169: Axis label positions
Interval Marks
– Major/Minor – specifies whether interval marks are displayed for major/minor
intervals. These intervals are defined on the Scale tab, described above.
– Inner/Outer – specifies whether interval marks are placed on the inner or outer side
of the axis. The interval marks in Figure 169 are on both sides.
– Place marks – specifies where to place the marks: At labels, At axis, or At axis
and labels. (The top two charts in Figure 169 show the labels along the axes. The
marks are thus both at axis and labels. The marks in the bottom two charts are
located at the labels.)
Line tab
The Line tab has options for formatting the axis line style, color, width, and transparency. It has
the same contents as the Line tab of the Data Series dialog shown in Figure 159 but excluding
the Icon section.
Label tab
On the Label tab (Figure 170), choose whether to show or hide the labels and specify how to
handle them when they do not fit neatly in the chart. The options are described below.
198 | Calc Guide 26.2
Figure 170: Axis formatting dialog – Label tab
Show labels
Sets whether to show or hide the axis labels.
Order
Defines the horizontal or vertical alignment of the labels on the X or Y axis. These
options are available only for 2D charts.
– Tile – arranges labels on the axis side by side.
– Stagger odd – staggers labels on the axis, with even numbers lower than odd
numbers (even numbers to the left on vertical axis).
– Stagger even – staggers labels, with odd numbers lower than even numbers (odd
numbers to the left on vertical axis).
– Automatic – automatically arranges labels on the axis.
Note
Problems may arise in displaying labels if the chart is too small. Avoid this by either
enlarging the chart or decreasing the font size.
Text flow
Determines how text flows in axis labels.
– Overlap – allows axis labels to overlap.
– Break – allows text breaks, enabling text to wrap into new lines in the available
space.
Text Orientation
Defines the direction and orientation of label text.
– Vertically stacked – Stacks characters vertically so that text is read from top to
bottom.
– ABCD wheel – Defines text orientation by clicking and dragging the indicator on the
wheel. Orientation of the characters “ABCD” on the wheel corresponds to the new
setting.
Chapter 6 Creating Charts and Graphs | 199
– Degrees – Shows the orientation angle of the text as determined by the ABCD
wheel or by manually entering the degrees in the spin box.
– Text direction – Specifies the direction for any text that uses complex text layout
(CTL). CTL is only available if Tools > Options > Languages and Locales >
General > Default Languages for Documents > Complex text layout is enabled.
Numbers
Use the Numbers tab (Figure 171) to set the attributes for any numbers used on the axis. When
Source format is selected (as it is by default), numbers are formatted exactly as they are
formatted on the spreadsheet. Deselect this option to change number formatting. For information
about formatting numbers, see Chapter 3, Formatting Data, as well as the online Help.
Figure 171: Axis formatting dialog – Numbers tab
Font and Font effects
Use the Font and Font Effects tabs to set the font and font effects for the axis labels. These tabs
are the same as the tabs for specifying fonts and font effects in cells. See Chapter 3, Formatting
Data, for more information.
Asian Typography
Sets the Asian typographic options for axis labels. This tab is the same as that for specifying
Asian typographic options for cells. See Chapter 3, Formatting Data, for more information.
Hierarchical axis labels
Multiple levels of categories can be displayed in a hierarchical manner along the axis of a chart.
Hierarchical axes labels are created automatically if the first column or row defined as data is
text (as opposed to the first column or row defined as labels). An example of hierarchical labels
is shown in Figure 172. In this case, Calc automatically defines the data range for categories as
the first two columns in the spreadsheet. This is reflected in the chart, which shows the
hierarchical relationship between quarters and months.
200 | Calc Guide 26.2
Figure 172: Example of hierarchical axes labels
Data labels
Data labels display information next to data points on the chart. They can be quite useful for
highlighting specific data when presenting detailed information, but can make the chart look
cluttered if overused.
Adding and formatting data labels for a data series
To add or format data labels for a data series:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following to select a specific data series:
– Click once somewhere in the data series.
– In the Select Chart Element drop-down list of the Formatting toolbar, select the data
series name.
Note
If no data series is selected, then all data series on the chart will be labeled.
3) To open the Data Labels dialog (Figure 174), do one of the following:
– Go to Insert > Data Labels on the Menu bar. If a data series has been selected,
then Calc displays data labels for that data series using default settings, and
displays the Data Labels dialog for the selected data series. In this case, the data
labels will remain displayed even when pressing Cancel on the dialog. If no data
series was selected, Calc displays the Data Labels for all Data Series dialog (Figure
173). The controls on this dialog are similar to those on the Data Labels tab of the
Data Labels dialog, which are described below.
– Right-click on the selected data series in the chart and select Insert Data Labels in
the context menu. Calc displays data labels with default settings. Then right-click
again and select Format Data Labels in the context menu.
Chapter 6 Creating Charts and Graphs | 201
– Select the intended data labels on the chart or in the Select Chart Element drop-
down, and then select Format > Format Selection on the Menu bar or press the
Format Selection icon on the Formatting toolbar.
Figure 173: Data Labels for all Data Series dialog
4) Select the options as desired. The options are explained below.
5) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Tip
Select a data series by clicking once on a column, bar, or other graphic
representation of the data series. Select a single data point by pausing, then clicking
again.
Most of the tabs in the Data Labels dialog are used in other dialogs and can be readily
understood or easily researched. The exception is the Data Labels tab (Figure 174), which
contains the following options:
Value as number
Displays the numeric value of a data point. When selected, this option activates the
Number format button.
Number format
Opens the Format Number dialog, which is the same as the Numbers tab of the Format
Cells dialog discussed in Chapter 3, Formatting Data. Deselect Source format to
activate options on the Format Number dialog.
Value as percentage
Displays the percentage value of the data points in each data series. When selected,
this option activates the Percentage format button. Note that the percentage referred
to is a data point’s Y value as a percent of total Y values for a specific X category or
value. Thus, in Figure 175, the February canoe value 9 is 10% of the total February
value of 94 (the sum of 9, 31, and 54).
Percentage format
Opens the Number Format for Percentage Value dialog, which is the same as the
Numbers tab of the Format Cells dialog discussed in Chapter 3, Formatting Data.
202 | Calc Guide 26.2
Deselect Source format to activate options on the Number Format for Percentage
Value dialog.
Category
Displays the category next to each data point. This option is activated for all data labels
in Figure 175. Thus, all data labels show the month. The text for data labels comes from
the category data series and cannot be changed in the chart. It can only be changed in
the spreadsheet data.
Figure 174: Data Labels tab of the Data Labels dialog
Figure 175: Examples of data label options
Series name
Displays the data series name next to each data point.
Legend key
Displays the legend icon for the data series next to each data point. Figure 175 shows
the legend keys for motors and boats, but not for canoes.
Auto text wrap
Wraps data label text if needed.
Chapter 6 Creating Charts and Graphs | 203
Separator
Selects what will be used to separate multiple text strings when at least two options
above are selected. In Figure 175, the separator is Semicolon for the canoes data
labels, New line for the motors data labels, and Comma for the boats data labels
(except for the June label, which was modified for better fit). Further options are Space
and Period.
Placement
Specifies the placement of data labels relative to the data point representation. In
Figure 175, the placement of data labels is Below for canoes, Above for boats, and
Right for motors. Other available options depend on chart type but may include Left,
Center, Outside, Inside, and Near Origin.
Rotate Text
Sets the text orientation of data labels by using the dial or entering the rotation angle in
degrees.
Text Direction
Specifies the text direction for a paragraph that uses complex text layout (CTL).
Leader Lines
When data labels are enabled, Calc automatically determines where to place each label
on the chart. However, data labels may be dragged to a more convenient position. By
default, a “leader line” is drawn that connects such a displaced data label to its
associated data point. Leader lines for the selected data series may be hidden by
unchecking the Connect displaced data labels to data points checkbox.
Data labels for individual data points
Sometimes it is appropriate to apply data labels to one or a few data points rather than all data
points. This reduces clutter and highlights the most important data.
Adding a single data label
Insert a data label for a single data point in the following way:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Click the data point once, pause, then click again to select it. (Clicking too quickly opens
the Data Series dialog.)
3) Right-click on the selected data point and select Insert Single Data Label in the
context menu. The data label will have the default settings.
4) If desired, click outside the chart to leave edit mode.
Formatting the label for a single data point
To format an existing label for a single data point, follow the directions above but instead of step
3), do the following to open the Label for Data Series dialog (similar to Figure 174): right-click on
the data point and select Format Single Data Label from the context menu.
The options in the Label for Data Series dialog are the same as for the Data Labels dialog
described above.
The Label for Data Series dialog may also be accessed by clicking on the data label, pausing,
and then clicking on it again. Then, in the context menu, right-click and select Format Single
Data Label.
204 | Calc Guide 26.2
Removing data labels
Remove labels from a single data point, a single data series, or all data points using one of the
methods below.
Before doing any of the following, first select the chart by double-clicking on it to enter edit mode.
The chart should now be surrounded by a gray border. When finished, if desired, click outside
the chart to leave edit mode.
Removing all data labels from a single data series
Method One
Right-click somewhere in the data series and select Delete Data Labels in the context
menu.
Method Two
1) Do one of the following to open the Data Labels dialog (Figure 174):
– Click somewhere in the data series to select it. Go to Insert > Data Labels on the
Menu bar.
– In the Select Chart Element drop-down list of the Formatting toolbar, select the data
labels entry for the required series name or select one of the labels for the data
series. Then click the adjacent Format Selection icon or select Format > Format
Selection on the Menu bar.
– Right-click in the data series or on the labels of the data series and select Format
Data Labels in the context menu.
2) On the Data Labels tab, deselect all of the options and click OK.
Removing a data label from a single data point
1) Click once on the data point, pause, then click again to select it.
2) Right-click to open the context menu and select Delete Single Data Label.
Removing all data labels
1) Make sure that no data label or data series is selected.
2) Go to Insert > Data Labels on the Menu bar.
3) On the Data Labels for all Data Series dialog, deselect all of the options for the data
labels to be removed, then click OK.
Chart Data Tables
When designing a chart, it may be useful to display the source data with the chart. This can be
achieved easily by adding a chart data table. Chart data tables display the underlying data
represented by a chart, in a tabular form positioned automatically below the chart. For certain
chart types, the data table replaces the x-axis labels.
Chart data tables can be formatted freely, and a simple example is shown in Figure 176.
Chapter 6 Creating Charts and Graphs | 205
Figure 176: Chart data table displayed below chart
Data tables can be shown for most chart types, apart from Net and Pie charts.
Note
The nature and volume of data shown on a chart, and the type of chart, may not be
suitable for displaying a usable chart data table. In such cases, the chart data table
can simply be removed.
Inserting a chart data table
To display a chart data table:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Go to Insert > Data Table on the Menu bar to open the Data Table dialog (Figure 177).
3) Select the Show data table option.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Tip
The content of the chart data table inherits the formatting of the chart’s source data.
Removing a chart data table
To remove a chart data table:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Go to Insert > Data Table on the Menu bar to open the Data Table dialog (Figure 177).
3) Deselect the Show data table option.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Alternatively, with the chart in edit mode, right-click on the chart data table and select Delete
Data Table in the context menu.
206 | Calc Guide 26.2
Modifying the properties of a chart data table
The Data Table dialog shown in Figure 177 is accessed using Insert > Data Table on the Menu
bar. In addition to providing a display on/off control for the chart data table (Show data table), it
also provides options to control the basic formatting properties of the chart data table:
• Show horizontal border: show or hide internal row borders.
• Show vertical border: show or hide internal column borders.
• Show outline: show or hide borders around the table.
• Show keys: show or hide the color keys associated with each data series. These are
similar to the color keys used in the chart legend.
Figure 177: Data Table dialog
Each of the following interactions leads to the display of the larger Data Table dialog shown in
Figure 178. In all cases, first select the chart by double-clicking on it to enter edit mode.
• Double-click the chart data table.
• Right-click on the chart data table and select Format Selection in the context menu.
• Select the chart data table and go to Format > Format Selection on the Menu bar.
• Select the Data Table option in the Select Chart Element drop-down list on the
Formatting toolbar and then click the adjacent Format Selection icon.
This version of the dialog has five tabs – Data Table, Line, Area, Font, and Font Effects. Through
these tabs it is possible to change the line, fill and font properties of the data table. For example,
the line properties define how the borders (lines) will be shown – it is possible to change the line
style (for example, continuous line, dashes, or dots), the color of the line, transparency, and line
thickness. The fill properties define the color of the cell background. The font properties define
the font and size to be used for the text in the data tables.
• The Data Table tab provides the same four options that appear in the Data Table
Properties area of the Data Table dialog shown in Figure 177.
• The Line tab provides similar options to those on the Line tab of the Data Series dialog
shown in Figure 159 but excluding the Icon section.
• The Area tab provides similar options to those on the Area tab of the Data Series dialog
described in the “Area, transparency, and borders” section.
• The Font and Font Effects tabs provide similar options to those on the corresponding
tabs of the Cell Style dialog, described in the “Cell style attributes” section of Chapter 4,
Using Styles and Templates.
Chapter 6 Creating Charts and Graphs | 207
Figure 178: Data Table dialog with multiple tabs
Grids
Grid lines or grids divide the intervals along axes to help estimate data point values. Major and
minor grid lines are shown in Figure 179. The darker lines with numbers are major grid lines
while the lighter lines between them are minor grid lines. Note that the Y-axis major grid line is
activated by default.
Figure 179: Major and minor grid lines for the X and Y axes
Grids are available for all chart types with the exception of pie charts.
Adding/removing grid lines
1) First select the chart by double-clicking on it to enter edit mode. The chart should now
be surrounded by a gray border.
2) Do one of the following:
– Go to Insert > Grids on the Menu bar to open the Grids dialog (Figure 180).
Select/deselect the checkboxes as needed. The Z axis checkbox is only active for a
3D chart. Click OK to close the dialog.
Figure 180: Basic Grids dialog
– Click the Horizontal Grids icon or the Vertical Grids icon, both located on the
Formatting toolbar. Clicking once turns on the major grid lines. Clicking twice turns
on the minor grid lines as well. Clicking again turns off the grids.
3) If desired, click outside the chart to leave edit mode.
208 | Calc Guide 26.2
Note
In the Formatting toolbar, the Horizontal Grids icon and the Vertical Grids icon set
grid lines for the Y axis and X axis, respectively. This can be misleading because
both the Y axis and the X axis can be horizontal or vertical, depending on the type of
chart. Thus, for a bar chart, click the Horizontal Grids icon to control the vertical
grids.
Formatting grids
In addition to the Grids dialog shown in Figure 180, there is another dialog for formatting grids.
To open the grid formatting dialog:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Go to Format > Grid on the Menu bar and select the appropriate type of grid to open
the Grid formatting dialog (Figure 181).
Figure 181: Grid formatting dialog
3) Set formatting options for line style, color, width, and transparency.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Note
Use the Scale tab of the Axis dialog to specify the intervals between grid lines. This
is described in “Defining scales” on page 196.
3D charts
Setting 3D look
Column, bar, pie, and area charts can be displayed as 3D charts. The setting to make a chart 3D
is on the first page of the Chart Wizard. If the chart has already been created, do the following to
give it a 3D look:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following:
Chapter 6 Creating Charts and Graphs | 209
– Go to Format > Chart Type.
– Click on the Chart Type icon on the Formatting toolbar.
– Right-click in the chart and select the Chart Type option in the context menu.
3) Select 3D Look in the Chart Type dialog.
4) Select the basic rendering scheme as Simple or Realistic from the adjacent drop-
down.
5) For column and bar charts, select the shape as Bar, Cylinder, Cone, or Pyramid.
6) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Formatting 3D view
To make changes to a 3D chart, use the 3D View dialog (Figure 182).
Figure 182: 3D View dialog – Perspective tab
Use the 3D View dialog to change the 3D settings, including perspective, appearance, and
illumination. Note that the chart must already be set to show a 3D look, as described above. To
open the 3D View dialog:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following:
– Right-click on the chart and select 3D View in the context menu.
– Go to Format > 3D View.
– Click on the 3D View icon on the Formatting toolbar.
3) Make any changes required.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
This dialog has three tabs, which are explained below.
Rotation and perspective
Some hints for using the Perspective tab (Figure 182) to rotate a 3D chart or change its
perspective view:
• Set all angles to 0 degrees for a front view of the chart. Pie charts and donut charts are
shown as circles.
210 | Calc Guide 26.2
• With Right-angled axes enabled, the chart can be rotated only in the X and Y direction;
that is, parallel to the chart borders.
• An X value of 90 degrees, with Y and Z set to 0 degrees, provides a view from the top
of the chart. With X set to –90 degrees, the view is from the bottom of the chart.
• Rotation is applied in the following order: X axis first, then Y axis, and Z axis last.
• When shading is enabled (see below) and the chart is rotated, the lights are rotated as
if they are fixed to the chart.
• The rotation axes always relate to the page, not to the axes of the chart. This is different
from some other chart programs.
• Select the Perspective option to view the chart in central perspective as through a
camera lens (as opposed to using a parallel projection). Set the focal length with the
spin box or type a number in the box. With a 100% setting, a far edge in the chart looks
approximately half as big as a near edge.
Rotating 3D charts interactively
In addition to using the Perspective tab of the 3D View dialog, rotate 3D charts interactively in
the following way:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Click once on the chart wall to select it, causing round selection handles to appear. The
pointer changes to a rotation icon.
3) Press and hold the left mouse button while dragging in the desired direction. A dashed
outline of the chart is visible to help see how the result will look.
4) Release the mouse button when satisfied.
5) Click outside the chart to exit edit mode.
Appearance
Use the Appearance tab of the 3D View dialog (Figure 183) to modify some aspects of the
appearance of the data in a 3D chart.
First select a rendering scheme from the Scheme drop-down list – Realistic (default) or Simple.
The scheme selected sets the options and light sources. Depending on the scheme selected,
not all options may be available. To create a custom scheme, select or deselect a combination of
Shading, Object borders, and Rounded edges.
Some hints:
• Select Shading to use the Gouraud method for rendering the surface. Otherwise, a flat
method is used. The flat method sets a single color and brightness for each polygon.
The edges are visible but soft gradients and spotlights are not possible. The Gouraud
method applies gradients for a smoother, more realistic look. See the Draw Guide for
more information on the use of shading.
• Select Object borders to draw lines along the edges.
• Select Rounded edges to smooth the edges of box shapes.
Chapter 6 Creating Charts and Graphs | 211
Figure 183: 3D View dialog – Appearance tab
Illumination
Use the Illumination tab (Figure 184) of the 3D View dialog to control light sources for the 3D
view.
Here are the options with some hints:
• Click any of the eight buttons to switch a directed light source on or off.
• The first light source projects a specular light with highlights.
• By default, the second light source is switched on. It is the first of seven normal, uniform
light sources. To activate the others sources, click twice on their respective button.
• For the selected light source, select a color from the first drop-down list below the eight
light source buttons. Alternatively press the adjacent button to select a color using the
Pick a Color dialog. Note that the brightness values of all lights are added together, so
use dark colors when enabling multiple lights.
• The small preview in the dialog shows the effect of repositioning the light source.
• Each selected light source appears as a small colored sphere in the specified color. The
sphere is larger when the light source is actively selected.
• Each light source always points at the middle of the object initially. Move the vertical
slider to adjust the lighting angle. The horizontal slider rotates the light around the
object. In addition, click the light source and drag it to the desired location.
• Click the button in the bottom right corner of the preview to switch the internal
illumination model between a sphere and a cuboid.
• Use the Ambient light drop-down list to define the ambient light, which shines with a
uniform intensity from all directions. Alternatively press the adjacent button to select a
color using the Pick a Color dialog.
212 | Calc Guide 26.2
Figure 184: 3D View dialog – Illumination tab
See the Draw Guide for more information on setting the illumination.
Trend and mean value lines
Trend lines help show the relationships among scattered data points of a data series. Calc has a
good selection of regression types for creating trend lines: linear, logarithmic, exponential,
power, polynomial, and moving average. Choose the type that comes closest to passing through
all of the points in a data series.
Trend lines can be added to all 2D chart types except for pie, net, bubble, and stock charts.
When inserted in the chart, representations of the trend lines are automatically shown in the
chart legend.
Note
For chart types that use categories for the X axis, such as column, bar, or line charts,
the numbers 1, 2, 3… are used as values for calculating trend lines. By contrast, XY
(scatter) chart types show data rather than categories along the X axis. Thus, only
XY (scatter) chart types can show meaningful regression equations.
Adding and modifying trend lines
Trend lines can only be added to one data series at a time. To add a trend line to a data series:
1) Double-click on the chart to enter edit mode. The chart should now be surrounded by a
gray border.
2) Select the data series by doing one of the following:
– Click once on a data series representation such as a bar, column, line, or point.
– Select the data series from the Select Chart Element drop-down list on the
Formatting toolbar.
3) Do one of the following to open the Trend Lines dialog (Figure 185):
– Go to Insert > Trend Line on the Menu bar.
Chapter 6 Creating Charts and Graphs | 213
– Right-click on the data series and select Insert Trend Line in the context menu.
4) Select the type of regression and choose the desired options. These are explained
below.
5) Click OK to close the dialog and place the trend line in the chart. If desired, click outside
the chart to leave edit mode.
Figure 185: Trend Line dialog – Type tab
Regression types
By default, x is used for the abscissa variable and f(x) for the ordinate variable. Change the
names under X Variable Name and Y Variable Name on the Trend Line dialog.
Linear
Regression through equation y = a ∙ x+b. Intercept b can be forced.
Logarithmic
Regression through equation y = a ∙ ln(x) + b. Only positive x values are used.
Exponential
Regression through equation y = b ∙ exp(a ∙ x).This equation is equivalent to y = b ∙ mx,
with m = exp(a). Intercept b can be forced. Only positive y values are considered,
except if all y values are negative. In that case, the equation used is y = -b∙exp(a ∙ x).
Power
Regression through equation y = b ∙ xa. Only positive x values are considered. Only
positive y values are considered, except if all y values are negative. In that case, the
equation used is y = -b ∙ xa.
Polynomial
Regression through equation y = Σi (ai ∙ xi). Intercept a0 can be forced. Degree of
polynomial must be given (at least 2).
Moving Average
Simple moving average for n previous y-values, with n being the period. No equation is
available for this trend line. The type of moving average regression curve is selected as
Prior, Central, or Averaged Abscissa.
214 | Calc Guide 26.2
Tip
It is possible to add multiple trend lines to a single data series. This could be useful
when comparing different regression types for the data.
Search for the term “Trend Lines” in the index of the Help system for more information about
these regression types.
Trend line options
Figure 186: Trend lines showing various equations
Trendline Name
Specifies the name to be used for labeling the equation in the legend; see Figure 186.
Extrapolate Forward/Backward
Specifies the number of units the trend line should be extended forward or back. This
only works for charts that have numeric values along the X axis rather than categories.
Force Intercept
Forces the line to cross the Y axis at the specified value.
Show Equation
Displays the equation in the chart, as shown in Figure 186.
Show Coefficient of Determination (R2)
Displays the coefficient of determination in the chart. Shown with the polynomial
equation in Figure 186.
X and Y Variable Names
Enables changing the names of X or Y variables for displaying the equation in the chart.
The Show Equation option must be checked for these options to be active.
Select a trend line to display information about it in the Status bar, as shown in Figure 187. The
Status bar is normally located at the bottom of the spreadsheet.
Figure 187: Equation information displayed in the Status bar
Chapter 6 Creating Charts and Graphs | 215
Formatting trend lines
When originally inserted, a trend line has the same color as the corresponding data series. To
change the style, color, width, or transparency of a trend line, use the Line tab of the Trend Line
dialog (Figure 188). The options are easily understood or researched.
Figure 188: Trend Line dialog – Line tab
Formatting trend line equations
Display the equation in the chart by selecting Show Equation on the Type tab of the Trend Line
dialog (Figure 185). Options for the trend line equation include formatting the border around the
equation, area fill, transparency, font, and alignment. The number style can also be specified—
this may be quite useful, especially for specifying the number of decimal places.
To format trend line equations:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following to open the Equation dialog:
– Select the equation on the Select Chart Element drop-down list and then click the
Format Selection icon on the Formatting toolbar or select Format > Format
Selection on the Menu bar.
– Click once on the equation to select it then click the Format Selection icon on the
Formatting toolbar or select Format > Format Selection on the Menu bar.
– Right-click on the equation and select Format Trend Line Equation in the context
menu.
3) Select the desired options on the dialog. The options are self-explanatory or easily
researched. The Numbers tab has the same options as the Numbers tab of the Axis
dialog, Figure 171.
4) Click OK to close the dialog.
5) If desired, click outside the chart to leave edit mode.
Deleting trend lines
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following:
216 | Calc Guide 26.2
– Select the trend line and press the Delete key.
– Right-click on the trend line and select Delete Trend Line in the context menu.
3) If desired, click outside the chart to leave edit mode.
Mean value lines
Mean value lines are a special type of trend line. To create one, Calc calculates the average of a
data series and places a colored line at that value in the chart, as shown in Figure 189. They can
only be created for 2D charts and cannot be created for pie, bubble, net, or stock charts.
Figure 189: Mean value lines
Inserting mean value lines
For all data series (if no data series is selected, mean value lines are inserted for all data series):
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Go to Insert > Mean Value Lines on the Menu bar.
3) If desired, click outside the chart to leave edit mode.
For a single data series:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Select a data series by doing one of the following:
– Click once somewhere in the data series.
– Select the data series from the Select Chart Element drop-down list on the
Formatting toolbar.
3) Add the mean value line by doing one of the following:
– Go to Insert > Mean Value Lines on the Menu bar.
– Right-click on the data series and select Insert Mean Value Line in the context
menu.
4) If desired, click outside the chart to leave edit mode.
Chapter 6 Creating Charts and Graphs | 217
Modifying mean value lines
When inserted, a mean value line has the same color as the corresponding data series. To
modify the style, color, width, and transparency of a mean value line:
1) Double-click on the chart to enter edit mode. The chart should now be surrounded by a
gray border.
2) Do one of the following to open the Mean Value Line dialog (the dialog has the same
options as the Line tab of the Trend Line dialog in Figure 188):
– Right-click on the mean value line and select Format Mean Value Line in the
context menu.
– Left-click on the mean value line or select the appropriate mean value line from the
Select Chart Element drop-down list on the Formatting toolbar, then click the
Format Selection icon in the Formatting toolbar, or select Format > Format
Selection.
3) Make the desired changes.
4) Click OK to close the dialog. If desired, click outside the chart to leave edit mode.
Deleting mean value lines
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following:
– Left-click on the mean value line or select the appropriate mean value line from the
Select Chart Element drop-down list on the Formatting toolbar and then press the
Delete key.
– Right-click on the data series and select Delete Mean Value Line in the context
menu.
3) If desired, click outside the chart to leave edit mode.
Error bars
Error bars, shown in Figure 190, can be useful for presenting data that has a known possibility of
error, such as social surveys using a particular sampling method, or for showing the measuring
accuracy of the tool used. In Figure 190 variance is shown for canoes, standard deviation for
boats, and standard error for motors. Error bars can be created for 2D charts only and cannot be
created for pie, bubble, net, or stock charts.
218 | Calc Guide 26.2
Figure 190: Chart with error bars
Inserting error bars
If no data series is selected, X or Y error bars are inserted for all data series. To add error bars
for all data series:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Go to Insert > X Error Bars or Insert > Y Error Bars on the Menu bar to open the
Error Bars dialog (Figure 191). The Line tab is not present when inserting error bars for
all data series; in this circumstance, an extra None option appears in the Error
Category area.
3) Select the desired options. See below for more information about the options.
4) Click OK to close the dialog and add the error bars to the chart. If desired, click outside
the chart to leave edit mode.
Figure 191: Error Bars dialog – Error Bars tab
To insert error bars for a single data series:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following to select the data series:
Chapter 6 Creating Charts and Graphs | 219
– Click once on a bar, column, line, or other graphical representation in the data
series.
– Select the data series from the Select Chart Element drop-down list on the
Formatting Toolbar.
3) Do one of the following to open the Error Bars dialog (Figure 191):
– Go to Insert > X Error Bars or Insert > Y Error Bars on the Menu bar.
– Right-click on the data series and select Insert X Error Bars or Insert Y Error Bars
in the context menu.
4) Select the desired options. See below for more information about these options.
5) Click OK to close the dialog and add the error bars to the chart. If desired, click outside
the chart to leave edit mode.
Error Bars dialog options
Under Error Category, only one of the following options can be selected at a time.
None – does not show any error bars. This option is only available when no data series
is selected.
Constant Value – shows the error as constant positive and/or negative value(s).
Specify these values in the Parameters section.
Percentage – shows the error as a percentage of the data points. Specify this
percentage in the Parameters section.
The drop-down list has four measures of the error value:
– Standard Error
– Standard Deviation
– Variance
– Error Margin – uses the value for the error margin that is specified in the
Parameters section.
Cell Range – uses error values defined in a range of cells. Specify the range in the
Parameters section.
Under Parameters, specify positive and negative values or ranges for the error bars. Constant
Value, Percentage, Error Margin, or Cell Range must be checked for these options to be
active.
Under Error Indicator, select whether the error graphic shows both positive and negative errors,
only positive errors, or only negative errors.
The Line tab may be used to adjust the line style, color, width, and transparency for the error
bars.
Modifying error bars
Error bars can only be changed one data series at a time, using the Error Bars dialog (Figure
191). Do one of the following to open the Error Bars dialog:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) Do one of the following to open the Error Bars dialog:
220 | Calc Guide 26.2
– Click once on the data series to select it, then go to Insert > X Error Bars or Insert
> Y Error Bars on the Menu bar.
– Select the error bars for the specific data series from the Select Chart Element drop-
down list on the Formatting toolbar. Then go to Format > Format Selection or click
the Format Selection icon on the Formatting toolbar.
– Right-click on the data series and select Format X Error Bars or Format Y Error
Bars in the context menu.
3) Select the desired options on the Error Bars and Line tabs of the Error Bars dialog.
4) Click OK to close the dialog and update the error bars for the selected series. If desired,
click outside the chart to leave edit mode.
Deleting error bars
To delete X or Y error bars for all data series:
1) Select the chart by double-clicking on it to enter edit mode. The chart should now be
surrounded by a gray border.
2) With no data series selected, go to Insert > X Error Bars or Insert > Y Error Bars on
the Menu bar to open the Error Bars dialog (Figure 191).
3) Select None.
4) Click OK to close the dialog and delete the error bars.
5) If desired, click outside the chart to leave edit mode.
To delete error bars for a single data series, follow the same steps as above but instead of steps
2) to 4), right-click on the data series and select Delete X Error Bars or Delete Y Error Bars in
the context menu.
Adding drawing objects to charts
Use the Drawing toolbar to add shapes such as lines, rectangles, circles, text objects, or more
complex shapes such as symbols or block arrows. Use additional shapes to add explanatory
notes, highlight points of interest on a chart, or even hide certain data or text.
Open the Drawing toolbar by going to View > Toolbars > Drawing. Note that it can be moved
around the workspace as needed. For more information on using the Drawing toolbar and
drawing shapes, see Chapter 5, Using Images and Graphics, as well as the Draw Guide.
The Drawing toolbar (Figure 192) appears when the chart is in edit mode (by clicking on it twice).
Tip
To place arrows, text, or other drawing objects in a chart, be sure that the chart is in
edit mode. Otherwise, an object will not be connected to the chart and will not be
moved with it.
Figure 192: Drawing toolbar when chart is placed in edit mode
Chapter 6 Creating Charts and Graphs | 221
(25) Select (30) Freeform Line (35) Block Arrows
(26) Insert Line (31) Insert Text Box (36) Flowchart
(27) Line Ends with Arrow (32) Callouts (37) Callouts
(28) Insert Rectangle (33) Basic Shapes (38) Stars and Banners
(29) Insert Ellipse (34) Symbol Shapes
Most of these options are self-evident or can be readily researched, especially by referring to the
Draw Guide. Clicking on the icon for an option changes the pointer’s appearance, depending on
the option. Click and drag the pointer to create the desired drawing object in the chart.
Information that may be helpful for charts follows.
Insert Line
Draws a straight line where dragged.
Note
When drawing a line in the spreadsheet (outside any chart), holding Shift while
dragging will constrain angles of the line to multiples of 45 degrees. This facility is not
applicable when inserting a line on a chart.
Write on the line by double-clicking the line and typing or pasting text. If the text is too
low, press Enter to raise it above the line.
Insert Text Box
Draws a text box with horizontal text direction. To place the text at an angle, click once
on the text box to select it, right-click, and select Position and Size from the context
menu. Specify the angle on the Rotation tab.
Callouts
Draws a line that ends in a graphic in which text can be placed. Use a callout to
describe or draw attention to a specific point or area. Double-click the callout to write
text in it. In Figure 192, Callouts option 8 creates a default callout while option 13
opens a tool palette of callout styles.
Clicking the down arrows next to the last six options on the right of the Drawing toolbar (Figure
192) opens tool palettes similar to those shown in Figures 193 to 198.
Figure 193: Basic Shapes Figure 194: Symbol Shapes Figure 195: Block Arrows
222 | Calc Guide 26.2
Figure 196: Flowcharts Figure 197: Callouts Figure 198: Stars and Banners
Resizing, moving, and positioning charts.
To resize or move a chart, click it once to put it in selection mode. Resize or move a chart in two
ways: interactively, or by using the Position and Size dialog. Combining both methods may be
useful. Position a chart interactively for quick and easy changes, then use the Position and Size
dialog for precise sizing and positioning.
Changing interactively
Resizing
To resize a chart interactively:
1) Click once on the chart to select it. Square selection handles appear around the border
of the chart.
2) Click and drag one of the selection handles. The pointer indicates the direction to
increase or decrease the chart size. Clicking and dragging a corner handle preserves
the horizontal to vertical size ratio.
3) When finished, click outside the chart to leave selection mode.
Moving
Move a chart interactively using one of two methods:
For small moves
1) Click once on the chart to select it. Square selection handles appear around the border
of the chart.
2) Press an arrow key to move the chart a few pixels at a time, or press Alt + an arrow
key to move the chart one pixel at a time.
3) When finished, click outside the chart to leave selection mode.
For larger moves
1) Click once on the chart to select it. Square selection handles appear around the border
of the chart.
2) Hover the pointer anywhere over the chart until it changes to a move pointer (shape
depends on computer setup).
3) Click and drag the chart to its new location.
4) Release the mouse button when the chart is in the required position.
5) When finished, click outside the chart to leave selection mode.
Chapter 6 Creating Charts and Graphs | 223
Position and Size dialog
The Position and Size dialog contains options for defining the position of the chart on the page,
specifying its size, rotating it, and slanting it.
Note
In addition to charts, the Position and Size dialog can also be used to modify and
position other graphic elements, such as those available on the Drawing toolbar.
To resize or move a chart using the Position and Size dialog:
1) Right-click on the chart and select Position and Size in the context menu to open the
Position and Size dialog (Figure 199).
Figure 199: Position and Size dialog — Position and Size tab
2) Select the desired options on the Position and Size, Rotation, and Slant & Corner
Radius tabs on this dialog. See below for further information about the options on these
tabs.
3) Click OK to close the dialog and save changes.
4) When finished, click outside the chart to leave selection mode.
When positioning or resizing, click one of the points in the Base point graphic corresponding to
the location to use for anchoring either the position of the chart or its size.
Note that either the position or the size can be protected from unwanted changes by clicking the
appropriate box in the Protect section. Either or both option(s) selected will remain active after
the dialog is closed. By contrast, Calc resets the base point to the default position after the
dialog is closed.
224 | Calc Guide 26.2
Position and Size
The options available on the Position and Size tab (Figure 199) are as follows:
Position
Determines the location of the chart on the page. The position of a chart is coordinated
relative to a fixed point (the base point). By default, this base point is located at the
upper left of a chart. To make positioning of a chart simpler, the base point can be
temporarily changed.
– Position X – specifies the horizontal location of the chart relative to the base point.
– Position Y – specifies the vertical location of the chart relative to the base point.
– Base point – specifies a temporary base point for the chart.
Size
Specifies the amount by which to resize the selected chart with respect to the selected
base point.
– Width – sets a width for the selected object.
– Height – sets a height for the selected object.
– Keep ratio – maintains proportions between width and height when resizing the
chart.
– Base point – determines the directions in which the chart size will be increased or
decreased.
Protect
Prevents unintended changes to the position or the size of the chart.
– Position – prevents unintentionally moving the chart.
– Size – prevents unintentionally resizing the chart.
Adapt
These options are always unavailable for charts.
Rotation
The options for the Rotation tab (Figure 200) are as follows:
Pivot Point
The chart can be rotated around a pivot point. The default pivot point is at the top left of
the chart. Note that if there is not enough room to rotate the chart, it could be rotated off
of the page.
– Position X – specifies the horizontal distance from the left edge of the page to the
pivot point.
– Position Y – specifies the vertical distance from the top edge of the page to the pivot
point.
– Default settings – sets the location of the pivot point in a visual approach. The pivot
point can be temporarily changed. However, when the dialog is opened again, the
pivot point will return to its default location and the X and Y positions will reflect the
default location.
Chapter 6 Creating Charts and Graphs | 225
Figure 200: Position and size dialog – Rotation tab
Rotation Angle
Specifies the number of degrees that the chart is rotated.
– Angle – shows the number of degrees of rotation (in the range 0 to 359 degrees).
The number can be entered directly, or it can be set using the indicator labeled
Default settings.
– Default settings – graphically shows the rotation angle. The angle can be set by
clicking and dragging the indicator. The number of degrees rotated is shown in the
Angle box.
Slant & Corner Radius
The options for the Slant & Corner Radius tab (Figure 201) are as follows:
Figure 201: Position and Size dialog – Slant and Corner Radius tab
Corner Radius
This option is not available for charts.
Slant
Slants the chart along an axis. Specify the angle of the axis (in the range -89° to +89°).
226 | Calc Guide 26.2
Control Points
These options are not available for charts.
Selecting multiple charts
Select multiple charts by clicking once on the first chart then pressing Shift while clicking on
additional charts. An invisible selection rectangle covers all of the selected charts and selection
handles appear at the corners and midway between corners. The multiple charts are now treated
as a single object and actions such as the following can be conducted.
• Cut and paste or drag them to new locations.
• Use the Position and Size dialog described in the previous section.
• Use the Drawing Object Properties toolbar to align all the charts, format the outer
borders, or anchor the charts to the same cell or page.
Changing overall appearance of charts
When a chart is selected (by clicking on it once) it can be formatted as an object. The Drawing
Object Properties toolbar (Figure 202) usually appears below the Standard toolbar (but the
location depends on setup) and shows tools available for all objects, including charts.
Most of the options are self-evident or can be easily researched. Please refer to Chapter 5,
Using Images and Graphics, and the Draw Guide for further information. Following are a few tips
for using these tools with charts.
Anchor
Connects a chart to either remain in the same position on a page or to move with a cell
(when rows and columns are inserted or deleted). When To cell (resize with cell) is
chosen, the chart or object increases or decreases in size when the cell is made larger
or smaller.
Align Objects
Click the icon to open options for aligning multiple charts horizontally (left, centered,
right) or vertically (top, center, bottom). This option is only active when two or more
charts (or other objects) are selected.
Figure 202: Drawing Object Properties toolbar that appears when chart is selected
(39) Anchor (45) To Foreground (51) Fill Color
(40) Align Objects (46) To Background (52) Arrow Style
(41) Bring to Front (47) Line Style (53) Rotate
(42) Forward One (48) Line Width (54) Points
(43) Back One (49) Line Color (55) Group
(44) Send to Back (50) Area Style/Filling
Bring to Front/Forward One/Back One/Send to Back
Stacks charts or other objects in front of or behind other objects.
To Foreground/To Background
Places charts or stacks of objects in either the foreground or the background. In Calc,
objects in the background are behind the cell grid and may be difficult to select. Use the
Select tool (arrow icon) on the Drawing toolbar (Figure 192) to select them.
Chapter 6 Creating Charts and Graphs | 227
Line Style/Line Width/Line Color
Formats the outer borders of charts.
Area Style/Filling and Fill Color
Colors objects such as arrows, shapes, and callouts. For charts, use the fill options
available in edit mode.
Arrow Style
Specifies the appearance of line arrows and lines. Does not apply to the block arrows
shown in Figures 192 and 193.
Rotate
Rotates the chart around a base point. When selected, places round rotation handles at
each corner. Move these to rotate the chart. Move the small circle in the center of the
chart to change the base point. Move the handles midway between the corners to slant
the chart or other object.
Points
Changes the shape of curved objects. Move the points to shape curves created with the
Curve tool on the Drawing toolbar.
Group
Groups or ungroups two or more objects. When grouped, the objects can be moved
together and global changes can be applied to them. From left to right, the four icons
are Group, Enter Group, Exit Group, and Ungroup.
Copying, exporting, and deleting charts
Copying charts in the same spreadsheet document
When a chart is copied, it retains a connection to the source data it is built on as long as it is in
the same document. This means that changes made to the source data will be reflected in the
chart.
Copying and pasting the chart is easy. Just click the chart once to select it, then either press
Ctrl+C, or right-click on the chart and select Copy in the context menu, or click the Copy icon
on the Standard toolbar, or select Edit > Copy on the Menu bar. To paste the chart in the
desired location, press Ctrl+V, or right-click and select Paste in the context menu, or click the
Paste icon in the Standard toolbar, or select Edit > Paste on the Menu bar.
Copying to another LibreOffice document
When a chart is copied and pasted into another LibreOffice document, any connection to the
data it is based on is lost. The data is kept with the chart and is now called a data table rather
than a data range. Figure 203 shows an example of this internal data table.
Note
A copied chart links to or retains its data only when pasted into a LibreOffice
document. To retain data or links outside LibreOffice, use embedding or linking, as
explained in Chapter 12, Linking Data.
Keeping original data
If the goal is to use the original data for the chart, follow the same procedure as above to copy
and paste the chart to another document. Nothing more needs to be done.
228 | Calc Guide 26.2
Modifying original data
If the original data for the chart needs to be modified, do the following:
1) Select the copied chart by double-clicking on it to enter edit mode. The chart should
now be surrounded by a gray border.
2) Right-click on the chart and select Data Table to open the Data Table dialog shown in
Figure 203.
3) Modify the data as desired. In addition to changing numbers in the data, use options to
insert, move, or delete columns and rows.
4) Click Close to close the dialog.
5) If desired, click outside the chart to leave edit mode.
Figure 203: Data Table dialog when a chart is copied into another document
Dragging replacement data
If the chart is still in Calc and replacement data is in the same spreadsheet, select and drag the
new data onto the chart. This is described in “Replacing data by dragging” on page 186.
Note
Calc does not provide a direct way to save chart settings for creating another chart in
LibreOffice. Here are three options for using the same chart settings: 1) copy and
paste the chart into another file; 2) save the file containing the chart as a new file;
and 3) save the chart in a template. Depending on the method used, create a new
chart by modifying either the data range or the data table.
Exporting chart images
Charts can be exported in a variety of image formats for use in other documents. File types
include BMP, EMF, EPS, GIF, JPEG, PDF, PNG, SVG, SVM, TIFF, and WMF.
To export a chart in an image format:
1) Right-click on the selected chart and select Export as Image in the context menu to
open the Save as Image dialog.
2) In the dialog, type a name for the graphic file, select the location for saving the file, and
select the desired graphic format.
3) Click Save and an image of the chart will be exported to the location specified.
Chapter 6 Creating Charts and Graphs | 229
Deleting charts
To delete a chart, click it once to select it. Square selection handles appear on the borders of the
chart. Then press Delete.
230 | Calc Guide 26.2
Calc Guide 26.2
Chapter 7
Gallery of Chart Types
Introduction
While data can be presented using a variety of charts, focus on the message of the chart to
determine which type of chart to use. The following sections present examples of the chart types
that Calc provides, with some notes on the uses of each one.
Column charts
A column chart shows vertical bars, with the height of each bar proportional to its value.
The X axis shows categories and the Y axis shows the value for each category.
Column charts are commonly used for data that show trends over time. They are best for a
relatively small number of data points. It is the default chart type provided by Calc, as it is one of
the most useful and easy to understand. For a larger time series, a line chart would be more
appropriate.
The column chart type has three variants, with a preview pane for each variant as shown in
Figure 204.
Figure 204: Chart Type dialog – Column
When a preview is clicked, its borders are highlighted and the name appears below. The 2D
variants are:
Normal
Shows all data values belonging to a category next to each other. The main focus is on
the individual absolute values, compared to every other value.
Stacked
Shows the data values of each category on top of each other. The main focus is the
overall category value and the individual contribution of each value within the category.
Percent stacked
Shows the relative percentage of each data value with regard to the total of its category.
The main focus is the relative contribution of each value to the category total.
Additional options for creating column charts are:
3D Look
When this box is checked, two options become available in the drop-down list:
– Realistic – tries to give the best 3D look.
232 | Calc Guide 26.2
– Simple – tries to mimic the chart view of other products.
When you check the 3D Look box, a fourth chart variant becomes available called
Deep. This shows the data values of each category lined up, one behind the other.
Shape
Gives options for the shape of the columns in 3D charts. The choices are: Bar,
Cylinder, Cone, and Pyramid.
Bar charts
A bar chart is like a column chart that has been shifted 90 degrees. It shows horizontal bars
rather than vertical columns. In contrast to some other chart types, the Y axis is horizontal and
the X axis is vertical. The Chart Type dialog for a bar chart is essentially the same as for a
column chart, which was described above, with the previews modified to show horizontal bars.
Bar charts can have an immediate visual impact when time is not an important factor — for
example, when comparing the popularity of a few products in a marketplace. They may be
preferred to column charts when the category names are long or there are a significant number
of categories.
In the examples in Figure 205 below:
• To make the first chart, after using the Chart Wizard enter the edit mode and go to
Insert > Grids, deselect Y axis, and choose Insert > Mean Value Lines. Right-click
each mean value line and select Format Mean Value Line to increase the width of the
lines. Create rectangles from the Drawing toolbar to cover the mean value line entries in
the legend. Make them white by right-clicking and selecting Line and then Area.
• The second chart is a 3D chart created with a simple border and cylinder shape. The
chart area is rotated (described in Chapter 6 – Creating Charts and Graphs).
• The third chart eliminates the legend by using labels with the names of the companies
on the Y axis. Whereas the first two charts treat the data as separate data series, this
chart treats the data as one data series in order to have category labels for the X axis.
Rather than colors, a colored hatch pattern is used for the bars.
Figure 205: Bar chart examples
Pie charts
A pie chart shows values as circular sections of a circle. The area of each section is proportional
to its value.
Chapter 7 Gallery of Chart Types | 233
Pie charts are excellent for comparing proportions — comparisons of departmental spending, for
example. They work best with smaller numbers of values, up to about half a dozen; more than
this and the visual impact begins to fade.
Figure 206: Chart Type dialog - Pie
Pie variant options, shown in Figure 206, are:
Normal
Shows values as sections of a complete pie, with the option of separating out individual
pieces. Click the outer edge of a section to separate it from the remaining pie or to join it
back.
Exploded Pie
Shows all the sections separated from each other. Click and drag any section to move it
along radial lines from the pie center.
Donut
Shows multiple data series. Each data series is shown as one donut shape with a hole
inside, where the next data series can be shown. Click and drag an outer section to
move it along radial lines from the donut center.
Exploded Donut
Shows the outer sections already separated from the remaining donut. Click and drag
an outer section to move it along radial lines from the center.
The Chart Wizard initially guesses how the data should be presented in the chart. Adjust this on
the Data Range and Data Series pages of the Chart Wizard or by using the Data Ranges dialog.
You can do some interesting things with a pie chart, especially if you make it into a 3D chart. It
can be tilted, given shadows, and generally turned into a work of art. Just do not clutter it so
much that the message is lost, and be careful that tilting does not distort the relative sizes of the
segments.
If you only want to separate only piece of the pie, you can choose in the Chart Wizard to use the exploded
pie variant, but this option explodes all of the pieces (contrary to the preview graphic in Figure 206). If the
aim is to accentuate just one piece of the pie, separate out a piece by carefully highlighting it and dragging
it out of the group. After this, the chart area may need to be enlarged to regain the original size of the
pieces.
234 | Calc Guide 26.2
Figure 207: Pie chart examples
The effects achieved in Figure 207 are explained below.
2D pie chart with one section of the pie exploded
In the edit mode, go to Insert > Legend and deselect the Display legend box. Go to
Insert > Data Labels. Select Show value as number and also Show category. Click
the edge of the section (the section will have highlight squares to mark it), and drag it
out from the rest of the sections. The sections will decrease in size. If needed, highlight
the chart wall and drag it at a corner to increase the size.
3D pie chart, exploded variant, with realistic schema and various fill effects
In the edit mode, go to Format > Chart Type and select 3D Look. Go to Insert > Data
Labels and select Show value as percentage. Then carefully select each section so
that it has a wire frame highlight. Right-click and select Format Data Point to get the
Data Point dialog. Choose the Area tab. The illustration in Figure 207 shows one
section formatted with bitmap, one with a radial gradient, one with 50% transparency,
and one with a pattern.
Donut and exploded donut variants, shown in Figure 208, are used to display two sets of related
information, such as two years of financial data. This variant can be misleading for comparing
numeric data, since inner circles are necessarily smaller. For more variety, use a 3D look.
Figure 208: Donut chart examples
Of-Pie charts
Shows the last entries in the data column aggregated as a "composite" sector. The composite
sector is broken down in a bar chart or pie chart on the right.
Chapter 7 Gallery of Chart Types | 235
The of-pie charts are useful when the original pie chart has small values in the last entries.
When this is the case, the of-pie charts highlights the smaller values of the data series in a
separate chart on the right.
Tip
Sort the data series in descending order to get better results with the of-pie charts.
Figure 209: Of-pie charts
Bar of Pie
This subtype shows a pie chart on the left, with the last entries in the data column
aggregated as a "composite" sector. The composite sector is broken down in a bar
chart on the right.
Figure 210: Example of Bar of-Pie
236 | Calc Guide 26.2
Pie of Pie
Similar to the Bar of Pie subtype, this subtype shows a pie chart on the left, with the last
entries in the data column aggregated as a "composite" sector. The composite sector is
displayed on the right as another pie chart.
Size of the composite wedge
Select the number of entries to be merged into one slice of the original pie chart.
Area charts
Like a line or column chart, an area chart shows values as points on the Y axis and categories
on the X axis. The Y values of each data series are connected by lines and the areas below the
lines are colored.
Area charts emphasize volumes of change from one category to the next. They have greater
visual impact than line charts, but the data used will make a difference.
Figure 211: Chart Type dialog - 2D and 3D Area
Area chart variants, shown in Figure 211 are:
Normal
When 3D Look is deselected, plots all data as absolute Y values. It first plots the area
of the last data series in the data range, then the next to last, and so on. Finally, the first
data series is drawn over the other data. Thus, higher values in the first data series will
hide lower values of later data series.
Deep
When 3D Look is selected, this variant shows the first data series in front, with
subsequent data series behind.
Stacked
Stacks cumulative values on top of each other. This ensures that all values are visible,
and no data set is hidden by others. However, the Y values no longer represent
absolute values, except for the first data series, which is shown at the bottom of the
stacked areas.
Percent Stacked
Stacks cumulative values on each other and also scales the values as percentages of
the category total.
Note
If one of the series hides valuable information on an area chart, consider reordering
the data series in the Data Series tab of the Data Range dialog. See “Setting data
series ranges” in Chapter 6 – “Creating Charts and Graphs”.
Chapter 7 Gallery of Chart Types | 237
Figure 212: Area chart examples
Normal area charts
Area charts are sometimes tricky to create. Using transparency values may be helpful. To create
the charts in Figure 212, first set up the basic chart using the Chart Wizard. The chart on the left
shows the result. Because of the data overlap, some of it is missing behind the first data series.
This is probably not desirable. The other examples are better solutions.
To create the chart in the center:
After deselecting the Y axis grid, right-click on each data series in turn and select
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.
To create the chart on the right:
After doing the steps above, right-click and select Chart Type. Select the 3D Look
option and select Realistic in the drop-down list. Rotate the chart area using the 3D
View dialog. Instead of a legend, use labels on the Z axis.
Stacked area charts
Other ways of visualizing the same data series are the stacked area chart and the percentage
stacked area chart (Figure 213). In the first example, each point in a data series is added to the
other data series to show the total area. The second example shows a percentage stacked
chart, showing each value in the series as a percentage of the whole.
Figure 213: Stacked and percentage stacked area charts
238 | Calc Guide 26.2
Line charts
A line chart is useful for showing trends or changes over time when you want to emphasize
continuity. Values are shown as points on the Y axis and the X axis shows categories—often
time series data. The Y values of each data series may be connected by a line.
Note
The difference between line charts, described in this section, and XY (scatter) charts,
described in the next section, is this: line charts show categories along the X axis
while XY (scatter) charts show values along the X axis.
As shown in Figure 214, four variants are available:
Points Only
Plots only points.
Points and Lines
Plots points and connects points of the same data series by a line.
Lines Only
Plots only lines.
3D Lines
Connects points of the same data series by a 3D line.
When Stack series is selected, it shows cumulative Y values above each other. The options are:
• On top – places the value of each data series above the others. The Y values no longer
represent absolute values, except for the first data series, which appears at the bottom
of the chart. This is the default setting.
• Percent – scales the Y values as percentages of the category total.
Figure 214: Chart Type dialog – Line
The Line type drop-down list has three options that determine how the data points are
connected:
Straight
Draws straight lines between the points.
Chapter 7 Gallery of Chart Types | 239
Smooth
Connects the points with curves instead of lines. When this option is selected, click
Properties to open the Smooth Lines dialog (Figure 215) and further specify the
curves.
For smooth lines, there are two line type options: Cubic spline or B-spline. These are
mathematical models that join together segments of polynomials to display the curves.
For B-spline lines, there is an option to set the degree of the polynomials. Select a
higher resolution for smoother curves.
Figure 215: Smooth Lines dialog
Stepped
Connects points with horizontal and vertical lines only. Click Properties to further
specify the formatting of the lines (Figure 216). The options are self-explanatory.
Figure 216: Stepped Lines dialog
Things to do with lines: thicken them, smooth the contours, just use points, or make them 3D.
However, 3D lines can confuse the viewer, so just using a thicker line often works better. Figure
217 shows some examples of line charts.
Figure 217: Line chart examples
240 | Calc Guide 26.2
Scatter or XY charts
In contrast to line, column, and bar charts, which contain numeric values on the Y axis and
categories on the X axis, scatter or XY charts contain values along both axes. They are quite
useful, especially for understanding relationships among data that are precise and complex. An
XY chart may contain more than one data series and can perform many tasks, such as
generating a parameter curve or drawing the graph of a function.
Tip
When plotting time on the X axis, make sure that it is not text and is written in the
correct format for your locale. For example, instead of January, use a format such as
1/1/2022. Check locale formats at Tools > Options > Languages and Locales >
General > Formats > Date acceptance patterns.
XY charts are most frequently used to explore the statistical associations among quantitative
variables. There is often a constant value against which to compare the data — for example,
weather data, reactions under different acidity levels, or conditions at various altitudes.
Tip
By custom, if one of the variables is either controlled by an experimenter or it
changes consistently (such as time) it is considered an independent variable and
plotted on the X axis.
XY chart variants
Figure 218: Chart Type dialog – XY (Scatter)
As shown in Figure 218, when the XY (Scatter) chart type is selected, the following variants are
available:
Points Only
Shows an icon for each data point. Calc uses default icons with different forms and
colors for each data series. The default colors are set in Tools > Options > Charts >
Default Colors. Changing the colors and icons is discussed in “Chapter 6: Lines, areas,
and data point icons” for further information.
Points and Lines
Shows both points and lines.
Chapter 7 Gallery of Chart Types | 241
Lines Only
Draws straight lines from one data point to the next. The data points are not indicated
by icons. By default, the drawing order is the same as the order in the data series, but
note the option to sort by X values.
3D Lines
Makes the lines look like tapes. The data points are not shown by icons. In the finished
chart, use the 3D View dialog to set properties like illumination and angle of view.
The following options are available:
Sort by X values
Draws the lines in order of the X values. This can be helpful if the data series on the
spreadsheet is not in numeric order.
Line type – Straight
Draws straight line segments.
Line type – Smooth
Draws curves instead of straight line segments. Click Properties to set details for the
curves.
– Cubic spline interpolates the data points with polynomials of degree 3. The
transitions between the polynomial pieces are smooth, having the same slope and
curvature.
– B-spline uses parametric, interpolating B-spline curves. The curves are built from
polynomials.
– Resolution determines how many line segments are calculated to draw a piece of
polynomial between two data points. A value in the range 1 to 100. Click any data
point to see the intermediate points.
– Degree of polynomials (only for B-spline line type) sets the degree of these
polynomials. A value in the range 1 to 15.
Line type – Stepped
Uses only horizontal and vertical lines. Click Properties to set details for the stepped
lines.
After a scatter chart is created, its default settings can be changed in ways such as the following.
Be sure to first double-click the chart to enter edit mode. Depending on the option, a data point
or data series may also need to be double-clicked.
• Line styles and icons – double-click or right-click on a data series in the chart to open
the Data Series dialog. See “Chapter 6: Lines, areas, and data point icons” for further
information.
• Error bars – For 2D charts, select Insert > Y Error Bars or X Error Bars to enable the
display of error bars. See “Chapter 6: Error bars” for further information.
• Mean Value Lines and Trend Lines – Enable the display of mean value lines and trend
lines with commands on the Insert menu. See “Chapter 6: Trend and mean value lines”
for further information.
Examples of XY or scatter charts
By default, the first column or row of data (depending on whether the data is arranged in
columns or rows) is represented on the X axis. The rest of the rows of data are then compared
against the first row of data.
242 | Calc Guide 26.2
Scatter charts may surprise those unfamiliar with how they work. This can be seen in examples
using the following data (Figure 219), which is organized with data series in rows.
Figure 219: Sample currency data
The data range for the chart on the left in Figure 220 includes the cells containing the months.
However, the months do not appear on the chart because only values can be used in XY
(scatter) charts and Calc substitutes them for cardinal numbers.
The data range for the chart on the right in Figure 220 does not include the cells containing the
months. Calc assumes that the first row (or column) of data contains values for the X axis. The Y
values of the other data series are paired with each of those X values. This means that there are
no data points for the Japanese yen but each of the other currencies are shown in comparison to
the yen, since it supplies the X values.
Figure 220: XY (Scatter) chart examples
Bubble charts
A bubble chart is a variation of a scatter chart that can show three variables in two dimensions.
The data points are shown with bubbles. Two variables are plotted along the X and Y axes, while
the third variable is represented by the relative size of the bubbles. These charts are often used
to present financial data or social/demographic data.
One or more data series can be included in a single chart. The data series dialog for a bubble
chart has an entry to define the data range that determines the size of the bubbles.
It may be necessary to build a bubble chart manually in the data series page of the Chart
Wizard. Figure 221 shows how the data ranges can be set for a bubble chart.
Chapter 7 Gallery of Chart Types | 243
Figure 221: Data series entries for a bubble chart
The chart in Figure 222 is based on the data in Figure 221. To format the chart, the data series
are 50% transparent with a radial gradient. The data labels are formatted to be numbers in the
center of the data points (bubbles).
Note
Remember that bubble charts require numeric data. If the data series for the X axis
contains text (or dates not formatted as numbers) cardinal numbers will be used for
axis labels.
Figure 222: Bubble chart example
Net charts
Net charts are also known as spider, polar, or radar charts. They display data values as points
on radial spokes, with each spoke representing a variable. They compare data that are not time
series, but show different circumstances, such as variables in a scientific experiment.
Furthermore, they are especially useful for displaying clusters and outliers.
Figure 223 shows an example of a simple net chart. The radial spokes of the net chart are
equivalent to the Y-axes of other charts. All data values are shown with the same scale, so all
data values should have about the same magnitude.
244 | Calc Guide 26.2
Figure 223: Simple net chart example
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 224 shows the options for creating a net chart. These are similar to those for area and
line charts, described above. However, keep in mind that area increases as the square of the
distance along the linear spokes. Therefore, net charts can distort the areas representing the
data. Be especially careful about choosing to stack data series. In this case, successive data
series show increasingly large areas that are not proportional to their values.
Figure 224: Chart Type dialog - Net
Figure 225 shows examples of two types of net charts.
• The example on the left is a filled net chart. The color of one of the data series is 50%
transparent. Partial transparency is often best for showing all of the series.
• The example on the right is a net chart with lines and points. The data point icons are
taken from the Gallery and have a 3D look.
Chapter 7 Gallery of Chart Types | 245
Figure 225: Filled net chart and net chart with 3D data point icons
Stock charts
A stock chart illustrates the market trends for stock and shares by giving opening price, bottom
price, top price, and closing price. The transaction volume can also be shown and the X axis
usually represents a time series.
When setting up a stock chart in the Chart Wizard, the data should be arranged as shown in
Figure 226. It specifies which columns should be the opening, low, high, and closing prices of
the stock as well as the transaction volume. However, manual adjustments may still be needed
when defining the data series.
Figure 226: Example data arrangement for stock charts
A stock chart organizes data series in two basic ways. The first way is not used in other chart
types. In this case, the open, low, high, and closing values of a row create one data unit in the
chart and one data series consists of several rows containing such data units. The columns
containing transaction volumes are the second way used to organize data series. This is the
familiar way used in other chart types.
Figure 226 shows the data for four data series:
• The price data for Acme, which contains columns for open, low, high, and closing
prices.
• The price data for Ajax, which contains columns for open, low, high, and closing prices.
• The Acme transaction volume, which is one column.
• The Ajax transaction volume, which is one column.
246 | Calc Guide 26.2
Stock chart variants
The Chart Wizard offers four stock chart variants, as shown in Figure 227. Note that some of
them do not use all of the data columns.
Figure 227: Chart Type dialog - Stock
The data table in Figure 226 is used to illustrate the variants, which are as follows.
Stock Chart 1
When based only on data in the low and high columns, this variant shows the distance
between bottom price (low) and top price (high) with a vertical line. When the closing
column is also included (Figure 228), it shows an additional horizontal mark for the
closing price.
Stock Chart 2
Based on the open, low, high, and close columns, this variant generates the traditional
candlestick chart (Figure 229). It shows a vertical line between the bottom and top
prices and adds a rectangle in front that shows the range between the opening and
closing prices. For rising values (the opening price is lower than the closing price), the
fill color is white. For falling values, the fill color is black.
Stock Chart 3
Using the low, high, and close columns, draws a chart similar to Stock Chart 1 but with
additional columns for transaction volume. As shown in Figure 230, a secondary Y axis
enables both transaction volume and price to be shown on vertical axes.
Note
Variants 3 and 4 automatically align data to the secondary Y axis. For more
information about a secondary Y axis, see “Chapter 6: Aligning data to secondary
Y axis”.
Stock Chart 4
Based on all five data columns (volume, open, low, high, and close), this variant
combines Stock Chart 2 with a column chart for the transaction volume (Figure 231).
Chapter 7 Gallery of Chart Types | 247
Figure 228: Stock chart variant 1
Figure 229: Stock chart variant 2
Figure 230: Stock chart variant 3
248 | Calc Guide 26.2
Figure 231: Stock chart variant 4
Column and line charts
A column and line chart is useful for displaying two or more distinct but related data series, such
as sales over time (columns) and profit margin trends (lines). It could also show constant
minimum and maximum lines, such as used in medical testing or quality control.
Specify in the Chart Type dialog the number of lines. By default, the first column or row of data is
categories and the last columns or rows of data are lines.
Choose between two variants:
Columns and Lines
As seen in Figure 232, the columns are drawn side by side to easily compare their
values.
Figure 232: Column and line chart with secondary Y axis
Stacked Columns and Lines
The columns are stacked above each other, so that the height of a column shows the
sum of the data values.
The charts in Figures 232 and 233 show sales and profit data for two firms over a period of time.
Note that when first created, the lines were different colors than the columns for the same
company. To reflect the company relationships, change the line colors individually by clicking on
Chapter 7 Gallery of Chart Types | 249
a line, right-clicking, selecting Format Data Series, and formatting the line color and size on the
Line page.
For the background, right-click the chart wall, select Format Wall, and select desired options on
the Gradient page of the Area tab. To align the two data series to the secondary Y axis, see
“Chapter 6: Aligning data to secondary Y axis”.
Figure 233: Column and line chart with stacked columns
Pivot charts
Pivot tables are special types of data tables that simplify the manipulation and analysis of data.
They are widely used, especially for processing large amounts of data. Pivot charts are based
on pivot tables and are created by selecting Insert > Chart, or clicking the Insert Chart icon in
the Standard toolbar, after left-clicking a cell inside a pivot table. Pivot charts inherit many
properties of the other chart types described in this chapter but also have other characteristics
that are described in Chapter 10, Using Pivot Tables.
Create box plots with whiskers in Calc
Calc does not currently have the option of creating a data series as a box plot. However, it is
possible to convert the minimum, 1st quartile, median, 3rd quartile, and maximum of a stacked
column chart with the data series in rows and without a legend into a box plot with whiskers.
The conversion of this stacked column chart to a box plot with whiskers is done by replacing the
stacks in the chart with:
• Minimum of the data series
• The difference between the first quartile and the minimum of the data series.
• The difference between the median and the first quartile of the data series.
• The difference between the third quartile and the median of the data series.
• The difference between the maximum and the third quartile of the data series.
When calculating the differences of the first and third quartiles, it is important whether the data
series contains an even or an odd amount of data. For an even amount of data, the function
[Link] (range, parameter) should be used and for an odd amount of data use the
function [Link] (range, parameter).
The MIN (range), MEDIAN (range), and MAX (range) functions can be used to calculate the
minimum, median, and maximum, respectively.
250 | Calc Guide 26.2
Figure 234 shows a stacked column chart in rows of minimum, 1st quartile, median, 3rd quartile,
maximum (with no legend), together with a box plot with whiskers constructed from that column
chart.
Figure 234: Stacked column chart and box plot with whiskers
(56) Minimum of the data series
(60) The third quartile of the data series
(57) The first quartile of the data series
is also the top of the shapes box
(58) Bottom of the box to be formed
(61) The maximum of the data series
(59) The median of the data series
Converting the column chart to box plot with whiskers
You can convert a column chart to box plot with whiskers by following the next steps:
1) Remove or apply the color white to the bottom stack with Format Data Series in the
context menu.
2) While in edit mode, right-click on the chart and select Insert Y Error Bars from the
context menu.
3) Set the style in the Line Properties section of the Line tab in the Data Series Y Error
Bars dialog box to Continuous and the width to 0.03 cm.
4) On the Y Error Bars tab, select Cell Range and in the Error Indicator section choose
Negative. In the now opened Negative (-) box insert the difference between the 1st
quartile and the minimum.
5) Remove or apply the color white to the top stack with Format Data Series in the
context menu.
6) Set the configuration of the top whisker by performing steps similar to the described
above.
The box consists of the middle stack and the stack above it with the median separating the two
stacks. Both stacks should be framed with borders by selecting Format Data Series from the
context menu. On the Borders tab of the dialog, the Style should be set to Continuous and the
thickness to 0.03 cm. If desired, you can remove or whiten the background on the Plane tab.
For more detailed instructions about making a boxplot, see
[Link]
Chapter 7 Gallery of Chart Types | 251
Sparklines
Sparklines are small, simple, cell-sized charts that convey the general shape of data variation
within a dataset. Typically, sparklines are used to show variation over time and are usually drawn
without axes or coordinates.
Figure 235: A simple sparkline example
Tip
Calc’s sparklines are compatible with Microsoft Excel’s version of sparklines and can
be both imported from and exported to Excel.
Creating a sparkline
To create a sparkline:
1) Select the row or column of source data.
2) Either right-click on the selected data and choose Sparklines > Sparkline from the
context menu, or go to Insert > Sparkline on the Menu bar.
3) Calc displays the Sparkline Properties dialog, configured for sparkline creation
(Figure 236).
4) Select a single cell as the Output range.
5) Complete the remainder of the Sparkline Properties dialog, as required for the new
sparkline. The available options are described below.
6) Click OK to close the Sparkline Properties dialog and create the sparkline.
Figure 236: Sparkline Properties dialog (sparkline creation)
252 | Calc Guide 26.2
For sparkline creation, the Sparkline Properties dialog provides the following fields:
Data
• Input range – The input data range for the sparkline. This will be auto-populated if you
selected a data range before creating the sparkline.
• Output range – The cell(s) where the sparkline(s) will be drawn.
Properties
• Type – Select the sparkline type: Line, Column, or Stacked. These options are
described further in the “Types of sparkline” section below.
• Line width – Set the line width for line sparklines.
• Display empty cells as – Gap (skips the missing data and shows a gap in the
sequence), Zero (displays the missing data as zero), or Span (skips the missing data
and draws a line to the next value).
• Display hidden – Check to show all data in the selected input range in the sparkline. If
unchecked, hidden data will be ignored.
• Right-to-left – By default, the sparkline will display the data from left to right for rows and
top to bottom for columns. Checking this box will reverse the display order.
Colors
• Set the main color for the Series of values and check and select colors for various value
types to display in the sparkline. Marker will set the default color for the data points in
line sparklines only.
Axes
• Display X axis – Check to show an X‑axis in the sparkline.
• Vertical minimum, Vertical maximum – set the minimum and maximum values for the
Y‑axis with options Individual, Group (see “Creating multiple sparklines” below), and
Custom. The adjacent numeric input fields are available only when the Custom option
is selected in the corresponding menu.
Note
A sparkline is limited to one cell. To increase the size of the sparkline, increase the
size of the cell. If the sparkline cell is merged into other cells, the sparkline will
remain the same size as in the original cell, but the option to modify the sparkline’s
formatting will be lost until the cell is unmerged.
Types of sparkline
There are three types of sparkline – line, column, and stacked.
Line
Straight lines are drawn connecting data values.
Figure 237: Line sparkline example
Chapter 7 Gallery of Chart Types | 253
Column
Shows a bar for each data value.
Figure 238: Column sparkline example
Stacked
Shows equally sized bars up or down for positive or negative values. This is sometimes
known as a “win-loss sparkline”.
Figure 239: Stacked sparkline example
Creating multiple sparklines
To create multiple sparklines at once:
1) Select multiple rows or columns of source data.
2) Either right-click on the selected data and choose Sparklines > Sparkline from the
context menu, or go to Insert > Sparkline on the Menu bar.
3) Calc displays the Sparkline Properties dialog, configured for sparkline creation (Figure
236).
4) Select an equal number of cells for the Output range as there are rows or columns in
the Input range.
5) Complete the remainder of the Sparkline Properties dialog, as required for the new
sparklines. The available options are described in the notes above Figure 236.
6) Click OK to close the Sparkline Properties dialog and create the sparklines.
The new sparklines will appear in the Output range cells in the same order as the rows or
columns selected in the Input range. They will all share the same formatting and the same
sparkline group (see “Sparkline groups” below).
When setting the Vertical minimum or Vertical maximum to Group, each associated sparkline’s
Y‑axis will enlarge to include the lowest (for minimum) or highest (for maximum) value from all of
the data in the associated sparklines.
Tip
If the OK button in the Sparkline Properties dialog is unavailable, it is because the
number of cells in the Output range does not match the number of rows or columns
selected in the Input range. Update these dimensions to match, and the OK button
will become available.
254 | Calc Guide 26.2
Modifying a sparkline
Updating a sparkline’s data range
To update a sparkline’s data range:
1) Right-click on the sparkline and choose Sparklines > Edit Sparkline from the context
menu.
2) Calc displays the Sparkline Data Range dialog (Figure 240).
3) Update the Data range as required.
4) Click OK to close the Sparkline Data Range dialog.
Figure 240: Sparkline Data Range dialog
Updating a sparkline’s formatting properties
To update a sparkline’s formatting properties (excluding input and output ranges):
1) Either right-click on the selected sparkline and choose Sparklines > Sparkline from the
context menu, or select the sparkline and go to Insert > Sparkline on the Menu bar.
2) Calc displays the Sparkline Properties dialog, configured for sparkline modification
(Figure 241). Note that the controls on this version of the Sparkline Properties dialog
are identical to those for the sparkline creation version shown in Figure 236, except that
the fields in the Data area for entering the Input range and the Output range are
omitted.
3) Modify the fields of the Sparkline Properties dialog, as required. The available options
are as described in the notes above Figure 236.
4) Click OK to close the Sparkline Properties dialog and update the formatting properties
of the selected sparkline.
Chapter 7 Gallery of Chart Types | 255
Figure 241: Sparkline Properties dialog (sparkline modification)
Sparkline groups
Sparklines are defined for one cell, but multiple sparklines can be linked together into a group.
The group shares the same formatting properties for rendering the sparkline. The unique data
that is defined for each sparkline is the data range that will be used.
Each individually created sparkline is associated to one sparkline group. When multiple
sparklines are created at once, they initially share the same sparkline group. Any change to the
formatting properties of a sparkline group will affect all related sparklines.
When a sparkline is selected, all sparklines in the same group are highlighted.
Modifying the formatting properties of a sparkline group
To update the formatting properties of a sparkline group:
1) Right-click on a sparkline in the group to be modified and choose Sparklines > Edit
Sparkline Group from the context menu, or select a cell containing a sparkline in the
group to be modified and go to Format > Sparklines > Edit Sparkline Group on the
Menu bar.
2) Calc displays the Sparkline Properties dialog, configured for sparkline modification.
Note that the controls on this version of the Sparkline Properties dialog are identical to
those for the sparkline modification version shown in Figure 241.
3) Modify the fields of the Sparkline Properties dialog, as required. The available options
are described in the notes above Figure 236.
4) Click OK to close the Sparkline Properties dialog and update the formatting properties
for all sparklines in the group.
256 | Calc Guide 26.2
Grouping and ungrouping sparklines
To group sparklines so that they share the same formatting:
1) First select the sparkline with the group formatting that is to be applied to other
sparklines.
2) Next select the other sparkline(s) to add to the group.
3) Then do one of the following to finish the grouping:
– Right-click one of the selected cells and choose Sparklines > Group Sparklines
from the context menu.
– Go to Format > Sparklines > Group Sparklines on the Menu bar.
To ungroup sparklines so that they can be formatted separately, select the sparklines to be
removed from the sparkline group and do one of the following:
• Right-click one of the selected cells and choose Sparklines > Ungroup Sparklines
from the context menu.
• Go to Format > Sparklines > Ungroup Sparklines on the Menu bar.
The sparklines that were ungrouped will now each have their own sparkline group.
Deleting sparklines
To delete a single sparkline, do one of the following:
• Select the sparkline and press Delete.
• Select the sparkline and go to Format > Sparklines > Delete Sparkline on the Menu
bar.
• Right-click the sparkline and choose Sparklines > Delete Sparkline from the context
menu.
To delete all sparklines in a group, do one of the following:
• Select a sparkline in the group and go to Format > Sparklines > Delete Sparkline
Group on the Menu bar.
• Right-click a sparkline in the group and choose Sparklines > Delete Sparkline Group
from the context menu.
Chapter 7 Gallery of Chart Types | 257
Calc Guide 26.2
Chapter 8
Printing, Exporting,
Emailing, and Signing
Printing
Quick printing
To quickly print a spreadsheet, click the Print Directly icon (not visible by default) on the
Standard toolbar to send the entire spreadsheet to your default printer.
Note
To print directly to the printer defined for the document instead of the default printer, ,
go to Tools > Options > Load/Save > General and select the Load printer
settings with the document option.
Controlling printing
For more control over printing, select File > Print on the Menu bar, or click the Print icon on the
Standard toolbar, or use the Ctrl+P key combination to open the Print dialog (Figure 242).
Note
The options selected on the Print dialog apply to this printing of this document only.
To specify default printing settings for LibreOffice, go to Tools > Options > LibreOffice > Print
and Tools > Options > LibreOffice Calc > Print. For details, see Chapter 16, Setting up and
Customizing.
The Print dialog has multiple tabs where you can choose a range of options, as described in the
following sections. Depending on the computer’s operating system, the number of tabs and the
layout of each tab may be different from the illustrations shown in this chapter.
The Print dialog includes a Preview checkbox that enables to turn on/off a preview of how the
data will appear on the printed page. The preview appears on the left-hand side of the dialog.
Adjacent controls allow you to navigate through multiple pages.
General tab
On the General tab of the Print dialog (Figure 242), you can choose from the following options:
• Printer
– Select an available printer from the list of installed printers.
– Click the Properties button to change any required settings of the selected printer.
The options available through this interaction will depend on your printer and
system.
• Range and Copies
– Select which sheets and pages to print; single or double-sided printing; the number
of copies to print; whether to collate multiple copies; and the page order for printing.
(See “Selecting what to print” below.)
• Page Layout
– Select page layout properties such as paper size, portrait, or landscape orientation;
how many pages are printed per sheet of paper; the order in which the pages are
printed on a sheet of paper; and whether a border is drawn around each page.
260 | Calc Guide 26.2
Figure 242: Print dialog – General tab
LibreOffice Calc tab
On the LibreOffice Calc tab of the Print dialog (Figure 243), you can select whether to suppress
the output of empty pages when you print the spreadsheet.
Figure 243: Print dialog – LibreOffice Calc tab
Printing multiple pages on a single piece of paper
To print multiple pages of a spreadsheet on one piece of paper:
1) Use File > Print on the Menu bar, or click the Print icon on the Standard toolbar, or use
the Ctrl+P key combination to open the Print dialog.
Chapter 8 Printing, Exporting, Emailing, and Signing | 261
2) In the Page Layout section of the General tab, select the number of spreadsheet pages
to print per sheet of paper in the Pages per sheet drop-down list. The preview panel on
the right shows how the pages will look in the printed document.
3) When printing more than one page per sheet, select the order to print the pages on a
sheet in the Order drop-down list (Figure 244).
4) To distinguish each page on a sheet, select the Draw a border around each page
option.
5) Click Print.
Figure 244: Printing more than one spreadsheet page per sheet of paper
Tip
To access some options on the General tab of the Print dialog, you may need to click
one of the More buttons. For simplicity, these clicks are deliberately omitted from the
descriptions in this chapter.
Selecting what to print
In the Range and Copies area of the General tab of the Print dialog, choose Print All Sheets in
the From which drop-down to print all sheets in the document. In addition to printing a full
spreadsheet document, you can select single sheets, multiple sheets, and selections of cells for
printing.
To print an individual sheet:
1) In the spreadsheet, click on the sheet tab to select the sheet you want to print.
2) Choose File > Print on the Menu bar, or click the Print icon on the Standard toolbar, or
use the Ctrl+P key combination to open the Print dialog.
3) In the Range and Copies area of the General tab of the Print dialog, choose Print
Selected Sheets in the From which drop-down.
4) Click Print.
To print a range of sheets:
1) In the spreadsheet, select the sheets to print. For details on how to select multiple
sheets, see Chapter 1, Introduction.
2) Choose File > Print on the Menu bar, or click the Print icon on the Standard toolbar, or
use the Ctrl+P key combination to open the Print dialog.
262 | Calc Guide 26.2
3) In the Range and Copies area of the General tab of the Print dialog, choose Print
Selected Sheets in the From which drop-down.
4) Click Print.
To print a selection of cells:
1) In the spreadsheet, select the cells to print.
2) Choose File > Print on the Menu bar, or click the Print icon on the Standard toolbar, or
use the Ctrl+P key combination to open the Print dialog.
3) In the Range and Copies area of the General tab of the Print dialog, choose Print
Selected Cells in the From which drop-down.
4) Click Print.
Printing in grayscale on a color printer
You may wish to print a spreadsheet in grayscale on a color printer. You can do this in two ways.
Note
Some color printers may print in color regardless of the settings you choose.
For an individual file, you can change the printer settings to print in black and white or grayscale:
1) Choose File > Print on the Menu bar, or click the Print icon on the Standard toolbar, or
use the Ctrl+P key combination to open the Print dialog.
2) Click the Properties button to open the Properties dialog for the printer. The available
choices vary from one printer to another, but you should find options for the color
settings. See your printer’s help or user manual for more information.
3) The choices for color might include black and white, or grayscale. Choose grayscale.
4) Click OK to confirm your choice and return to the Print dialog.
5) Click Print to print the document.
You can change the LibreOffice settings to print all color text and graphics as grayscale:
1) Choose Tools > Options > LibreOffice > Print.
2) In the Defaults section, select Convert colors to grayscale. Click OK to save the
change.
Caution
This changes the print settings for all components of LibreOffice, not just Calc.
Previewing pages/sheets before printing
To preview the sheets in Calc before printing:
1) Choose File > Print Preview on the Menu bar, or click the Toggle Print Preview icon
on the Standard toolbar, or press Ctrl+Shift+O.
2) The Calc window now displays the Print Preview toolbar instead of the Formatting
toolbar.
Figure 245: Print Preview toolbar
Chapter 8 Printing, Exporting, Emailing, and Signing | 263
3) To print the document from this view, select File > Print on the Menu bar, or click the
Print icon on the Standard toolbar, or use the Ctrl+P key combination to open the Print
dialog.
4) Choose the print options and click the Print button.
5) Click the Toggle Print Preview icon again, or click the Close Preview icon on the right-
hand side of the Print Preview toolbar, to return to the normal spreadsheet view.
Using print ranges
You can define which range of cells on a spreadsheet are to be printed or exported to a PDF.
The cells on the sheet that are not part of the defined print range are not printed or exported.
Also, any sheets without a defined print range are not printed or exported. Creating a user-
defined print range will replace any existing defined print range.
Defining and printing a print range
To set a user-defined print range:
1) Select the range of cells to be used in the print range.
2) Go to Format > Print Ranges > Define on the Menu bar. If Tools > Options >
LibreOffice Calc > View > Page breaks is enabled, then automatic page break lines
are displayed on the screen, defining the cells included in the print range.
3) Click on the Print Directly icon on the Standard toolbar to print the defined print range,
or open the Print dialog and click Print to print the defined print range.
Tip
You can check the print range by using Toggle Print Preview or the Preview pane in
the Print dialog. Calc will display only the cells in the print range. See “Viewing print
ranges” below.
Editing a print range
At any time, you can edit the print range, For example to add or remove cells, or define rows and
columns to repeat (such as column or row headings). For more details on how to define
repeated rows and/or columns, see “Repeat printing of rows or columns” below.
1) Go to Format > Print Ranges > Edit on the Menu bar to open the Edit Print Ranges
dialog (Figure 246).
Figure 246: Edit Print Ranges dialog
264 | Calc Guide 26.2
2) If only a single range is defined, then clicking anywhere in the Print Range text box
displays the defined print range bounded in blue, as shown in Figure 247.
Figure 247: Single print range marked by a bounding box
3) Multiple cell ranges can also be defined by separating each range with a single comma.
This can be done with the keyboard by typing in a comma and the cell references, using
the same format as the print ranges already defined in the Print Range text box.
Remember to separate the cell references with a colon. New cell ranges can also be
added by holding Ctrl as you select the cell range using the cursor.
4) To remove a print range, select the print range in the Print Range text box and delete it.
Make sure the remaining print ranges are separated by a single comma and there is not
a comma at the end of the sequence.
5) Click OK to save your changes and close the dialog.
Viewing print ranges
After print ranges have been defined, they are formatted with automatic page breaks. To view
the page breaks, go to View > Page Break on the Menu bar to open the preview (Figure 248).
The print ranges are outlined by default with a blue border and contain a pale gray page number
in the center of each page. The non-printing area of the spreadsheet normally has a gray
background.
To exit the page break preview, go to View > Normal on the Menu bar.
Figure 248: Page break preview
Chapter 8 Printing, Exporting, Emailing, and Signing | 265
Named print ranges
In addition to defining a print range for each print job, you can also define a range of cells to be
used repeatedly, without having to select a range of cells every time. This is useful if different
areas of a large spreadsheet have to be printed for different reports; several named print ranges
can be defined to meet this need.
Figure 249: Define Name dialog
Defining and naming
1) Select the cells you want to define and name as a print range, then go to Sheet >
Named Ranges and Expressions > Define on the Menu bar to open the Define Name
dialog (Figure 249). The selected cells are displayed in the Range or formula
expression box.
2) Alternatively, open the Define Name dialog, then select the cells you want to define and
name. The selected cells are then displayed in the Range or formula expression box.
3) Type a name for the range in the Name box. Use only letters, numbers, and
underscores in the name; no spaces, hyphens, or other characters are allowed.
Note
You cannot start a name with c, C, r, R followed by any number. The reason is that
these names are ambiguous with the R1C1 cell reference notation. Also, the name
cannot refer to a valid cell reference such as A123.
4) If necessary, you can edit or set the range of selected cells for the print range in the
Range or formula expression box. See “Editing a print range” above for more
information.
5) Make sure Document (Global) is selected in the Scope drop-down list.
6) Select Print range from Range Options to define the settings as a print range.
7) Click Add to accept the data and close the dialog.
Printing a named range
To select a named range for printing:
1) Go to Format > Print Ranges > Edit on the Menu bar to open the Edit Print Ranges
dialog (Figure 250).
2) Select the defined and named print range in the Print Range drop-down list.
266 | Calc Guide 26.2
3) Click OK to close the dialog.
4) Open the Print dialog, which will show only the named range in the preview area. Click
Print.
Figure 250: Choosing a named range for printing
Deleting a named print range
To delete a named print range if it is no longer required:
1) Go to Sheet > Named Ranges and Expressions > Manage on the Menu bar, or press
Ctrl+F3, to open the Manage Names dialog (Figure 251).
Figure 251: Manage Names dialog
2) Select the named print range you want to delete and confirm it is a print range by
checking the options from the Range Options.
3) Click Delete and then click OK to close the dialog.
Chapter 8 Printing, Exporting, Emailing, and Signing | 267
Removing print ranges
It may become necessary to remove a defined print range, for example if the whole sheet needs
to be printed later, or you no longer want to print some of the added ranges.
Go to Format > Print Ranges > Clear on the Menu bar to remove all of the defined print ranges
in the spreadsheet, except for named print ranges. After the print range is removed, the default
page break lines for the selected paper size will appear on the screen (assuming that Tools >
Options > LibreOffice Calc > View > Page breaks is enabled).
To remove named print ranges, see “Deleting a named print range” above.
Repeat printing of rows or columns
If a spreadsheet is printed on multiple pages, you can define specific rows or columns (for
example, headings) to repeat print on each printed page.
Using print ranges
1) Go to Format > Print Ranges > Edit to open the Edit Print Ranges dialog (Figure 252).
. Figure 252: Repeat printing of rows and columns
2) In the Rows to Repeat box, type the references for the rows to be repeat printed. For
example, to repeat rows 1, 2 and 3, type $1:$3. This automatically changes the Rows
to Repeat drop-down from - none - to - user defined -.
3) You can also place the cursor in the Rows to Repeat box and then, using the mouse,
select a cell in each row you want to be repeat printed. It is not necessary to select the
whole row.
4) In the Columns to Repeat box, type the references for the columns to be repeat printed.
For example, to repeat column A, type $A. This automatically changes the Columns to
Repeat drop-down from - none - to - user defined -.
5) You can also place the cursor in the Columns to Repeat box and then, using the mouse,
select a cell in each column you want to be repeat printed.
6) Click OK to save your changes and close the dialog.
Using named print ranges
You can also define named print ranges to use for repeat printing of rows or columns as follows:
1) Define and name the rows and/or columns you want to repeat print. See “Named print
ranges” above for more information. Similar to user defined print ranges, it is sufficient
to select one cell from the row or column you want to be repeat printed.
268 | Calc Guide 26.2
2) Select Repeat column and / or Repeat row from Range Options to define the columns
and/or rows for repeat printing in the Define Name dialog (Figure 249 on page 266).
3) Click Add to accept the data and close the dialog.
4) Go to Format > Print Ranges > Edit to open the Edit Print Ranges dialog (Figure 252).
5) Select the defined and named print ranges from the Rows to Repeat and/or Columns to
Repeat drop-down lists.
6) Click OK to save your changes and close the dialog.
Page breaks
While defining a print range can be a powerful tool, you may sometimes need to manually adjust
the page breaks to make sure the spreadsheet prints the way you want it to look. You can insert
two types of page breaks into a spreadsheet:
• Row break – inserts a horizontal page break above a selected cell in a row. For
example, if the selected cell is H15, then a row break is created between rows 14 and
15.
• Column break – inserts a vertical page break to the left of the selected cell in a column.
For example, if the selected cell is H15, then a column break is created between
columns G and H.
When a manual break is inserted, it appears as a blue line or as a bold line between the rows or
columns on the display. The actual appearance depends on your computer setup. To see
manual break lines more easily on your display, you can change their appearance. Go to Tools
> Options > LibreOffice > Appearance and scroll down to the Spreadsheet section where you
can change how page breaks appear.
Inserting page breaks
1) Select the cell where you want to insert a manual break in the spreadsheet.
2) Go to Sheet > Insert Page Break on the Menu bar.
3) Select Row Break to insert a row break above the cell or Column Break to insert a
column break to the left of the cell.
Alternatively, go to View > Page Break on the Menu bar. Select the cell where you want to insert
a manual break, right-click in the spreadsheet and select Row Break or Column Break in the
context menu. Remember to go to View > Normal on the Menu bar and return to the standard
spreadsheet view.
Deleting page breaks
1) Select the cell where you want to delete a manual break from the spreadsheet.
2) Go to Sheet > Delete Page Break on the Menu bar.
3) Select Row Break to delete a row break from above the cell or Column Break to delete
a column break from the left of the cell.
Note
If an appropriate cell (right of a column break or below a row break) has not been
selected, then the Column Break or Row Break options are grayed out.
Chapter 8 Printing, Exporting, Emailing, and Signing | 269
Deleting multiple page breaks
Multiple manual row and column breaks can exist in the same spreadsheet. If you want to
remove all breaks from the spreadsheet:
1) Go to View > Page Break on the Menu bar.
2) Right-click in the spreadsheet and select Delete Page Breaks in the context menu to
remove all manual breaks from your spreadsheet.
3) Go to View > Normal on the Menu bar to return to the standard spreadsheet view.
Printing options for page styles
When using page styles for your spreadsheets, you can include printing options within the page
style. For example, page order, details, scale to be printed, and so on. Using page styles allows
you to quickly set up and change the printing options of different sheets within your spreadsheet.
See Chapter 4, Using Styles and Templates, for more information about page styles.
Make sure you have selected the correct sheet within the spreadsheet before setting the print
options. Go to Format > Page Style on the Menu bar to open the Page Style dialog, then click
on the Sheet tab (Figure 253) to set the printing options for a page style. The dialog title
indicates the name of the page style you are about to change.
. Figure 253: Page Style dialog – Sheet tab
Tip
You can also open the Page Style dialog by going to the Styles deck of the Sidebar,
right-clicking the relevant page style, and selecting Modify in the context menu.
Another alternative is to double-click the name of the page style on the Status Bar.
• Page Order – defines the order in which data in a sheet is numbered and printed when
it does not fit on one printed page. A preview of the page order is shown in the graphic
on the top right of the dialog in Figure 253.
270 | Calc Guide 26.2
– Top to bottom, then right – prints vertically from the left column to the bottom of
the sheet.
– Left to right, then down – prints horizontally from the top row of the sheet to the
right column.
– First page number – select this option if you want the first page to start with a
number other than 1. Enter the number of the first page in the box.
• Print – defines which elements of the spreadsheet are to be printed.
– Column and row headers – prints the column and row headers.
– Grid – prints the borders of the individual cells as a grid. For the view on screen,
make your selection under Tools > Options > LibreOffice Calc > View > Grid
lines.
– Comments – prints the comments defined in the spreadsheet. Comments will be
printed on a separate page, along with the corresponding cell reference.
– Objects/Images – includes all inserted objects (if printable) and graphics with the
printed spreadsheet.
– Charts – prints the charts that have been inserted into your spreadsheet.
– Drawing objects – includes all drawing objects in the printed spreadsheet.
– Formulas – prints the formulas contained in the cells, instead of the results of any
formulas used in the spreadsheet.
– Zero values – specifies that cells with a zero value are printed with a zero (0) in the
cell.
• Scale – defines a page scale for the printed spreadsheet.
– Scaling mode – select a scaling mode in the drop-down list. Appropriate controls for
the scaling mode selected will be shown below the drop-down list box.
Reduce/enlarge printout – specifies a scaling factor to scale all printed pages.
Enter the scaling factor as a percentage in the box, in the range 10% to 400%.
Factors less than 100% reduce the pages, while higher factors enlarge the pages.
Shrink print range(s) to width/height – specifies the maximum number of pages
horizontally (width) and vertically (height) on which every sheet with the current
page style is to be printed. The print ranges are always scaled proportionally, so the
resulting number of pages may be less than specified. You may clear one of the
boxes; then the unspecified dimension will use as many pages as necessary. If you
clear both boxes, the scaling factor will be 100%.
Shrink print range(s) on number of pages – specifies the maximum number of
pages to be printed for each sheet that uses the same page style. The scale will be
reduced as necessary to fit the defined number of pages.
Headers and footers
Headers and footers are predefined pieces of text that are printed at the top or bottom of a sheet
outside the sheet area. Headers and footers are set the same way, and you can have different
content on left and right pages that use the same page style.
Chapter 8 Printing, Exporting, Emailing, and Signing | 271
Setting headers and footers
To turn the headers or footers on in your spreadsheet:
1) Select the sheet where you want to turn on the header or footer.
2) Open the Page Style dialog using one of the following methods:
– Select Format > Page Style on the Menu bar.
– Go to the Styles deck of the Sidebar, right-click the relevant page style, and select
Modify in the context menu.
– Double-click the name of the page style on the Status Bar.
3) Select the Header (or Footer) tab (Figure 254). The Header and Footer tabs on the
Page Style dialog are identical.
4) Select the Header on or Footer on option.
5) Enter the values for the other options according to your requirements. These options
are described below.
6) Click OK to save your changes and close the dialog.
Figure 254: Page Style dialog – Header tab
• Header on or Footer on – adds a header or footer to the current page style.
• Same content on left and right pages – causes left and right pages to share the same
header or footer content. To assign a different header or footer to left and right pages,
deselect this option and then click Edit. See “Header or footer contents” below for more
information.
• Same contents on first page – causes the first page to have a different header or
footer than the remaining pages. To assign a different header or footer to the first page,
deselect this option and then click Edit. See “Header or footer contents” below for more
information.
• Left margin – enter the amount of space to leave between the left page margin and the
left edge of the header or footer.
272 | Calc Guide 26.2
• Right margin – enter the amount of space to leave between the right page margin and
the right edge of the header or footer.
• Spacing – enter the amount of space to maintain between the bottom edge of the
header and the top edge of the spreadsheet, or the top edge of the footer and the
bottom edge of the spreadsheet.
• Height – enter the height for the header or footer.
• AutoFit height – automatically adjusts the height of the header or footer to fit the
content.
• Preview box – shown on the right side of Figure 254, this area displays a preview of the
current selection.
• More – opens the Border/Background dialog, where you can define the appearance of
borders and background colors or images for headers or footers. See Chapter 4, Using
Styles and Templates, for more information.
• Edit – opens the Header or Footer dialog where you can add, edit, or format text that is
placed in the header or footer. See “Header or footer contents” below for more
information.
Header or footer contents
The headers and footers in a Calc spreadsheet have three columns for text. Each column can
either be empty or have different contents than the other columns.
1) Select the sheet where you want to turn on the header or footer.
2) Open the Page Style dialog (Figure 254), then select Header on or Footer on and the
options for the header or footer. See “Setting headers and footers” above.
3) Click Edit to open the Header or Footer dialog (Figure 255). If Same content on left
and right pages and / or Same contents on first page is deselected in the Page
Style dialog, the Header or Footer dialog will have tabbed pages where you can set the
header or footer contents for the first page as well as right and left pages.
Figure 255: Header dialog
Chapter 8 Printing, Exporting, Emailing, and Signing | 273
4) To enter standard contents into the header or footer, select an option from the Header
or Footer drop-down list.
5) To enter customized contents into the header or footer, click in one of the area boxes
and type your text, or click in one of the area boxes and click one of the Custom
header or Custom footer icons. These icons are explained below.
6) To change the appearance of the text in the header or footer, click the Text Attributes
icon to open the Text Attributes dialog, where you can set the font, font effects and font
position.
7) Click OK to save the changes to text attributes and close the Text Attributes dialog.
8) Click OK to save the changes to the contents of the header or footer and close the
Header or Footer dialog.
9) Click OK to save the changes to your header or footer and close the Page Style dialog.
The options available for a Custom header or Custom footer are as follows:
• Text Attributes – opens a Text Attributes dialog where you can assign formats to new
or selected text. The Text Attributes dialog contains tabs for Font, Font Effects, and
Position.
• Title – inserts a file name placeholder in the selected area. Click and select either Title,
File Name, or Path/File Name in the drop-down menu that opens. If a title has not be
assigned to the spreadsheet, the file name for the spreadsheet will be inserted instead.
• Sheet Name – inserts a placeholder in the selected area for the sheet name of the
selected sheet in the spreadsheet.
• Page – inserts a placeholder in the selected area for the page number. This allows
continuous page numbering in a spreadsheet.
• Pages – inserts a placeholder in the selected area for the total number of pages in the
spreadsheet.
• Date – inserts a placeholder in the selected area for the current date, which will be
repeated in the header/footer on each page of the spreadsheet.
• Time – inserts a placeholder in the selected area for the current time, which will be
repeated in the header/footer on each page of the spreadsheet.
Exporting to PDF
Calc can export documents to PDF (Portable Document Format). This industry-standard file
format is ideal for sending a file to someone else, for viewing using Adobe Acrobat Reader or
any other PDF viewer.
Caution
By default, a document in PDF format is not protected against contents tampering or
editing. The PDF document contents can be edited by specialized software tools,
including LibreOffice Draw.
Tip
Unlike Save As, the Export command writes a copy of the current document in a
new file with the chosen format, but keeps the current document and format open in
your session.
274 | Calc Guide 26.2
Quick export to PDF
Click the Export Directly as PDF icon on the Standard toolbar to export the entire spreadsheet
using the PDF settings most recently selected on the PDF Options dialog (see below). When
doing so, you may only specify the file name and location for the PDF. Other options such as
page range and image compression are not available.
Controlling PDF content and quality
For more control over the content and quality of the resulting PDF, use File > Export as PDF.
The PDF Options dialog opens. This dialog has six tabs (General, Initial View, User Interface,
Links, Security, and Digital Signatures). Select the appropriate settings, and then click Export.
Then enter the location and file name of the PDF to be created, and click Save to export the file.
Tip
You can also access the PDF Options dialog by going to File > Export on the Menu
bar and then selecting the PDF – Portable Document Format entry in the Save as
type drop-down menu.
General tab of PDF Options dialog
On the General tab (Figure 256), you can choose which pages to include in the PDF, the type of
compression to use for images (which affects the quality of images in the PDF), and other
options. For more information, see the Getting Started Guide or the Help.
Figure 256: PDF Options dialog – General tab
Range section
• All: Exports the entire document to PDF.
• Pages: To export a range of pages within a selected sheet, use the format 3-6 (pages 3
to 6). To export single pages, use the format 7;9;11 (pages 7, 9, and 11), or a
combination of the two formats.
• Selection/Selected sheet(s): Exports the selected sheets only. You must first select
the sheets to export. See Selecting Sheets in Chapter 1, Introduction.
• View PDF after export: If selected, your default PDF viewer will open and display the
newly exported PDF.
Chapter 8 Printing, Exporting, Emailing, and Signing | 275
Images section
• Lossless compression: Images are stored without any loss of quality. This option can
lead to large files when used with photographs. Recommended for other kinds of
images or graphics.
• JPEG compression: Allows for varying degrees of quality, in the range 1 to 100%. A
setting of 90% works well with photographs (small file size, little perceptible loss of
quality).
• Reduce image resolution: Select the required value from the options in the drop-down
menu. Lower DPI (dots per inch) images have lower quality. Higher DPI settings can
greatly increase the size of the exported file.
Watermark section
• Sign with watermark: When this option is selected, a transparent overlay of the text
you enter into the text box will appear on each page of the PDF.
General section
• Hybrid PDF (embed ODF file): Use this setting to export the document as a PDF file
containing two file formats: PDF and ODF. In PDF viewers it behaves like a normal PDF
file, and it remains fully editable in LibreOffice.
• PDF Version: PDF/A is an ISO standard for long-term preservation of documents, by
embedding all the information necessary for faithful reproduction (such as fonts) while
forbidding other elements (including forms, security, and encryption). PDF tags are
written. Also select which version of the standard to use, PDF/A-1b (PDF 1.4 base),
PDF/A-2b (PDF 1.7 base), PDF/ A-3b (PDF 1.7 base) or PDF/A-4 (PDF 2.0 Base),
which is the default.
• Universal Accessibility (PDF/UA): Use this setting to create a universal accessibility-
compliant PDF file that follows the requirements of the PDF/UA standard (formerly ISO
14289). This option automatically selects the Tagged PDF checkbox below. LibreOffice
does not check accessibility issues in spreadsheets.
Form section
• Submit format: Use the drop-down menu to choose the format of submitting forms
from within the PDF file (FDF, PDF, HTML, or XML).
• Allow duplicate field names – If enabled, the same field name can be used for
multiple fields in the generated PDF file. If disabled, field names will be exported using
generated unique names.
Structure section
• Tagged PDF: Tagged PDF contains information about the structure of the document’s
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.
• Export outlines: Generally not used in Calc.
• Comments as PDF annotations: Exports comments as PDF notes. You may not want
this!
• Comments in margin: Not available in Calc.
• Whole Sheet Export: The setting allows you to export your Calc spreadsheet to PDF,
with the content of a sheet exported as one page in the PDF. This facility is not intended
for printing but allows you to easily see and review the full content of a spreadsheet
document in a PDF form, without the usual slicing of the sheets into printable pages.
Preview pages will have different sizes, as do the source sheets.
276 | Calc Guide 26.2
Note:
Selecting the Whole Sheet Export option overrides many of the other settings on
the PDF Options dialog.
• Export automatically inserted blank pages: Not available in Calc.
• Use reference XObjects: Reference XObjects enable one PDF file to import content
from another. More information can be found in the ISO 32000 standard that defines the
core specifications of PDF files. If you are not familiar with reference XObjects, leave
this box unchecked.
Initial View tab of PDF Options dialog
On the Initial View tab (Figure 257), you can select how the PDF file opens by default in a PDF
viewer. The options should be self-explanatory.
Figure 257: PDF Options dialog – Initial View tab
User Interface tab of PDF Options dialog
On the User Interface tab (Figure 258), you can select options to control how a PDF viewer
displays the file. Some of these options are useful when you are creating a PDF to be used as a
presentation or a kiosk-type display.
Window Options
• Resize window to initial page: the PDF reader window displays the whole first page.
• Center window on screen: the PDF is shown in a reader window centered on screen.
• Open in full screen mode: the PDF reader window is in front of all other windows.
• Display document title: the PDF is shown with the document title in the reader title
bar.
Transitions
Not used in Calc.
Chapter 8 Printing, Exporting, Emailing, and Signing | 277
User Interface Options
• Hide menubar: hides the reader menu bar when the document is active.
• Hide toolbar: hides the reader toolbar when the document is active.
• Hide window controls: hides the reader controls when the document is active.
Collapse Outlines
• Show All: shows all outline levels when the reader opens the PDF.
• Visible levels: shows outline levels down to the selected level (in the range 1 to 10)
when the reader opens the PDF.
Figure 258: PDF Options dialog – User Interface tab
Note
Outlines are generally not used in Calc.
Links tab of PDF Options dialog
On the Links tab (Figure 259) you can select how bookmarks and hyperlinks are exported to
PDF.
General
– Export outlines as named destinations: If you have defined Calc sheet names,
this option exports them as “named destinations” to which Web pages and PDF
documents can link. Generally not used in Calc.
– Convert document references to PDF targets: If you have defined links to other
documents with OpenDocument extensions (such as .odt, .ods, and .odp), this
option converts the file extensions to .pdf in the exported PDF document.
– Export URLs relative to file system: If you have defined relative links in a
document, this option exports those links to the PDF. See Relative hyperlinks in the
Calc Help for more information.
Cross-document links
Defines the behavior of links clicked in PDF files. Select one among the following
alternatives:
– Default mode: The PDF links will be handled as specified in your operating system.
278 | Calc Guide 26.2
– Open with PDF reader application: Use the same application used to display the
PDF document to open linked PDF documents.
– Open with Internet browser: Use the default Internet browser to display linked
PDF documents.
– Remove cross-document links: Specifies that the PDF will be exported without
links external to the document.
Figure 259: PDF options dialog - Links tab
Security tab of PDF Options dialog
Use the Security tab (Figure 260) to encrypt and set passwords when you export your
spreadsheet and create the PDF file. Setting encryption and passwords also allows you to apply
restrictions on printing and if changes or copying can be carried out on the PDF file.
Figure 260: PDF Options dialog – Security tab
Chapter 8 Printing, Exporting, Emailing, and Signing | 279
Click the Set Passwords button to open the Set Passwords dialog (Figure 261), where you
enter the passwords. You can enter a password (Set open password) to open the file and an
optional password (Set permission password) to restrict what readers can do with the PDF file.
• 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 permission password set, the PDF can be opened by anyone, but its
permissions can be restricted. See Figure 260. After you set a password for
permissions, the other choices on the right half of the Security tab become available.
• 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.
The options on the Security tab become available only when passwords have been set.
Figure 261: Set Passwords dialog
Note
Permissions settings are effective only if the user’s PDF viewer respects the settings.
Digital Signatures tab of PDF Options dialog
The Digital Signatures tab contains the options related to exporting a digitally signed PDF.
Digital signatures are used to ensure that the PDF was really created by the original author (that
is, you), and that the document has not been modified since it was signed.
The signed PDF export uses the keys and X.509 certificates already stored in your default key
store location or on a smartcard. The key store to be used can be selected under Tools >
Options > LibreOffice > Security > Certificate Path. (Not available on Microsoft Windows
systems, where LibreOffice will access the system certificate storage.) When using a smartcard,
it must already be configured for use by your key store. This is usually done during installation of
the smartcard software. Details about using these features is outside the scope of this chapter.
280 | Calc Guide 26.2
Figure 262: PDF Options dialog – Digital Signatures tab
• Use this certificate to digitally sign PDF documents: Click Select to open the Select
X.509 Certificate dialog, where all certificates found in your selected key store are
displayed. If the key store is protected by a password, you are prompted for it. When
using a smartcard that is protected by a PIN, you are also prompted for that.
Select the certificate to use for digitally signing the exported PDF, then click Select.
All other fields on the Digital Signatures tab are accessible only after a certificate has
been selected.
• Certificate password: Enter the password used for protecting the private key
associated with the selected certificate. Usually this is the key store password. If the key
store password has already been entered in the Select X.509 Certificate dialog, the key
store may already be unlocked and not require the password again.
When using a smartcard, enter the PIN here. Some smartcard software will prompt you
for the PIN again before signing.
• Location, Contact information, Reason: Optionally enter additional information about
the digital signature that will be applied to the PDF. This information will be embedded in
the appropriate PDF fields and will be visible to anyone viewing the PDF. Each or all of
the three fields may be left blank.
• Time Stamp Authority: Optionally select a Time Stamping Authority (TSA) URL. During
the PDF signing process, the TSA will be used to obtain a digitally signed timestamp
that is then embedded in the signature. Anyone viewing the PDF can use this
timestamp to verify when the document was signed.
The list of TSA URLs that can be selected is maintained under Tools > Options >
LibreOffice > Security > TSAs. If no TSA URL is selected (the default), the signature
will not be timestamped, but will use the current time from your local computer.
Exporting to other formats
LibreOffice uses the term “export” for some file operations involving a change of file type. If you
want to use another spreadsheet file format (for example, Microsoft Excel), use File > Save As.
If you want to create web pages from your spreadsheet, use File > Export.
Chapter 8 Printing, Exporting, Emailing, and Signing | 281
Emailing spreadsheets
LibreOffice provides several ways to quickly and easily send a document as an email attachment
in OpenDocument format (LibreOffice default format), other spreadsheet formats, or as a PDF
file. You can also email a document to several recipients. For more information, see the Getting
Started Guide.
To send the spreadsheet as an email attachment:
1) Go to File > Send on the Menu bar and select from the following options. LibreOffice
opens your default email program (if set) with the spreadsheet attached in the selected
format.
– Email Document: the spreadsheet is sent in its current format.
– Email as OpenDocument Spreadsheet: the spreadsheet is sent in the ODF format
(.ods).
– Email as Microsoft Excel: the spreadsheet is sent in the Excel format (.xlsx).
– Email as PDF: The PDF Options dialog opens. Select the parameters to be used for
the PDF file. See “Controlling PDF content and quality” above.
2) In your email program, enter the recipient, subject, and any text you want to add, then
send the email.
Note
Avoid the Send via Bluetooth option, which is non-operational in this software build.
Digital signing of documents
To sign a document digitally, you need a personal key, also known as a certificate. A personal
key is stored on your computer as a combination of a private key, which 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 document’s
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 LibreOffice,
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 the public key with the public key that is published on the web site of the certificate
authority.
Whenever someone changes something in the document, the change breaks the digital
signature.
On Windows operating systems, the Windows features for validating a signature are used. On
Linux systems, files that are supplied by Mozilla Thunderbird or Firefox are used to validate the
signature. For a more detailed description of how to get and manage a certificate, and signature
validation, see About Digital Signatures in the LibreOffice Help.
282 | Calc Guide 26.2
Applying a digital signature
The following procedure is only an example of how to digitally sign a document. The actual
procedure depends on how your computer is set up and the computer’s operating system.
1) Open the file that you want to digitally sign.
2) Go to File > Digital Signatures > Digital Signatures on the Menu bar.
– If you have set LibreOffice to warn you when the document contains certain types of
information (see “Removing personal data” below), you may see a message box
asking whether you want to continue signing the document. Click Yes to continue, or
click No to exit and take appropriate action to remove the private information and
restart this procedure.
– If you have not saved the document since the last change, a message box appears.
Click Yes to save the file. When you have saved the file, the Digital Signatures
dialog opens (Figure 263). It lists existing signatures and their descriptions (if they
have any).
Figure 263: Digital Signatures dialog
3) On the Digital Signatures dialog, click Sign Document to open the Select X.509
Certificate dialog (Figure 264).
Chapter 8 Printing, Exporting, Emailing, and Signing | 283
Figure 264: Select X.509 Certificate dialog
4) Select the certificate you want to use and click Sign to close the Select X.509
Certificate dialog.
5) The certificate used is displayed in the Digital Signatures dialog with an icon next to its
name. This icon indicates the status of the digital signature.
– An icon with a red seal indicates that the document was signed, and the certificate
was validated.
– An icon with a yellow caution triangle overlaying the red seal indicates that the
document is signed but that the certificate could not be validated.
– An icon with a yellow caution triangle by itself indicates an invalid digital signature.
7) Click Close to close the Digital Signatures dialog and digitally sign your file.
A signed document shows an icon in the status bar. You can double-click the icon to view the
certificate. More than one signature can be added to a document.
Note
If you make any changes to the document after digitally signing, the digital signature
is removed automatically, and you have to repeat the above procedure to digitally
sign it again.
Signing multiple times with the same signature
In the past, LibreOffice prohibited creating multiple signatures by the same author on a
document, because there was no semantic meaning of signing the same document multiple
times. LibreOffice now provides a signature description, so multiple signatures from the same
author are allowed, because each signature can have a different meaning.
When you select File > Digital Signatures > Digital Signatures, the dialog (Figure 263) lists
existing signatures together with their description (if they have any).
When you click the Sign Document button, the dialog (Figure 264) for certificate selection now
also asks for an optional description.
Changing the value of an existing description invalidates the signature.
284 | Calc Guide 26.2
Digitally signing macros
If you sign a document that contains macros, the macros inside the document are signed
automatically. If you want to sign only the macros, but not the document, go to Tools > Macros
> Digital Signature on the Menu bar and apply the signature as described above.
Removing personal data
You may wish to ensure that personal data, versions, notes, hidden information, or recorded
changes are removed from files before you send them to other people or create PDFs from
them.
• In Tools > Options > LibreOffice > Security > Options, you can set Calc to remind
you when files contain certain information and to remove personal information
automatically on saving.
• To remove personal and some other data from a file, go to File > Properties. On the
General tab, deselect Apply user data and then click Reset Properties. This removes
any names in the created and modified fields, deletes the modification and printing
dates, and resets the Total editing time to zero, the creation date to the current date and
time, and the Revision number to 1.
• To remove version information, either go to File > Versions on the Menu bar, select the
versions from the list and click Delete, or go to File > Save As and save the file with a
different name.
Chapter 8 Printing, Exporting, Emailing, and Signing | 285
Calc Guide 26.2
Chapter 9
Using Formulas and
Functions
Introduction
In earlier chapters, we focused on entering two basic types of data into spreadsheet cells:
numbers and text. However, there are times when the content of a cell isn't straightforward and
depends on the values in other cells. To address this, we use a third type of data: formulas.
Formulas are equations that combine numbers and variables to calculate a result. In
spreadsheets, the variables are cell references containing the data needed for the calculation.
In addition to formulas, spreadsheets also offer functions, which are predefined calculations
designed to help analyze or manipulate data efficiently. By providing the required inputs, called
arguments, the function performs the calculation automatically. Functions simplify the process of
creating complex formulas, making it easier to achieve the results you require.
About Calculations
Calc calculates and recalculates data through a process that involves several key components
and mechanisms. Here's a breakdown of how it generally works:
1) Dependency Tracking: When a formula is created in a cell, Calc keeps track of which
cells are input sources for that formula. This is known as dependency tracking. For
example, if cell A1 contains a formula that sums values from A2 and A3, the
spreadsheet knows that A1 depends on A2 and A3.
2) Change Detection: When data in any cell is modified (either manually or through
another formula), Calc detects the change. It identifies which cells (if any) are affected
by this change based on the established dependencies.
3) Recalculation Triggering: When a change is detected, Calc triggers a recalculation of
all affected cells. Depending on the settings and context, it may perform a full
recalculation (updating all formulas) or a partial recalculation (updating only the cells
that depend on the changed cells).
4) Calculation Order: The recalculation occurs in a specific order, usually following the
dependency chain. Cells that do not depend on others will be calculated first, followed
by cells that depend on them.
5) Recalculation Modes:
– Automatic Recalculation: This is the default mode in Calc. Changes in input
values automatically trigger recalculations of dependent cells. Check it in Data –
Calculate – AutoCalculate checkbox.
– Manual Recalculation: In this mode, you can control when recalculation happens.
After making a series of changes, the user can manually trigger a recalculation. Go
to Data – Calculate – Recalculate or press F9. To force recalculation of all formulas
in the document, including Add-In functions and non-volatile functions, use Data –
Calculate – Recalculate Hard, or press Ctrl + Shift + F9.
6) Display of Results: After recalculation, Calc updates the values in the respective cells
based on the current data and formulas. You can see these updated values in real time.
The results are formatted according to the cell format attributes, such as decimal
places, font color and number formats.
7) Performance Optimization: For large datasets or complex calculations, Calc
implements various optimization techniques to speed up recalculation. This might
include caching results or using smarter algorithms to reduce the number of calculations
needed. For example, the OpenCL library (if available in the computer) or the Kahan
summation algorithm.
288 | Calc Guide 26.2
AutoCalculation
AutoCalculation is a built-in feature in LibreOffice Calc that ensures formulas update instantly
whenever values change in dependent cells. This functionality enhances real-time accuracy and
reduces the need for manual recalculations.
How AutoCalculation Works
• When a user modifies a cell, any linked formulas automatically update their values.
• Calc continuously evaluates dependencies to ensure that all affected cells reflect the
latest inputs.
• This process is particularly useful for dynamic datasets, such as financial models,
inventory tracking, or live dashboards.
AutoCalculation Use Case
AutoCalculation impact varies depending on the complexity of the spreadsheet.
When AutoCalculation is Beneficial:
• Financial Models and Dashboards: Ensures real-time updates, making it indispensable
for dynamic spreadsheets.
• Collaboration and Shared Workbooks: Prevents outdated data when multiple users
modify values simultaneously.
• Error Reduction: Reduces the risk of miscalculations due to outdated values.
When Disabling AutoCalculation is Useful
• Large Datasets and Complex Formulas: Continuous recalculations can slow down
performance.
• Static Reports and Summaries: When data isn't changing frequently, manual
recalculations (F9) can optimize resources.
• System Resource Management: Helps prevent excessive CPU load in complex
financial models.
Balancing AutoCalculation for Efficiency:
For highly interactive and data-driven environments, AutoCalculation is valuable.
However, for reports and historical data analysis, manual recalculations ensure
smoother performance.
AutoCalculation How-To
AutoCalculation feature can be enabled or disabled via: Data > Calculate > AutoCalculate.
Alternatively, pressing F9 performs a manual recalculation, allowing selective updates for better
performance control.
A status bar icon (toggle switch) will indicate when AutoCalculate is switched off (Figure 265) To
enable the AutoCalculate feature, click on the Icon.
Figure 265: AutoCalculate icon in status bar
Inherent Accuracy Problem
Calc, just like most other spreadsheet software, uses floating-point math capabilities available on
hardware. Given that most contemporary hardware uses binary floating-point arithmetic with
Chapter 9 Using Formulas and Functions | 289
limited precision defined in IEEE 754, many decimal numbers – including as simple as 0.1 –
cannot be precisely represented in Calc (which uses 64-bit double-precision numbers internally).
Calculations with those numbers necessarily results in rounding errors, and those accumulate
with every calculation.
This is not a bug, but is expected and currently unavoidable without using complex calculations
in software, which would incur inappropriate performance penalties, and thus is out of question.
You need to account for that, and use rounding and comparisons with epsilon as necessary.
For example, the simple formula in column A:
A
1 31000.99
2 32000.12
3 =A1-A2
This will result in -999.129999999997 in A3, instead of expected -999.13 (you might need to
increase shown decimal places in cell format to see this).
Setting up a spreadsheet
If you are setting up more than a simple one-sheet system in Calc, it is worth planning ahead a
little. Make sure to:
• Choose the right kind of input.
• Include documentation.
• Incorporate a system of error-checking.
The points above are explained further below.
Formula inputs
Many users create lengthy and complex formulas by directly typing fixed values into them. For
example, when converting one currency to another, the formula requires the current exchange
rate. Suppose you enter a formula in cell C1 as =0.75*B1 to calculate the value in euros for the
dollar amount in cell B1. If the exchange rate changes from 0.75 to another value, you’ll need to
manually update the formula.
A better approach is to use an input cell for the exchange rate and reference that cell in your
formulas. This makes it easy to adjust calculations when the exchange rate changes. For
example, you can test different scenarios—such as an exchange rate of 0.70 or 0.80—without
editing the formula, and it becomes clear which rate is being used.
Additionally, breaking complex formulas into smaller, more manageable parts (as explained
below) reduces errors and makes troubleshooting much easier.
Comments, labels, and headings
A common reason spreadsheets fail is the lack of proper documentation. Many users start with a
simple sheet that gradually evolves into something far more complex. Without documentation,
the original purpose and methods used in the spreadsheet often become unclear and difficult to
interpret. In such cases, it’s often easier to start over from scratch, wasting the effort already
invested.
By adding comments to cells and using clear labels and headings, you can make your
spreadsheet much easier to understand and modify—either by yourself or others—saving
significant time and effort in the future.
290 | Calc Guide 26.2
Error-checking formulas
Errors often occur when adding columns of data or cell ranges due to missed cells, incorrect
range specifications, or double-counting. To minimize these issues, it's helpful to include checks
in your spreadsheets.
For instance, when calculating the total of a column, use the SUM function to find the column's
total. Then, as a verification step, calculate row totals in a separate (non-printing) column and
add these together. The sum of the row totals should match the sum of the column totals. If the
two values don’t match, there’s an error in your data.
To streamline this process, you can create a formula to calculate the difference between the two
totals. If the result is non-zero, it can automatically flag an error (see Figure 266).
Figure 266: Error checking of formulas
To help locate problems with the formulas in your spreadsheet, Calc provides a display option to
visually highlight any cells in a sheet that contain formulas. This option is disabled by default. To
enable the option, go to Tools > Options > LibreOffice Calc > View and tick the Formula
indicator and hint option in the Display area of the dialog. Calc subsequently draws a blue
triangle in the bottom-left corner of each cell that contains a formula. When hovering the pointer
over the triangle, the formula in the cell is displayed in a tool tip (even if a different cell is
selected).
Figure 267: Formula indicator and hint
Creating formulas
You can enter formulas in two ways:
1) Using the Function Wizard or the Functions section in the Sidebar.
2) Typing directly into the cell or the Input line.
Chapter 9 Using Formulas and Functions | 291
Every formula must begin with an = symbol. When typing directly, you typically start a formula
with =. However, if the formula starts with a + or – (for example, -2*A1), Calc will automatically
prepend the = symbol.
Keep in mind:
• If you enter only a number (for example, -2 or +3), it will not be treated as a formula.
• If your entry starts with anything other than =, +, or -, Calc interprets it as text rather
than a formula.
Operators in formulas
Each cell in the sheet can be used as a data holder or a place for data calculations. To enter
data, simply type in the cell and move to the next cell or press Enter. With formulas, the equals
sign indicates that the cell will be used for a calculation. An example of a mathematical
calculation like 15 + 46 is shown in Figure 268.
Figure 268: A simple calculation
While the calculation on the left used 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 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 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 using formulas are shown in
Table 9.
These cell references allow formulas to use data from anywhere in the sheet being worked on,
or from any other sheet in the document that is opened. If the data needed was in different
sheets, they would be referenced by referring to the name of the sheet, for example
=$Sheet2.B12+$Sheet3.A11.
292 | Calc Guide 26.2
Table 9: Common ways to use formulas
Formula Description
=A1+10 Displays the contents of cell A1 plus 10.
=A1*16% Displays 16% of the contents of A1.
=A1*A2 Displays the result of multiplying the contents of A1 and
A2.
=ROUND(A1,1) Displays the contents of cell A1 rounded to one decimal
place.
=EFFECT(5%,12) Calculates the effective interest for 5% annual nominal
interest with 12 payments a year.
=B8-SUM(B10:B14) Calculates B8 minus the sum of the cells B10 to B14.
=SUM(B8,SUM(B10:B14)) Calculates the sum of cells B10 to B14 and adds the
value to B8.
=SUM(B1:B1048576) Sums all numbers in column B.
=AVERAGE(BloodSugar) Displays the average of a named range defined under
the name BloodSugar. It is possible to establish ranges
for inclusion by naming them using Sheet > Named
Ranges and Expressions > Define, for example
BloodSugar representing a range such as B3:B10.
=IF(C31>140, “HIGH”, “OK”) 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. In
this example, if the contents of C31 is greater than 140,
then HIGH is displayed, otherwise OK is displayed.
Note
To enter the = symbol for a purpose other than creating a formula as described in
this chapter, type an apostrophe or single quotation mark before the =. For example,
in the entry '= means different things to different people, Calc treats everything after
the single quotation mark—including the = sign—as text.
Operator types
The following operator types may be used:
arithmetic
comparative
text
reference
Each of these types are described in the sections that follow.
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 2^3 = 2*2*2.
Table 10: Arithmetic operators
Operator Name Example
+ (Plus) Addition =1+1
Chapter 9 Using Formulas and Functions | 293
Operator Name Example
– (Minus) Subtraction =2–1
– (Minus) Negation –5
* (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 11: Comparative operators
Operator Name Example Result (A=4, B=5)
= Equal A1=B1 FALSE
> Greater than A1>B1 FALSE
< Less than A1<B1 TRUE
>= Greater than or equal to A1>=B1 FALSE
<= Less than or equal to A1<=B1 TRUE
<> Inequality A1<>B1 TRUE
If cell A1 contains the numerical value 4 and cell B1 contains the numerical value 5, the above
examples would yield results of FALSE, FALSE, TRUE, FALSE, TRUE, and TRUE.
Text operators
Spreadsheets often include text data. To allow flexibility in how this data is displayed, text from
different cells or sources can be combined into a single string. This process is known as
concatenation. For example, you can join pieces of text from various cells to create a single
message or label. Figure 269 illustrates this concept.
294 | Calc Guide 26.2
Figure 269: Text concatenation
In this example, specific pieces of the text were found in three different cells. To join these
segments together, the formula also adds required spaces and punctuation enclosed within
quotation marks, resulting in a formula of =B2 & “ ” & C2 & “, ” & D2. The result is the
concatenation into a date formatted in a particular sequence.
Note that the CONCATENATE function can be used to perform the same operation as the
formula.
Reference operators
A single cell in a spreadsheet is identified by its column letter (found at the top of the columns)
and its row number (found along the left side of the rows). For spreadsheets read from left to
right, the upper-left cell is referenced as A1.
While a reference typically points to one cell, it can also refer to a range of cells in a rectangle
(e.g., A1:B5) or even a cuboid range in 3D references across sheets. References can also
include lists of non-contiguous cells or ranges. To create these more complex references, you
use reference operators.
Reference range operator
The range operator is written as a colon. An expression using the range operator has the
following syntax:
reference upper left : reference lower right
The range operator builds a reference to the smallest range including both the cells referenced
with the left reference and the cells referenced with the right reference.
In the upper left corner of Figure 270 the reference A1:D12 is shown, corresponding to the cells
included in the drag operation with the mouse to highlight the range.
Figure 270: Reference operator for a range
Chapter 9 Using Formulas and Functions | 295
Table 12: Reference range operator examples
Example Description
A2:B4 Reference to a rectangle range with 6 cells, 2 column width × 3
row height. When you click on the reference in the formula in the
input line, a border indicates the rectangle.
(A2:B4):C9 Reference to a rectangle range with cell A2 top left and cell C9
bottom right. So the range contains 24 cells, 3 column width × 8
row height. This method of addressing extends the initial range
from A2:B4 to A2:C9.
Sheet1.A3:Sheet3.D4 Reference to a cuboid range with 24 cells, 4 column width × 2
row height × 3 sheets depth. (Assumes that sheets Sheet1,
Sheet2, and Sheet3 appear in that order on the Sheet tabs area.)
B:B Reference to all cells of column B.
A:D Reference to all cells of columns A to D.
20:20 Reference to all cells of row 20.
1:20 Reference to all cell of rows 1 to 20.
When you enter B4:A2, B2:A4, or A4:B2 directly, 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. For
more information on naming cells, see “Named ranges” below.
Reference concatenation operator
The concatenation operator is written as a tilde. An expression using the concatenation operator
has the following syntax:
reference left ~ reference right
The result of such an expression is a reference list, which is an ordered list of references. Some
functions can take a reference list as an argument, SUM, MAX, or INDEX for example.
The reference concatenation is sometimes called 'union'. But it is not the union of the two sets
'reference left' and 'reference right' as normally understood in set theory. COUNT(A1:C3~B2:D2)
returns 12 (=9+3), but it has only 10 cells when considered as the union of the two sets of cells.
Notice that SUM(A1:C3,B2:D2) is different from SUM(A1:C3~B2:D2) although they give the
same result. The first is a function call with 2 parameters, each of them is reference to a range.
The second is a function call with 1 parameter, which is a reference list.
The reference concatenation also applies to whole rows and whole columns. For example
SUM(A:B~D:D) is the sum of all cells in columns A and B and the column D.
Reference intersection operator
The intersection operator is written as an exclamation mark. An expression using the intersection
operator has the following syntax:
reference left ! reference right
If the references refer to single ranges, the result is a reference to a single range, containing all
cells, which are both in the left reference and in the right reference.
If the references are reference lists, then each list item from the left is intersected with each one
from the right and these results are concatenated to a reference list. The order is to first intersect
the first item from the left with all items from the right, then intersect the second item from the left
with all items from the right, and so on.
Examples
296 | Calc Guide 26.2
A2:B4 ! B3:D6
This results in a reference to the range B3:B4, because these cells are inside A2:B4 and inside
B3:D6. This is illustrated in Figure 271, in which the cells in the range A2:B4 have orange
backgrounds and the cells in the range B3:D6 have thick black borders. The cells that have both
an orange background and a thick black border (B3:B4) form the intersection of the two ranges.
Figure 271: Simple example of reference intersection operator
(A2:B4~B1:C2) ! (B2:C6~C1:D3)
First the intersections A2:B4!B2:C6, A2:B4!C1:D3, B1:C2!B2:C6, and B1:C2!C1:D3 are
calculated. This results in B2:B4, empty, B2:C2, and C1:C2. Then these results are
concatenated, dropping empty parts. So the final result is the reference list B2:B4 ~ B2:C2 ~
C1:C2.
A:B ! 10:10
This calculates the intersection of columns A and B with row 10, thus selecting A10 and B10.
You can use the intersection operator to refer to a cell in a cross tabulation in an understandable
way. If you have columns labeled 'Temperature' and 'Precipitation' and the rows labeled
'January', 'February', 'March', and so on, then the following expression
'February' ! 'Temperature'
will reference the cell containing the temperature in February. The correct operation of this
expression assumes that the Automatically find column and row labels option on the Tools >
Options > LibreOffice Calc > Calculate dialog is enabled. The expression is equivalent to 3:3
! B:B, assuming that the data for February is in row 3 while the temperature data is in
column B.
The intersection operator (!) has a higher precedence than the concatenation operator (~), but
do not rely on precedence.
Tip
Always put the part that is to be calculated first in parentheses.
Relative and absolute references
References are the way that we refer to the location of a particular cell in Calc and can be either
relative (to the current cell) or absolute (a fixed amount).
Relative referencing
An example of a relative reference will illustrate the difference between a relative reference and
absolute reference using the spreadsheet from Figure 272.
1) Type the numbers 4 and 11 into cells C3 and C4 respectively of that spreadsheet.
2) Copy the formula in cell B5 (=B3+B4) 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.
Chapter 9 Using Formulas and Functions | 297
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.
Figure 272: Relative references
You can think of a relative address as a pair of offsets to the current cell. Cell B1 is 1 column to
the left of cell C5 and 4 rows above. The address could be written as R[-4]C[-1].
Whenever you copy this formula from cell B5 to another cell, the result will always be the sum of
the two numbers taken from the two cells one and two rows above the cell containing the
formula.
Relative addressing is the default method of referring to addresses in Calc.
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. USD 10.00 would be multiplied by 0.75 to convert to Euros,
in this case EUR 7.50. The following example shows how to input an exchange rate and use that
rate to convert amounts in a column from 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.
The $ signs before the D and the 1 convert the reference to cell D1 from relative to absolute or
fixed. If the formula is copied to another cell the second part will always show $D$1. The
interpretation of this formula is “take the value in the cell one column to the left in the same row
and multiply it by the value in cell D1”.
298 | Calc Guide 26.2
Figure 273: Absolute references
Cell references can be shown in four ways, listed in Table 13.
Table 13: Cell reference types
Reference Explanation
D1 Relative, from cell E3 it is the cell one column to the left and two rows above
$D$1 Absolute, it is the cell D1
$D1 Partially absolute, from cell E3 it is the cell in column D and two rows above
D$1 Partially absolute, from cell E3 it is the cell one column to the left and in row 1
Tip
To change references in formulas, highlight the cell and press F4 to cycle through the
four types of references. To cycle only part of the formula select the cells in the
formula bar and cycle with F4. Selecting the menu option Sheet > Cycle Cell
Reference Types is equivalent to pressing the F4 shortcut.
Knowledge of the use of relative and absolute references is essential if you want to copy and
paste formulas and to link spreadsheets.
Named ranges
You can assign names to individual cells or ranges of cells to improve formula readability and
simplify spreadsheet management. For example, instead of using the formula =SUM(B1:B10) to
sum weights in the range B1:B10, you can name the range "Weight" and write the formula as
=SUM(Weight). This makes your formulas more intuitive and easier to understand.
An additional benefit of named ranges is that they dynamically update in all associated formulas
when the range’s location or size changes. For instance, if the “Weight” range moves to
Chapter 9 Using Formulas and Functions | 299
P10:P30, you only need to update the named range definition. The formulas referencing
“Weight” will automatically adjust without further changes.
To define a named cell or range:
1) Select the cell or range.
2) Navigate to Sheet > Named Ranges and Expressions > Define in the menu.
3) In the dialog (as shown in Figure 274), specify the name and scope for the named
range.
Figure 274: Define Name dialog
Tip
You can also define a named range directly in the sheet by selecting the range and
typing its name in the Name Box at the left of the Formula Bar (Figure 275).
Figure 275: Inserting name in the range box to define a named range
To quickly access a named range, select the named range in the Name Box drop-down above.
The named range is shown on the screen and selected.
300 | Calc Guide 26.2
To modify a named range, use the Manage Names dialog (Figure 276). This dialog is accessed
by selecting Sheet > Named Ranges and Expressions > Manage on the Menu bar or pressing
Ctrl+F3.
Figure 276: Manage Names dialog
Quickly Naming Ranges
If your data table includes column headings at the top or bottom and row headings on the left or
right, you can easily create named ranges using the Create Names dialog:
1) Select the range that includes your table headings.
2) Go to Sheet > Named Ranges and Expressions > Create on the menu bar. The
Create Names dialog will open (Figure 277).
3) Specify the location of your headings. The named ranges will be created automatically.
Note
If the headings contain duplicate names, Calc will prompt you to confirm whether to
replace previous occurrences with the most recent one.
Figure 277: Create names dialog
Chapter 9 Using Formulas and Functions | 301
Tip
If the table includes both row and column headings, you can reference any element
using the range intersection operator (!) —for example: =row_heading !
column_heading
Named expressions
You also can give a long or complex formula a name. To name a formula, open the Define Name
dialog (Figure 274) and enter the formula expression in the Range or formula expression box.
Name the expression and click Add.
As an example, suppose you need to compute in cells C1 to C10 the circumference of a set of
circles, and you are given their radius in B1 to B10. Define a named expression
CIRCUMFERENCE, with expression =2*PI()*B1 and click Add to close the dialog. In cell C1,
type =CIRCUMFERENCE and press Enter. The formula is applied to cell C1. Copy cell C1 and
paste in the remaining cells from C2 to C10 and you have the circumferences of all the circles.
All cells in the range C1:C10 have the expression =CIRCUMFERENCE.
Note
The named expression uses the same rules for cell addressing, that is, absolute and
relative references.
Order of calculation
The order of calculation refers to the sequence in which operations are performed in a formula.
For an overview of these rules, see the Wikipedia article on orders of operations at
[Link] .
In spreadsheets, division and multiplication are performed before addition and subtraction. A
common misconception is that calculations occur strictly from left to right, as one might read an
equation in English. However, Calc evaluates the entire formula based on established
precedence rules, prioritizing multiplication and division over addition and subtraction.
To ensure your formula produces the expected result, it's a good practice to test it thoroughly. If
necessary, use parentheses to clarify the order of operations and make your intent explicit. The
following example demonstrates how the order of calculation is applied in practice.
Table 14: Order of calculation
Left To Right Calculation Ordered Calculation
1+3*2+3 = 11 =1+3*2+3 result 10
1+3 = 4, then 4x2 = 8, then 8+3 = 11 3*2 = 6, then 1+6+3 = 10
Another possible intention could be: The program resolves the multiplication of 3 x
1+3*2+3 = 20 2 before dealing with the numbers being
1+3 = 4, then 2+3 = 5, then 4x5=20 added.
If you intend for the result to be either of the two possible solutions on the left, order the formula
as:
((1+3) * 2)+3 = 11 (1+3) * (2+3) = 20
Note
Use parentheses to group operations in the order you intend; for example,
=B4+G12*C4/M12 might become =((B4+G12)*C4)/M12.
302 | Calc Guide 26.2
Calculations linking sheets
Calc allows you to link data across multiple sheets within a spreadsheet, making it a powerful
tool for organizing and referencing information. To make your spreadsheet easier to navigate,
assign meaningful names to sheets, such as "Payroll" or "Boise Sales," instead of using default
names like "Sheet1."
The SHEET() function can be used to return the current sheet's position in the order of sheets.
For example, if you have multiple sheets named Sheet1, Sheet2, etc., numbered from left to
right, dragging a sheet to a new location updates its position, and SHEET() reflects the new
order.
By default, a new Calc instance includes only one sheet, but you can add, rename, and
rearrange sheets as needed to organize your data effectively.
For example, if the formula =SHEET() is put into A1 on Sheet 1 it returns the value 1. If you drag
Sheet 1 to be positioned between sheets 2 and 3 then the value changes to 2; it is now the
second sheet in the order.
An example of calculations obtaining data from other work can be seen in a business setting
where a business combines revenues and costs of each of its branch operations into a single
combined sheet. See Figures 278 to 281.
Figure 278: Sheet containing data for Branch 1
Chapter 9 Using Formulas and Functions | 303
Figure 279: Sheet containing data for Branch 2
Figure 280: Sheet containing data for Branch 3
Figure 281: Sheet containing combined data for all branches
304 | Calc Guide 26.2
The sheets have been set up with identical structures. The easiest way to do this is to open a
new spreadsheet, set up the first branch sheet, input data, format cells, and prepare the
formulas for the various sums of rows and columns. After that, create copies from the first sheet
as follows:
1) On the sheet tab, right-click and select Rename Sheet. Type Branch1. Right-click on
the tab again and select Move or Copy Sheet.
2) In the Move/Copy Sheet dialog (Figure 282), select the Copy option (automatically
selected if there is only one sheet in the spreadsheet) and select -move to end
position- in the Insert before area. Change the entry in New name to Branch2. Click
Copy. Repeat to produce the Branch3 and Combined sheets.
Figure 282: Copying a sheet
3) Enter the data for Branch 2 and Branch 3 into the respective sheets. Each sheet stands
alone and reports the results for the individual branches.
4) In the Combined sheet, click on cell K7. Type =, click on the tab Branch1, click on cell
K7, press +, repeat for sheets Branch2 and Branch3, and press Enter. You now have a
formula in cell K7 which adds the revenue from greenery sales for the three branches.
Chapter 9 Using Formulas and Functions | 305
Figure 283: Combined sheet showing linking between branch sheets
5) Copy the formula, highlight the range K7:N17, click Edit > Paste Special > Paste
Special on the Menu bar, or right-click and select Paste Special > Paste Special in the
context menu, or press Ctrl+Shift+V. Uncheck the All and Formats options in the
Paste area of the dialog, check all other options in that area, and click OK. You will see
the following message:
Figure 284: Linking sheets: pasting a formula to a cell range
6) Click Yes. You have now copied the formulas into each cell while maintaining the format
set up in the original sheet. Of course, in this example you would have to tidy up the
sheet by removing the zeros in the non-formatted rows.
Figure 285: Linking sheets: Copy / Paste Special from K7:N17
The Function Wizard can also be used to accomplish the linking. Use of this wizard is described
in detail in “Using the Function Wizard” on page 310.
306 | Calc Guide 26.2
Understanding functions
Calc includes over 500 built-in functions to help you analyze and reference data. Many of these
functions are for use with numbers, but 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, or 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. In Calc, functions can be entered either in upper, lower
or mixed cases.
A few basic functions are somewhat similar to operators. Examples:
+ (plus) This operator adds two numbers together for a result. SUM() on the other hand adds
groups of contiguous ranges of numbers together.
* (star) This operator multiplies two numbers together for a result. PRODUCT() does the
same for multiplying that SUM() does for adding.
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 text on
the Function Wizard and the Functions deck, or the Help, 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 in the spreadsheet. In Calc, you can enter values from other cells by typing in their
name or range, or—unlike the case in some spreadsheets—by selecting cells with the mouse. If
the values in the cells change, then the result of the function is automatically updated.
Tip
You can find more details about each of the available functions in the Calc Functions
area of The Document Foundation Wiki at
[Link] These wiki
pages are a recent addition to the available documentation and are continuously
undergoing improvement.
Compatibility with other spreadsheet applications
For many functions, Calc follows the OpenFormula standard defined in Part 2 (Recalculated
Formula (OpenFormula) Format) of the Open Document Format for Office Applications
(OpenDocument) Version 1.2. This standard can be accessed at the OASIS website
([Link] or the ISO website ([Link]
Calc’s general support for OpenFormula leads to a level of inherent compatibility with the
function set of any other spreadsheet application that follows the same standard. (There are
some functions within Calc that are not in accordance with OpenFormula but many of these are
included specifically to improve the exchange of files between Calc and Microsoft Excel.)
Calc can open spreadsheets created using many applications and can save spreadsheets in
many formats despite differences in the applications.
For example, calls to Excel’s CEILING function are converted to reference the [Link]
function when the Excel file is opened in Calc. Similarly, calls to Calc’s FLOOR function are
automatically converted to reference Excel’s [Link] function when the file is saved in
Calc.
The Document Foundation’s wiki offers a comparison of the features of LibreOffice and Microsoft
Office, which you can view here. According to this comparison, Calc currently provides 508
Chapter 9 Using Formulas and Functions | 307
discrete functions. Of these, only 30 are unique to Calc, while the rest have counterparts in
Microsoft Excel. This indicates a high level of commonality between the function sets of Calc and
Excel, allowing many functions to be used interchangeably, thus enhancing interoperability.
In some instances, a Calc function may produce a result that aligns with international standards
but differs from the result produced by the equivalent Excel function. In such cases, Calc often
includes a similarly named function with a modifier (such as “_ADD” or “_EXCEL2003”) to
provide the same result as the Excel function.
Structure of functions
All spreadsheet functions share a similar structure. While using tools like a Function Wizard can
simplify function entry, understanding the structure is valuable for troubleshooting.
Here’s an example of a function to count cells matching specific criteria:
=DCOUNT(Database, Database field, Search criteria)
Key points about function structure:
• Functions are part of formulas: A function cannot stand alone. It must always be
included in a formula, which begins with an = sign. Even if the function is the entire
formula, the = is required.
• Function name: The function starts with its name, such as DCOUNT in the example
above.
• Arguments: After the function name, the required inputs (arguments) are placed inside
parentheses, separated by commas.
About Arguments:
• Functions can accept up to 255 arguments.
• Arguments can be:
– Numbers
– Single cells
– Named ranges, ranges or arrays (containing multiple or even hundreds of cells).
The type and format of arguments depend on the specific function. Refer to Table 15 for details
on how arguments are entered based on the function's requirements.
Table 15: Entering function arguments
Argument Description
"text data" The quotes indicate text or string data is being entered.
9 The number nine is being entered as a number.
"9" The number nine is being entered as text.
A1 The address for whatever is in cell A1 is being entered.
B2:D9 The range of cells is being entered.
EMEA_Sales A named range, previously defined.
Nested functions
Functions can also be used as arguments within other functions. These are called nested
functions.
=SUM(2,PRODUCT(5,7))
308 | Calc Guide 26.2
To get an idea of what nested functions can do, imagine that you are designing a self-directed
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
have 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.
Using the Functions deck
A more reliable method is to use the Functions deck on the Sidebar (Figure 286), accessed by
selecting View > Function List or, if the Sidebar is already displayed, clicking the Functions
icon on the tab panel at the right of the Sidebar.
Calc provides many functions and the Functions deck provides a search facility. When you type
in the search box located at the top of the deck, the list of functions narrows on each character
inserted.
The Functions deck includes a brief description of each function and its arguments. Highlight the
function and look at the bottom of the pane to see the description. If necessary, hover the mouse
pointer over the division between the list and the description; when the pointer becomes a two-
headed arrow, drag it upwards to increase the space for the description. Double-click on a
function’s name to add it to the current cell, together with placeholders for each of the function’s
arguments.
Using the Functions deck is almost as fast as manual entry, and has the advantage of not
requiring that you memorize a formula that you want to use. In theory, it should also be less
error-prone. In practice, though, some users may fumble when replacing the placeholders with
values. Another feature is the ability to display the last formulas used.
Chapter 9 Using Formulas and Functions | 309
Figure 286: Functions deck in Sidebar
Using the Function Wizard
The most commonly used input method is the Function Wizard (Figure 287). To open it, choose
Insert > Function, or click the Function Wizard icon on the Formula Bar, or press Ctrl+F2.
The Function Wizard provides the same help features as the Functions deck, 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.
Figure 287: Functions tab of Function Wizard
To select a function by name, type the name in the search field. Checking the Similar checkbox
will show functions with names that partially match the search term (Figure 287). To browse,
select a category of functions to shorten the list, then scroll down through the named functions
and select one by double-clicking on it. The available categories within the Function Wizard, and
310 | Calc Guide 26.2
the number of functions available in each category, are given in Table 16. When you select a
function, its description appears on the right-hand side of the dialog.
Table 16: Function categories in the Function Wizard
Category Number of functions in category
Add-in 48
Array 15
Database 12
Date&Time 36
Financial 63
Information 21
Logical 11
Mathematical 82
Spreadsheet 22
Statistical 151
Text 47
The Function Wizard now displays an area to the right where you can enter data manually in text
boxes or click the Shrink button to shrink the Function Wizard so you can select cells from the
sheet.
Figure 288: Function Wizard after shrinking
To select cells, either click directly on the cell or hold down the left mouse button and drag to
select the required area.
When the area has been selected, click the Expand button to return to the wizard again.
If multiple arguments are needed click in the next text box and repeat the selection process for
the next cell or range of cells. Repeat this process as often as required. The wizard will accept
up to 255 ranges or arguments in the SUM function.
Click OK to accept the function, add it to the cell, and get the result.
Note
If you select a function by double-clicking it in the list, and then change your mind
and select a different one by double-clicking again, then the second choice formula is
added into the first choice formula in the Formula text box. You must clear the
Formula text box and then double-click the function to add it to the box.
This additive facility allows you to create complex formulas by building them up in the
Formula box.
You can also select the Structure tab to see a tree view of the parts of the formula. The main
advantage over the Functions deck is that each argument is entered in its own field, making it
easier to manage. The price of this reliability is slower input, but precision is generally more
important than speed when creating a spreadsheet.
Chapter 9 Using Formulas and Functions | 311
The structure view of the Function Wizard is important for debugging and fixing very long,
nested, and complex formulas. In this view, the formula is parsed, and each formula component
is calculated by a simpler function call or arithmetic operation and then combined following the
rules of calculation. It is possible to visualize each parsed element of the formula and check if
the intermediate results are correct, until the mistake is found.
Functions can be entered into the Input line. After you enter a function on the Input line, press
the Enter key or click the Accept button on the Formula Bar to add the function to the cell and
get its result.
Figure 289: The Formula Bar
(62) Name Box showing list of (64) Cancel
common functions (65) Accept
(63) Function Wizard (66) Input line
If you see the formula in the cell instead of the result, then Formulas is selected in the Display
section of the Tools > Options > LibreOffice Calc > View dialog. Deselect Formulas, and the
result will display. However, you can still see the formula in the Input line.
Tip
The menu option View > Show Formula and the Windows / Linux shortcut Ctrl+`
(grave accent) also toggle formulas on / off.
Array formulas
What is an array formula?
A formula in which the individual values in a cell range are evaluated is referred to as an array
formula. The difference between an array formula and other formulas is that the array formula
deals with several values simultaneously instead of just one.
Not only can an array formula process numerous values, but it can also return numerous values.
The result of an array formula is also an array.
When Calc updates the formulas, each affected cell is read and its formula is recalculated. If you
have a thousand cells in a column with the same formula (the formula expression only changes
the data to compute), you end with one thousand identical formulas to interpret and execute.
Array formulas will evaluate the formula once and execute calculations as many times as the
size of the array, thus saving the time used to interpret each cell formula. And because Calc
stores only one formula for the entire array of data cells, it also save space in the spreadsheet
file.
312 | Calc Guide 26.2
Figure 290: Source array (yellow), resulting array (green), with array formula in Formula Bar
To multiply the values in the individual cells by 10 in the above array (Figure 290), you do not
need to apply a formula to each individual cell or value. Instead, you just need to use a single
array formula. Select a range of 3 x 5 cells on another part of the spreadsheet, enter the formula
=10*A1:C5 and confirm this entry using the key combination Ctrl+Shift+Enter. The result is
a 3 x 5 array in which the individual values in the cell range (A1:C5) are multiplied by a factor of
10.
In addition to multiplication, you can also use other operators on the reference range (an array).
With Calc, you can add (+), subtract (-), multiply (*), divide (/), use exponents (^), concatenation
(&) and comparisons (=, <>, <, >, <=, >=). The operators can be used on each individual value in
the cell range and return the result as an array if the array formula was entered.
Comparison operators in an array formula treat empty cells in the same way as in a normal
formula, that is, either as zero or as an empty string. For example, if cells A1 and A2 are empty
the array formulas {=A1:A2=""} and {=A1:A2=0} will both return a 1 column 2 row array of
cells containing TRUE.
When do you use array formulas?
Use array formulas if you have to repeat calculations using different values. If you decide to
change the calculation method later, you only have to update the array formula. To add an array
formula, select the entire array range and then make the required change to the array formula.
Arrays are an essential tool for carrying out complex calculations, because you can have several
cell ranges included in your calculations. Calc has different math functions for arrays, such as
the MMULT function for multiplying two arrays.
Creating array formulas
If you create an array formula using the Function Wizard, you must mark the Array check box
each time so that the results are returned in an array (Figure 287). Otherwise, only the value in
the upper-left cell of the array being calculated is returned.
An array formula can also be entered directly into a cell. The result will automatically create an
array of cells.
Note
Array formulas appear in braces (curly brackets) in Calc. You cannot create array
formulas by manually entering the braces.
Note
The cells in a results array are automatically protected against changes. However,
you can edit or copy the array formula by selecting the entire array cell range.
Chapter 9 Using Formulas and Functions | 313
Implicit intersection of array formulas
You can also create a "normal" formula that uses a reference interval, as a parameter, without
being an array formula. This formula is also known as implicit intersection of an array formula.
The result is obtained from the intersection of the interval and the rows or columns in which the
formula is found.
If there is no intersection or if the interval at the intersection spans multiple rows or columns, a
#VALUE! error message appears. The following example will better illustrate this:
Figure 291: Implicit intersection of array formulas
The following steps utilize the values in cells A1:C3 of Figure 291.
1) In D1, Insert the following formula =A1:A3 + 100 and press Ctrl+Shift+Enter to
make the array formula.
2) Cells D1, D2, D3 will get the values 107, 195 and 105 respectively because an array
formula has been used.
3) Enter the formula =A1:A3 + 100 in E2, do not enter it as an array formula.
4) Since it is not an array formula, cells E1 and E3 are left empty but cell E2 gets the value
195. This result is the implicit intersection of the array formula.
5) Retype the normal formula =A1:A3 + 100 in E4. The message #VALUE! will appear in
cell E4, since row 4 is outside the range used in formula A1:A3.
Strategies for creating formulas and functions
Formulas that do more than a simple calculation or summation of rows or columns of values
usually take a number of arguments. For example, consider the following equation:
1
x=x i +v i t + at 2
2
This equation models the position of an object undergoing linear, translation motion, with
constant acceleration. The position (x) depends on time (t), and the equation also contains
constant values for initial position (xi), initial velocity (vi), and acceleration (a).
For ease of presentation, it is good practice to set up a spreadsheet in a manner similar to that
shown in Figure 292. In this example, the individual variables are input into cells on the sheet
and no editing of the formula is required.
314 | Calc Guide 26.2
Figure 292: Setting up a formula with arguments
You can take several broad approaches when creating a formula. In deciding which approach to
take, consider how many other people will need to use the sheets, the life of the sheets, and the
variations that could be encountered in use of the formula.
If people other than yourself will use the spreadsheet, make sure that it is easy to see what input
is required and where. Explanation of the purpose of the spreadsheet, basis of calculation, input
required and output generated are often placed on the first sheet.
A spreadsheet that you build today, with many complicated formulas, may not be quite so
obvious in its function and operation in 6 or 12 months. Use comments and notes liberally to
document your work. It is also a good idea to trap errors, as other users of the spreadsheet may
be unaware of input limitations for a particular argument, for example. By using some form of
logic statements or conditional formatting to trap errors, other users won’t be subjected to vague
standard error messages.
Place a unique formula in each cell
The most basic strategy is to view whatever formulas are needed as simple and with a limited
useful life. The strategy is then to place a unique formula in each appropriate cell. This is
recommended only for very simple or “throw away” (single use) spreadsheets.
Break formulas into parts and combine the parts
The second strategy is similar to the first, except that you break down longer formulas into
smaller parts and then combine the parts into the whole. Many examples of this type exist in
complex scientific and engineering calculations where interim results are used in a number of
places in the sheet. For example, the calculated flow velocity of water in a pipe may be used to
estimate losses due to friction, volume of water in the pipe, and optimal pipe diameter for the
given flow regime.
In all cases you should adopt the basic principles of formula creation described previously.
Optimizing calculations
Spreadsheets are often used to process raw data, generate meaningful summaries, consolidate
information, and present it in a format that aids decision-making or serves as the basis for
reports. Raw data may come from various sources, such as physical measurements or business
transactions.
Large spreadsheets with thousands or even hundreds of thousands of rows and multiple
columns are common in fields like finance and research. Performing computations on such
datasets can be time-consuming, taking minutes, hours, or even days.
Chapter 9 Using Formulas and Functions | 315
One common mistake is inserting formulas into every cell, resulting in thousands of formula
interpretations and calculations. This significantly slows down processing. To improve
performance, consider the recommendations below for speeding up calculations.
Use array formulas on massive data
Array formulas have one formula applied to the mass of data. Computation saving can be
significant for large data sets.
Use consolidation functions
Consolidation functions perform calculations on data sets. SUM, SUMIF, SUMIFS,
SUMPRODUCT are examples of consolidation functions. For example if you have a very long
bill of materials (BOM), where quantity must be multiplied by unit price and then totaled to
produce a cost figure, then instead of applying a formula on each entry of the BOM and then
summing, you can use the formula SUMPRODUCT(quantity, unitprice), where quantity and
unitprice are named ranges representing the BOM. SUMPRODUCT multiplies each cell of the
quantity data set by its corresponding cell of unitprice and sums all the products.
Similar situations happen when you must sum a subset of the original data set, where you must
apply a test on each entry to allow it to be part of the sum. For example, when the value is
strictly positive. Use SUMIF(data_to_test;”>0”;data_to_sum), where data_to_test is the
data set where you test the positive values, data_to_sum is the column where the values are to
sum depending on the test, and “>0” is the test itself.
Other consolidation functions are AVERAGEIF, COUNTIF, MINIFS, MAXIFS, and more.
Using Custom Functions and Macros
Creating custom functions and macros can be a powerful strategy for streamlining spreadsheet
use and simplifying formulas. This approach is especially useful when it makes the spreadsheet
easier for end users and reduces the likelihood of errors. Additionally, maintaining such a setup
becomes more efficient, as updates or corrections can be managed in one central location.
However, overreliance on macros and custom functions has its drawbacks. The underlying logic
and principles of the spreadsheet can become harder to understand, especially for someone
other than the original creator—or even for the creator after some time.
Macros are a specialized topic, and their use is covered in detail in Chapter 14.
Multi-threading
Multi-threading is enabled by default to take advantage of the parallel processing power of
modern computers. While disabling multi-threading is not recommended, the setting (Enable
multithreaded calculation) can be found in the CPU Threading Settings section of the Tools >
Options > LibreOffice Calc > Calculate dialog. When enabled, Calc automatically identifies
where your spreadsheet could benefit from multi-threading and processes it accordingly.
Threads are generally used for formula groups, where enough adjacent cells in a column use the
same formula but get different results because of relative cell addressing. One implication of this
approach is that the optimization is column-based and so a row-based layout could be less
efficient. Other methods of controlling Calc’s multi-threading capability, such as adjusting the
MAX_CONCURRENCY environment variable, are beyond the scope of this document.
Investigating and Resolving Formula Errors
Errors in formulas are a common occurrence in spreadsheets, even with the many tools Calc
provides to assist with formula entry. Mistakes can happen when inputting numbers or using
316 | Calc Guide 26.2
incorrect types of arguments for a function. In addition to correcting these errors, you may need
to identify the cells used in a formula to adjust their values or verify the results.
Calc offers three key tools to help investigate formulas and the cells they reference:
1) Error messages: These provide information about issues in formulas.
2) Color coding: Highlights referenced cells for easier identification.
3) The Detective tool: Helps trace relationships between cells and identify errors.
Error messages
The most basic tool is error messages. Error messages display in a formula’s cell, on the Status
Bar, or in the Function Wizard instead of the result.
An error message for a formula is usually a three-digit number from 501 to 540, or sometimes
vague text such as #NAME?, #REF!, or #VALUE!. The error message appears in the cell, and a
brief explanation of the error is shown 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.
While error messages are not intuitive, they do provide clues that can help the user to correct
mistakes. You can find detailed explanations of them in Appendix B, Error Codes, and in the
Help, by searching for “error codes” in Calc. A few of the most common are shown in Table 17.
Table 17: Common error messages
Code Meaning
#NAME? Instead of displaying Err:525. No valid reference exists for the argument.
Instead of displaying Err:524. The column, row, or sheet for the referenced cell
#REF!
is missing.
Instead of displaying Err:519. The value for one of the arguments is not the type
that the argument requires. The value may be entered incorrectly; for example,
#VALUE!
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.
#DIV/0! Instead of displaying Err:532. Division by zero.
Instead of displaying Err:503. A calculation results in an overflow of the defined
#NUM!
value range.
509 An operator such as an equals sign is missing from the formula.
510 A variable is missing from the formula.
Examples of common errors
#DIV/0! division by zero
This error occurs when dividing a number by either zero (0) or a blank cell. To avoid this issue,
you can use a conditional function to handle cases where a zero or blank cell appears. For
example, Figure 293 illustrates a division of values in column B by values in column C, resulting
in two errors caused by a zero and a blank cell in column C.
Errors like these are common when data is missing or incorrectly reported. To address this, an
**IF function** can ensure proper handling of such cases. For instance, you can use the formula:
=IF(C3>0, B3/C3, "No Report")
Chapter 9 Using Formulas and Functions | 317
This formula means: "If the value in C3 is greater than 0, divide B3 by C3; otherwise, display 'No
Report'". After entering the formula in the first row of column D, copy it down the remainder of
the column. An example is shown in Figure 294.
Alternatively, the formula can be adjusted to return a blank cell (using double quotes `""`) or to
substitute a specific standardized number for the missing or invalid value.
Figure 293: Examples of #DIV/0!, division by zero error
Figure 294: Division by zero solution
#VALUE! no result and #REF! incorrect references
The #VALUE! error is also very common.
A common occurrence of this error arises when a cell contains an incorrect value type. In the
example of Figure 295, text “None” has been entered in C8, where our formula in column D is
expecting a number.
Figure 295: Incorrect entry causing #VALUE! error
318 | Calc Guide 26.2
The #REF! error is caused by a missing reference. In the example shown in Figure 296, the
formula references a sheet that has been deleted.
Figure 296: Deleted sheet causing #REF! error
Color coding for input
Another useful tool when reviewing a formula is the color coding for input. When you select a
formula that has already been entered, the cells or ranges used for each argument in the
formula are outlined in color.
Figure 297: Color coding for input
Calc uses eight colors for outlining referenced cells, starting with blue for the first cell, and
continuing with red, magenta, green, dark blue, brown, purple, and yellow before cycling through
the sequence again.
Value highlighting
There are situations where the display of cell contents is the same when the data type is
different. For example, text contents and numeric contents can look the same but can produce a
mistake if both are used in some calculations. To illustrate, the string “10.35” right-aligned in a
cell can be confused with the value 10.35. When the cell is used in a formula the string may take
the value of zero and an error may be produced.
If you enable value highlighting (View > Value Highlighting or Ctrl+F8), Calc distinguishes the
text and numeric data types by assigning different colors to the content’s characters. By default,
the text contents are in black characters and the numeric contents are in blue. See Chapter 2,
Entering and Editing Data, for more information on value highlighting.
The Detective
In a long or complicated spreadsheet, color coding becomes less useful. In these cases,
consider using 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 function’s argument), or even for
removing precedents and dependents.
To use the Detective, select a cell with a formula, then select the required option in the Tools >
Detective menu. On the spreadsheet, you will see lines ending in dots 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 on the Menu bar or
press Shift+F9. Figure 298 shows a simple example of tracing precedents for cell B4.
Chapter 9 Using Formulas and Functions | 319
This allows us to check the source cells (which may be a range) for any errors which have
caused us to query the calculation result. If a source is a range, then that range is highlighted in
blue.
Figure 298: Tracing precedents using the Detective
In other instances we may have to trace an error. For this we use the Trace Error function, found
under Tools > Detective > Trace Error, to find the cells that caused the error.
For more information search for “Detective” in the Help system’s index.
Examples of functions
For beginners, functions can be one of the most intimidating aspects of LibreOffice Calc. While
new users quickly recognize that functions are a key feature of spreadsheets, the sheer number
of available functions—many requiring specialized knowledge or specific inputs—can feel
overwhelming. Thankfully, Calc offers a wide range of functions that are simple and accessible,
even for novice users.
Basic arithmetic and statistics
The most basic functions create formulas for basic arithmetic or for evaluating numbers in a
range of cells.
Basic arithmetic
The simple arithmetic functions are addition, subtraction, multiplication, and division. Except for
subtraction, each of these operations has its own function:
• SUM for addition
• PRODUCT for multiplication
• QUOTIENT for division
SUM, PRODUCT, and QUOTIENT are useful for entering ranges of cells in the same way as any
other function, with arguments in brackets after the function name.
However, for basic equations, many users prefer the time-honored computer symbols for these
operations, using the plus sign (+) for addition, the hyphen (–) for subtraction, the asterisk (*) for
multiplication and the forward slash (/) for division. These symbols are quick to enter without
requiring your hands to stray from the keyboard.
A similar choice is also available if you want to raise a number by the power of another. Instead
of entering =POWER(A1,2), you can enter =A1^2.
Moreover, they have the advantage that you enter formulas with them in an order that more
closely approximates human-readable format than the spreadsheet-readable format used by the
equivalent function. For instance, instead of entering =SUM(A1:A2), or possibly =SUM(A1,A2),
you enter =A1+A2. This almost-human readable format is especially useful for compound
operations, where writing =A1*(A2+A3) is briefer and easier to read than
=PRODUCT(A1,SUM(A2:A3)).
320 | Calc Guide 26.2
The main disadvantage of using arithmetical operators is that you cannot directly use a range of
cells. In other words, to enter the equivalent of =SUM(A1:A3), you would need to type
=A1+A2+A3.
Otherwise, whether you use a function or an operator is largely up to you—except, of course,
when you are subtracting. However, if you use spreadsheets regularly in a group setting such as
a class or an office, you might want to standardize on an entry format so that everyone who
handles a spreadsheet becomes accustomed to a standard input.
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 you are 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 also
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 students were
absent when a test was written, and you wanted to check whether 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 of functions to choose from. You can
find the arithmetical mean—that is, the result when you add all entries in a list then divide by the
number of entries, by entering a range of numbers when using AVERAGE, or AVERAGEA to
include text entries and to give them a value of zero.
In addition, you can get other information about the data set:
• MEDIAN: Logically ranks the numbers (lowest to highest) to evaluate the median value.
In a set containing an uneven number of values, the median will be the number in the
middle of the ranked list. In a set containing an even number of values, the median will
be the mean of the two values in the middle of the ranked list.
• MODE: The most common entry in a list of numbers.
• QUARTILE: The entry at a set position in the array of numbers. Besides the cell range,
you enter the type of quartile: 0 for the lowest entry, 1 for the value of 25%, 2 for the
value of 50%, 3 for 75%, and 4 for the highest entry. Note that the result for types 1
through 3 may not represent an actual item entered.
• 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
Chapter 9 Using Formulas and Functions | 321
entries, and the type of rank (0 for the rank from the highest, or any other value for the
rank from the bottom).
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. Some users prefer to use
MIN and MAX because they are easy to remember, while others prefer QUARTILE because it is
more versatile.
Using these functions
In some cases, you can achieve similar results to certain functions by using filters or custom
sorting. However, functions are generally more flexible and easier to adjust, offering a broader
range of possibilities.
Sometimes, you might want to temporarily enter one or more formulas in a blank cell for quick
calculations and delete them afterward. However, if you frequently use the same functions,
consider creating a template with designated spaces for those functions. Add labels to the cells
to the left of each formula for clarity. Once your template is set up, you can easily update
formulas as data changes—either automatically or by pressing F9 to refresh all selected cells.
No matter how you use functions, you’ll likely find them simple and adaptable for many tasks.
Once you’re comfortable with these basic functions, you’ll be ready to explore more advanced
options.
Rounding off numbers
For statistical and mathematical purposes, Calc includes a variety of ways to round off numbers.
If you are a programmer, you may also be familiar with some of these methods. However, you do
not need to be a specialist to find some of these methods useful. You may want to round off for
billing purposes, or because decimal places do not translate well into the physical world. For
instance, if the parts you need come in packages of 100, then the fact you only need 66 is
irrelevant to you; you need to round up for ordering. By learning the options for rounding up or
down, you can make your spreadsheets more immediately useful.
When you use a rounding function, you have two choices about how to set up your formulas. If
you choose, you can nest a calculation within one of the rounding functions. For instance, the
formula =ROUND((SUM(A1,A2)) adds the figures in cells A1 and A2, then rounds them off to the
nearest whole number. However, even though you do not need to work with exact figures every
day, you may still want to refer to them occasionally. If that is the case, then you are probably
better off separating the two functions, placing =SUM(A1,A2) in cell A3, and =ROUND(A3) in A4,
and clearly labeling each function.
For details on rounding methods, see the Help.
Volatile / non-volatile functions
The Open Document Format for Office Applications (OpenDocument) Version 1.3 includes the
following definition: “Functions that are always recalculated whenever a recalculation occurs are
termed volatile functions.”
To understand some of the behaviors of a volatile function within Calc, consider a simple
example in which you have created an empty spreadsheet and entered the formula =RAND()
into cell A1 (RAND is one of Calc’s volatile functions). Calc displays a random number between
0 and 1 in cell A1. If you then enter any value into a different cell (say cell B2 for the purpose of
this discussion) and press Enter, you will notice that the value displayed in A1 is updated to
show a different random number. Calc recalculates the random number in A1, despite the user
not changing the formula in A1 and despite the updated B2 having no link to A1. In summary, the
322 | Calc Guide 26.2
RAND function will generate a new value when any cell is updated by selecting Data >
Calculate > Recalculate or pressing F9, or on any input event.
An understanding of volatile functions is important especially if you create a large spreadsheet,
where frequent recalculations may adversely affect performance. Make sure that you design
your spreadsheet to use volatile functions appropriately.
The following Calc functions are volatile:
• FORMULA
• INDIRECT
• INFO
• NOW
• OFFSET
• RAND
• RANDBETWEEN
• TODAY
For the RAND and RANDBETWEEN functions, Calc provides non-volatile equivalents –
[Link] and [Link]. These may be useful when you do not require the function
values to update so frequently. A non-volatile function is not recalculated at new input events and
does not recalculate when selecting Data > Calculate > Recalculate or pressing F9, except
when the cell containing the function is selected. Non-volatile functions are recalculated when
opening the file.
Using wildcards and regular expressions in functions
Calc supports the use of regular expressions or wildcards in the arguments of many of its
functions.
Regular expressions offer the most powerful method of searching for text strings. For more
information about regular expressions, including examples, see the “Searching and filtering with
regular expressions” section in Chapter 2, Entering and Editing data.
If maintaining compatibility with Microsoft Excel is important for your spreadsheet, you may need
to limit your use of Calc’s regular expression features, as Excel does not support equivalent
functionality. When you export a Calc spreadsheet to Excel format, any data relying on regular
expressions will not work in Excel.
To ensure compatibility, you can use Calc’s less powerful wildcard feature instead. Wildcards are
special characters that represent one or more unspecified characters, making text searches
more flexible but often less precise. Spreadsheets using wildcards can be exported to Excel
format without losing functionality.
The available wildcards are:
• ? (question mark) to represent a single character.
• * (asterisk) to represent any number of characters.
• ~ (tilde) to escape wildcard characters if they are part of the actual text.
The usage of these wildcards is the same as described in the Find and Replace dialog covered
in Chapter 2, Entering, Editing, and Formatting Data.
Chapter 9 Using Formulas and Functions | 323
The following Calc functions allow the use of wildcards or regular expressions:
• Database functions (DAVERAGE, DCOUNT, DCOUNTA, DGET, DMAX, DMIN,
DPRODUCT, DSTDEV, DSTDEVP, DSUM, DVAR, DVARP)
• AVERAGEIF, AVERAGEIFS, COUNTIF, COUNTIFS, MAXIFS, MINIFS, SUMIF,
SUMIFS
• HLOOKUP, LOOKUP, VLOOKUP
• MATCH
• REGEX (not applicable for wildcards)
• SEARCH
Configuration options are available in the Formulas wildcards section on the Tools > Options >
LibreOffice Calc > Calculate dialog (Figure 299) to control the use of wildcards and regular
expressions with Calc’s functions. The three mutually exclusive, self-explanatory options are:
• Enable wildcards in formulas. This is the initial default when Calc is installed.
• Enable regular expressions in formulas.
• No wildcards or regular expressions in formulas.
A further related option in the General Calculations area of the same dialog, Search criteria =
and <> must apply to whole cells, controls whether search criteria must match the whole cell
exactly.
Tip
When both the Search criteria = and <> must apply to whole cells and Enable
wildcards in formulas options are selected, Calc behaves exactly as Microsoft
Excel when searching cells in the database functions.
By default, regular expression searches within Calc functions are case-insensitive,
irrespective of the setting of the Case sensitive checkbox. However, for some
functions regular expressions can include a flag option “(?-i)” to switch to a case-
sensitive match. Functions that support this facility are: AVERAGEIF, AVERAGEIFS,
COUNTIF, COUNTIFS, HLOOKUP, LOOKUP, MATCH, SEARCH, SUMIF, SUMIFS,
and VLOOKUP.
324 | Calc Guide 26.2
Figure 299: Tools > Options > LibreOffice Calc > Calculate dialog
To illustrate some of the features of regular expressions, consider the simple spreadsheet shown
in Figure 300 and assume that Enable regular expressions in formulas is selected.
Figure 300: Using the COUNTIF function
1) With the formula =COUNTIF(A1:A6,”r.d”) entered in cell A7 and Search criteria =
and <> must apply to whole cells deselected, the value 5 is displayed in cell A7, as
shown in Figure 300. The formula counts cells in the range A1:A6 which contain “Fred”,
“red”, “ROD”, “bride”, and “Ridge”.
2) With the formula =COUNTIF(A1:A6,”(?-i)r.d”) entered in cell A7 and Search
criteria = and <> must apply to whole cells deselected, the value 3 is displayed in
cell A7. The formula counts cells in the range A1:A6 which contain “Fred”, “red”, and
“bride”. This regular expression utilizes the “(?-i)” flag option to perform a case-sensitive
search.
3) With the formula =COUNTIF(A1:A6,”r.d”) entered in cell A7 and Search criteria =
and <> must apply to whole cells selected, the value 2 is shown in cell A7. The
formula counts cells in the range A1:A6 which contain “red” and “ROD”.
4) With the formula =COUNTIF(A1:A6,”(?-i)r.d”) entered in cell A7 and Search
criteria = and <> must apply to whole cells selected, the value 1 is shown in cell A7.
The formula counts cells in the range A1:A6 which contain “red”. This regular
expression utilizes the “(?‑i)” flag option to perform a case-sensitive search.
Chapter 9 Using Formulas and Functions | 325
5) With the formula =COUNTIF(A1:A6,".*r.d.*") entered in cell A7 and Search criteria
= and <> must apply to whole cells selected, the value 5 is again shown in cell A7.
Contrast this with example 3) above – the regular expression in the current example
allows for 0 or more characters both before the “r” and after the “d”.
Regular expressions cannot be used directly in simple comparisons. For instance, the formula
A1="r.d" will always return FALSE if cell A1 contains "red," even if regular expressions are
enabled. It will only return TRUE if A1 contains "r.d" (with "r," a dot, and "d").
To test for regular expressions, use the COUNTIF function instead. For example:
COUNTIF(A1, "r.d")
This will return 1 if a match is found and 0 if not, which can be interpreted as TRUE or FALSE in
formulas. For instance:
=IF(COUNTIF(A1, "r.d"), "hooray", "boo")`
When the Enable regular expressions in formulas option is activated, all functions will require
regular expression special characters (such as parentheses) within strings to be preceded by a
backslash (`\`), even if they are not part of a regular expression. If this setting is later
deactivated, the backslashes will need to be removed to avoid errors.
Advanced functions
As is common with other spreadsheet programs, Calc can be enhanced by user-defined
functions or add-ins. Setting up user-defined functions can be done either by using macros or by
writing separate add-ins or extensions.
The basics of writing and running macros is covered in Chapter 14, 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 macros can be written in Basic, BeanShell,
JavaScript, or Python.
326 | Calc Guide 26.2
Calc Guide 26.2
Chapter 10
Using Pivot Tables
Introduction
Many spreadsheet support requests stem from using overly complex formulas to address
simple, everyday tasks. For a more efficient and effective approach, consider using pivot tables.
A pivot table is a summarized table that compiles groups of individual values from a larger table
(like those found in a database, spreadsheet, or business intelligence software) organized into
one or more distinct categories. The summarized data can include calculations such as totals,
averages, counts, or other statistical measures. Essentially, a pivot table represents the result of
analyzing raw data that is arranged in a table format and can aid in making informed decisions.
With pivot tables, you can:
• Generate different summaries of your source data.
• Drill down into specific details of interest.
• Create detailed reports, regardless of your skill level—beginner, intermediate, or
advanced.
Additionally, pivot charts can be created from pivot tables to provide a clear graphical
representation of the data.
Figure 301 shows an example of a pivot table summarizing the number of cars in branch BB and
in different departments of a multi-branch car dealer, The source data is shown in Figure 302:
Figure 301: Pivot table example of a car dealer
Database preconditions
To use a pivot table, you need a list of raw data structured like a database table, with rows
representing data sets and columns representing data fields. The field names should be in the
first row above the data.
The data source can come from an external file or database. If the data is already within a Calc
spreadsheet, simpler sorting functions may suffice without the need for a pivot table.
Calc’s automatic recognition of data
To process data in lists, Calc needs to identify where the list is located within the spreadsheet.
Lists can appear anywhere on the sheet and multiple unrelated lists can coexist.
Calc automatically detects your lists using the following logic:
1) Starting from the currently selected cell (which must be within the list), Calc scans in all
four directions—left, right, up, and down.
2) It identifies the list boundaries when it encounters an empty row or column or reaches
the spreadsheet's edges (Figure 302).
For these functions to work correctly:
• Ensure there are no empty rows or columns within the list.
328 | Calc Guide 26.2
• Avoid using empty rows for formatting purposes. Instead, apply formatting directly to the
cells within the list.
Tip
To make sure that Calc automatically recognizes a list correctly, check that there are
no empty rows or empty columns within the list.
Figure 302: Automatic list selection with cursor in cell B7
If you select more than one cell before creating a pivot table, then Calc’s automatic list
recognition logic is not applied. Instead, Calc assumes that the pivot table is to be created using
exactly the cells that you selected.
Tip
Always select only one cell before initiating creation of a pivot table. This allows Calc
to automatically determine the full scope of your data list.
A common source of errors occurs when a list is unintentionally defined and then sorted. For
example, selecting multiple cells—such as an entire column—can result in sorting that misaligns
data that should remain together within rows.
Beyond these technical considerations, maintaining the logical structure of the list is equally
crucial.
Note
Calc lists must have the normal form; that is, they must have a simple linear
structure.
When entering data, avoid adding outlines, groups, or summaries. Here are common mistakes
often made by inexperienced spreadsheet users:
• Creating unnecessary sheets: For example, using separate sheets for each group of
items. This limits analyses to individual groups and makes cross-group analysis difficult.
• Using multiple columns for similar data: For instance, in a sales list, creating
separate columns for each employee's sales instead of a single column for all amounts.
Chapter 10 Using Pivot Tables | 329
This structure complicates data grouping and prevents effective analysis with pivot
tables. To enable proper analysis, all related data should be in the same column.
• Including summary rows in chronological data: For example, adding a total row at
the end of each month. This prevents the list from being sortable by different criteria
since pivot tables treat summary rows as regular data. Instead, use the pivot table's
built-in features to quickly generate monthly summaries.
Data sources
The possible data sources for the pivot table are a Calc spreadsheet or an external data source
that is registered in LibreOffice.
Calc spreadsheet
Analyzing a list in a Calc spreadsheet is the simplest and most often used case. Lists might be
updated regularly, or the data might be imported from a different application.
The list data might be entered directly into the spreadsheet or copied from another file or
application. You can also use a Web Page Query input filter to insert data from an HTML file, a
CSV file, a Calc spreadsheet, or a Microsoft Excel spreadsheet. See Chapter 12, Linking Data,
for more information.
The behavior of Calc while inserting data from a different application 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 format, the Text Import dialog appears after you select the file
containing the data. See Chapter 1, Introduction, for more information about this dialog.
Registered data source
A registered data source is a connection to data held in a database outside of the spreadsheet
document. When using a registered data source, the data to be analyzed will not be saved in the
spreadsheet; Calc will always use the data from the original source. Calc can use many data
sources in addition to databases that are created and maintained with LibreOffice Base. For
more information, see Chapter 12, Linking Data.
Using shortcuts
If you frequently use pivot tables in Calc, navigating through the built-in menu paths might feel
inconvenient.
To streamline your workflow, consider the following options:
• Built-in keyboard shortcuts: Some shortcuts are predefined, such as the F12 key,
which groups a selected data range. Refer to Appendix A, Keyboard Shortcuts, for a full
list.
• Toolbar icons: The standard toolbar includes icons for tasks like inserting or editing
pivot tables, making these actions more accessible.
Additionally, you can create custom keyboard shortcuts and toolbar icons to suit your needs. For
instructions, see Chapter 16, Setting up and Customizing.
Creating a pivot table
If you want Calc to automatically determine the full extent of the raw data list, then select a
single cell within this list. If you want to explicitly define the extent of the raw data list, then select
only the relevant cells.
After making a selection, create the pivot table in one of three ways:
• Use Insert > Pivot Table on the Menu bar.
330 | Calc Guide 26.2
• Use Data > Pivot Table > Insert or Edit on the Menu bar.
• Click the Insert or Edit Pivot Table icon on the Standard toolbar.
Calc displays the Select Source dialog (Figure 303), where you can choose between using the
selected data cells, a range of cells that has already been named, or a data source that has
already been registered with LibreOffice.
Note
See Chapter 15, Calc as a Database, for more information about named ranges. See
Chapter 12, Linking Data, for more information about linking to registered data
sources.
Figure 303: Select Source dialog
Click OK on the Select Source dialog to display the Pivot Table Layout dialog, which is described
in the next section.
The Pivot Table Layout dialog
The pivot table's functionality is controlled in two main areas: the Pivot Table Layout dialog and
direct manipulations of the resulting table within the spreadsheet. This section provides a
detailed explanation of the Pivot Table Layout dialog.
Tip
To access the Pivot Table Layout dialog again after initial creation of a pivot table,
left-click in any cell of the pivot table. Then select Insert > Pivot Table on the Menu
bar, or select Data > Pivot Table > Insert or Edit on the Menu bar, or click the
Insert or Edit Pivot Table icon on the Standard toolbar, or right-click in any cell of
the pivot table and select the Properties option in the context menu.
Basic layout
The Pivot Table Layout dialog (Figure 304) organizes the resulting pivot table into four key areas:
Filters
Column Fields
Row Fields
Data Fields
Additionally, there is an Available Fields area that lists the fields from the source data. To design
the layout, simply drag fields from the Available Fields area and drop them into the desired
section.
Chapter 10 Using Pivot Tables | 331
The Data Fields area must include at least one field, though advanced users can add multiple
fields. Fields in this area use an aggregate function by default. For example, dragging the Sales
Value field into the Data Fields area will initially display it as Sum – Sales Value.
Figure 304: Pivot Table Layout dialog
Row and column fields indicate from which groups the result will be sorted. Often more than one
field is used at a time to get partial sums for rows or columns. The order of the fields gives the
order of the sums from overall to specific.
For example, if you drag Region and Employee into the Row Fields area, the sum will be
divided into the regions. Within the regions will be the listing for the different employees
(Figure 305).
Figure 305: Field order for analysis and resulting layout of pivot table
Fields that are placed into the Filters area appear at the top of the resulting pivot table as a drop-
down list. The summary in the result takes into account only that part of the base data that you
have selected. For example, if you include Employee in the Filters area, you can filter the result
shown for each employee.
To move a field from an area, just drag it to a new area. To remove a field from the Filters,
Column Fields, Row Fields, or Data Fields areas, drag it to the Available Fields area.
332 | Calc Guide 26.2
Tip
To rapidly move a selected field from one area of the Pivot Table Layout dialog to
another, press the Alt+letter on the keyboard that corresponds to the underlined
letter in the target area’s label.
Note
By default, Calc inserts a Data field into the Column Fields area. The Data field can
be moved between the Column Fields and Row Fields areas as required. Depending
on its position within the list of fields in its area, the Data field may lead to a button
labeled Data appearing in the results of the pivot table, affecting the layout of the
results. If you do not wish to use this facility, simply place the Data field at the bottom
of the list of fields in its area.
More options
Expanding the options section of the Pivot Table Layout dialog reveals the following options for
working with pivot table layouts:
• Ignore empty rows
• Identify categories
• Total columns
• Total rows
• Add filter
• Enable drill to details
• Show expand/collapse buttons
Each of these options is shown in Figure 306 and described in the sections that follow.
Figure 306: Expanded area of the Pivot Table Layout dialog
Ignore empty rows
If the source data is not in the recommended form, this option tells the pivot table to
ignore empty rows.
Chapter 10 Using Pivot Tables | 333
Identify categories
With this option selected, if the source data has missing entries in a list and does not
meet the recommended data structure (as in Figure 307 for example), the pivot table
adds it to the listed category above it. If this option is not chosen, then the pivot table
inserts (empty).
Figure 307: Example of data with missing entries in Column A
The option Identify categories ensures that in this example rows 3 and 4 are included
for Apples and that row 6 is included for Pears (Figure 308).
Figure 308: Pivot table result with Identify categories selected
Without category recognition, the pivot table shows an (empty) category (Figure 309).
Figure 309: Pivot table result without Identify categories selected
Logically, the behavior with category recognition is better. A list showing missing entries
is also less useful because you cannot use functions such as sorting or filtering.
Total columns, Total rows
With these options, you can decide if the pivot table shows an extra row with the sums
of each column, or if it adds on the very right a column with the sums of each row. In
some cases, an added total sum is meaningless, for example, if the entries are
accumulated or the result of comparisons.
Add filter
Use this option to add or hide the cell labeled Filter above the pivot table results. This
conveniently provides additional filtering options within the pivot table. For more
information, see “Filtering” below.
Note
The filtering provided through the Add filter option is independent of the filtering
provided by including fields in the Filters area of the Pivot Table Layout dialog.
334 | Calc Guide 26.2
Enable drill to details
With this option enabled, if you double-click on a single data cell in the pivot table result,
including a cell produced from Total columns or Total rows, a new sheet opens giving
a detailed listing of the individual entry. If you double-click on a cell in either a row or
column field area, the Show Detail dialog opens (Figure 343). If this function is disabled,
the double click will keep its usual edit function within a spreadsheet. For more
information, see “Drilling” below.
Show Expand / Collapse buttons
Inserts toggle buttons to field labels to make pivot tables with compact layout more
usable. Such buttons are also available if other layouts are used.
Source and Destination
Expanding the Source and Destination section of the Pivot Table Layout dialog reveals fields for
changing the source and destination.
Source
The Selection field in this area shows the sheet name and the range of cells containing
the raw data for the pivot table. If the source spreadsheet contains any named ranges,
these can be selected through the Named range option.
Destination
The controls in this area define where the result will be shown.
Selecting New sheet adds a new sheet to the spreadsheet file and places the results
there. The new sheet is named using the format Pivot Table_sheetname_X; where X
is the number of the table created, 1 for first, 2 for the second, and so on. For a sheet
named Sales List, the new sheet for the first pivot table produced would be named
Pivot Table_Sales List_1. Each new sheet is inserted next to the source sheet.
If the target spreadsheet contains any named ranges, these can be selected with the
Named range option.
The Selection field in this area shows the sheet name and the range of cells for the
pivot table’s results.
Tip
To display the pivot table on the same sheet as the raw data, check the Selection
option in the Destination area, click the Shrink button to the right of the Selection
field, click at an appropriate cell in an empty area of the sheet, click the Expand
button, and click OK on the Pivot Table Layout dialog.
Field Settings
Settings can be changed for any field that is currently included in the pivot table layout. To
change the settings, simply double-click the field within the Pivot Table Layout dialog.
Options for data fields
The options available for fields in the Data Fields area (Figure 310) differ from those for fields in
the other three areas. In the Data Field dialog, you can select the function to be used to
accumulate the values from the data source. The frequently used Sum function and other lesser
used functions like standard deviation and counting function are available in the dialog.
Select the Show items without data option to include empty columns and rows in the results
table.
Chapter 10 Using Pivot Tables | 335
Click the expansion symbol (plus sign or triangle) to expand the Displayed value section of the
dialog.
Figure 310: Expanded dialog for a data field
In the Displayed value section, you can choose other possibilities for analysis using the
aggregate function. Depending on the setting for Type, you may have to select definitions for the
Base field and Base item.
Figure 311: Example choices for Base field and Base item
Table 18 lists the possible types of displayed value and associated base field and base item,
together with notes on usage.
Table 18: Description of Displayed value options on the Data Field dialog
Type Base field Base item Analysis
Simple use of the chosen aggregate
Normal — —
function (for example, Sum).
336 | Calc Guide 26.2
Type Base field Base item Analysis
The result is the difference between the
result of the base field and the base
Selection of a Selection of an item (for example, sales volume of the
field from the element from other employees against the sales
data source of the selected volume of Brigitte; see Figure 312).
Difference from
the pivot table base field (for If previous item or next item is
(for example, example, specified as the Base item, the
Employee). Brigitte) reference value is the result for the next
visible member of the base field, in the
base field’s sort order.
The result is a percentage ratio of the
value of the base field to the base item
Selection of a Selection of an (for example, sales result of the other
field from the element from employees relative to the sales result of
data source of the selected Brigitte; see Figure 313).
% of
the pivot table base field (for If previous item or next item is
(for example, example, specified as the Base item, the
Employee) Brigitte) reference value is the result for the next
visible member of the base field, in the
base field’s sort order.
From each result, its reference value is
subtracted, and the difference is
divided by the reference value (for
Selection of a Selection of an
example, sales of the other employees
field from the element from
as a relative difference from the sales
% difference data source of the selected
of Brigitte; see Figure 314).
from the pivot table base field (for
If previous item or next item is
(for example, example,
specified as the Base item, the
Employee) Brigitte)
reference value is the result for the next
visible member of the base field, in the
base field’s sort order.
Each result is added to the sum of the
Selection of a
results for preceding items in the base
field from the
field, in the base field’s sort order, and
Running total data source of
— the total sum is shown.
in the pivot table
Results are always summed, even if a
(for example,
different summary function was used to
Date)
get each result.
The result is a percentage of the value
% of row — — of the whole row (for example, the row
sum).
The result is a percentage of the total
% of column — — column value (for example, the column
sum).
The result is a percentage of the overall
% of total — —
result (for example, the total sum).
(Default result x total result) / (row total
Index — —
x column total)
Chapter 10 Using Pivot Tables | 337
Figure 312: Original pivot table (top) and a Difference from example (bottom)
Figure 313: Example of a % of analysis
Figure 314: Example of % difference from analysis
Options for row and column fields
Figure 315: Data Field dialog for a row or column field
Double-click a field in the Row or Column Fields areas of the Pivot Table Layout dialog to access
the Data Field dialog shown in Figure 315.
338 | Calc Guide 26.2
In the Data Field dialog for a row or column field, you can choose to show subtotals for each
category. Subtotals are deactivated by default. Subtotals are useful only if the values in one row
or column field can be divided into subtotals for another (sub)field.
Some examples are shown in Figures 316, 317, and 318.
Figure 316: No subdivision with only one row or column field
Figure 317: Division of the regions for employees (two row fields) without subtotals
Chapter 10 Using Pivot Tables | 339
Figure 318: Division of the regions for employees with subtotals (by region)
To calculate subtotals that can also be used for the data fields (see above), select the
Automatic option in the Subtotals section of the Data Field dialog.
You can choose the type of subtotal to use by selecting User-defined and then clicking the type
of subtotal you want to calculate from the list. Functions in this list are only available when User-
defined is selected.
Normally, as shown in Figure 319, the pivot table excludes any rows or columns for categories
that have no entries in the underlying database. However, by choosing the Show items without
data option, you can force these to be displayed as shown in Figure 320
Figure 319: Default setting
340 | Calc Guide 26.2
Figure 320: Setting Show items without data
To do so, click the Options button on the Data Field dialog to access the Data Field Options
dialog (Figure 321). Use this dialog to specify additional options for fields in the Column and
Row Fields areas of the Pivot Table Layout dialog.
Figure 321: Data Field Options dialog
The following options are available:
Sort by: Choose the data field to sort columns or rows.
• Ascending: Sorts values from lowest to highest. If the selected field is the one for which
the dialog was opened, items are sorted by name. If a data field is selected, items are
sorted by the resultant values of that field.
• Descending: Sorts values from highest to lowest.
• Manual: Sorts items alphabetically.
Chapter 10 Using Pivot Tables | 341
Display Options: Customize display settings for all row fields, except the last (innermost) row
field.
• Use the Layout drop-down list to select the layout mode for the field in the list box. The
Layout menu provides four layout mode options that are shown in Figures 322 and 323
below:
– Tabular layout
– Outline layout with subtotals at the top
– Outline layout with subtotals at the bottom
– Compact layout
• Enable Empty line after each item to insert a blank row after each item’s data in the
pivot table.
• Use Repeat item labels to toggle whether item labels are repeated or not.
Figure 322: Pivot table layout modes – Tabular and Compact
342 | Calc Guide 26.2
Figure 323: Pivot table layout modes – Outline with subtotals top and bottom
• Show Automatically. This feature displays the top or bottom nn items when you sort by
a specified field. Click the Show option to turn on the automatic show feature and enter
the maximum number of items that you want to show automatically. The From drop-
down list selects the top or bottom items in the specified sort order. The Using field
drop-down list selects the data field by which to sort the data.
• Hide Items. Use these options to select the items to hide from the calculations.
• Hierarchy. For the majority of users, this field will be disabled because Calc does not
provide multiple hierarchies for a single field. However, if using a pivot table data source
extension, that extension could define multiple hierarchies for some fields. In that case,
this setting can be used to select the hierarchy to use.
Options for filter fields
It is possible to set options for a field appearing in the filters section (Figure 304) the same way
options are set for row fields and column fields. However, the options settings have no effect
until that field is moved from the filters section to either the rows section or the columns section.
Working with the results of the pivot table
A pivot table can be easily restructured using the Pivot Table Layout dialog (Figure 304).
Changing the layout
When the Pivot Table Layout dialog is open, fields can be dragged from Row Fields, Column
Fields, Filters, and Data Fields areas and then dropped in a different position. Unused fields can
also be added, and fields removed in error can be replaced by dragging and dropping them into
the positions required.
Chapter 10 Using Pivot Tables | 343
Some manipulation can also be carried out in the results view of the pivot table. Within the
results of the pivot table, drag one of the filters, column, or row fields to a different position. The
mouse pointer will change shape from its starting shape (horizontal or vertical block on the arrow
head) to the opposite if moving to a different field, such as from row to column, where it can be
dropped.
Figure 324: Drag a column field - note the pointer shape
Figure 325: Result of dragging column field (see Figure 324)
Figure 326: Drag a row field - note the pointer shape
You can remove a column, row, or filter field from the pivot table by clicking on it and dragging it
out of the table. The mouse pointer changes to that shown in Figure 327. A field removed cannot
be recovered, without returning to the Pivot Table Layout dialog to replace it.
344 | Calc Guide 26.2
Figure 327: Field dragged out of the pivot table
Grouping rows or columns of a pivot table
For many analyses, categories must be grouped into classes. Grouping can only be done on an
ungrouped pivot table. To group data, select the relevant cell range and choose Data > Group
and Outline > Group from the menu, or press F12 on your keyboard. The type of values you
want to group (such as numbers or text) will determine how the grouping works.
Note
Before you can group, you have to produce a pivot table with ungrouped data. The
time needed for creating a pivot table depends mostly on the number of columns and
rows and not on the size of the basic data. Through grouping, you can produce the
pivot table with a small number of rows and columns. The pivot table can contain a
lot of categories, depending on your data source.
To remove grouping again, click inside the group, then choose Data > Group and Outline >
Ungroup, or press Ctrl+F12.
Grouping of categories with scalar values
For grouping scalar values, select a single cell in the row or column of the category to be
grouped. Choose Data > Group and Outline > Group on the Menu bar or press F12 on the
keyboard; Calc displays the Grouping dialog shown in Figure 328.
You can define in which value range (Start / End) the grouping should take place. The default
setting is the whole range, from the smallest to the largest value. In the field Group by, you can
enter the class size, also known as the interval size.
Figure 328: Grouping dialog with scalar categories
Figure 329 shows part of a pivot table created from a list containing speed measurements as a
function of time. This pivot table shows the count of km/h speed measurements in the raw data.
Chapter 10 Using Pivot Tables | 345
Figure 329: Pivot table without grouping Figure 330: Pivot table with grouping
The pivot table in Figure 330 is based on the same raw data but the speed measurements have
been grouped into intervals of 10 km/h.
Grouping of categories with date / time values
For grouping date / time values, select a single cell in the row or column of the category to be
grouped. Choose Data > Group and Outline > Group on the Menu bar or press F12 on the
keyboard; Calc displays the Grouping dialog shown in Figure 331.
You can specify the value range for grouping by setting the Start and End points. By default,
grouping covers the entire range, from the smallest to the largest value.
In the Group by field, you can define the class size (interval size). For time-based data, you can
choose from predefined intervals like Seconds, Minutes, Hours, Days, Months, Quarters, or
Years instead of manually entering the interval in days.
Figure 331: Grouping dialog for date/time categories
Figure 332 illustrates this, showing monthly sales for the North region.
346 | Calc Guide 26.2
Figure 332: Pivot table with grouping
Figure 333 shows a pivot table configured to show the daily sales in the North region.
Figure 333: Pivot table without grouping
Grouping without automatic creation of intervals
To group categories that have no intervals, such as those containing text fields, the values to
group must first be defined. To do so, in the pivot table results, select the individual field values
to be grouped and then use Data > Group and Outline > Group on the Menu bar, or press F12
on the keyboard, to group the selected cells.
Chapter 10 Using Pivot Tables | 347
Tip
You can select several non-contiguous cells by pressing and holding the Control
key while clicking with the mouse.
Given the input data shown in Figure 334, create a pivot table with Department in the Row
Fields area and Sum – Sick days in the Data Fields area. The result should be as shown in
Figure 335.
Figure 334: Database with text categories
Figure 335: Pivot table with text categories
In the results of the pivot table select Accounting, Purchasing, and Sales in the Department
column. Select Data > Group and Outline > Group on the Menu bar or press F12 on the
keyboard. The pivot table result updates to reflect the new group, as shown in Figure 336.
Figure 336: Summary of single categories in one group
In the updated pivot table result, select Assembly, Production, and Warehouse in the Department
column. Select Data > Group and Outline > Group on the Menu bar or press F12 on the
keyboard. The pivot table updates again to reflect the new group, as shown in Figure 337.
You can change the default 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 pivot table will
remember these settings, even if you change the layout later on.
348 | Calc Guide 26.2
Figure 337: Grouping finished
To add partial sums for the groups, right-click the results of the pivot table and select the
Properties option. Double-click the Department2 entry in the Row Fields area and select the
Automatic option on the Data Field dialog (Figure 315). Click the two OK buttons and the pivot
table is updated to include the partial sums for the groups, as shown in Figure 338.
Figure 338: Renamed group and partial results
If it is not enabled already, select the Enable drill to details option on the Pivot Table Layout
dialog. Double-click the Group 1 and Technical entries in the Department2 column to
collapse/expand the group entries (for example, Figure 339 shows both groups collapsed).
Figure 339: Reduced to the new groups
Note
A well-structured database makes manual sorting within the pivot table obsolete. In
the example shown, you could add another column with the name Department, that
has the correct entry for each person based on whether the employee’s department
belongs to the group Office or Technical. The mapping for this (1:n relationship) can
be done easily with the VLOOKUP() function.
Sorting the result
The results of a pivot table are by default sorted so that categories in columns and rows are
presented in ascending order. There are three ways to change the sorting order:
• Select a sort order in the drop-down menu on a column’s heading.
• Sort manually by using drag and drop.
• Select a sort order through the Data Field Options dialog for the appropriate row or
column field (Figure 321).
Chapter 10 Using Pivot Tables | 349
• Each of these methods are described in the sections that follow.
Select sort order from drop-down menus on each column heading
The simplest way to sort entries is to click the arrow on the right side of the column heading for a
row or column field, and select one of the three sorting options (Figure 340):
• Sort Ascending
• Sort Descending
• Custom Sort
Figure 340: Column sorting and filtering dialog
Selecting the Custom Sort option sorts according to one of the predefined custom sorts defined
in Tools > Options > LibreOffice Calc > Sort Lists. See Chapter 2, Entering and Editing Data
for more information about creating and using sort lists.
This dialog also provides facilities for simple filtering of the data in the pivot table. Check the
required individual boxes to select the data displayed in the results of the pivot table. Options are
provided to show all, show only the current item, or hide only the current item. Click OK to
activate the selected filtering. Once filtering has been carried out, the color of the arrow changes
to white on a blue background, and a small white square is added to the bottom right of the
arrow button (Figure 341).
Figure 341: Arrow color change and indicator square on column heading
350 | Calc Guide 26.2
Manually sorting by drag and drop
You can reorder categories in a pivot table by dragging and dropping the cells with category
values. The dragged cell will be inserted before the cell where you drop it.
Note
In Calc, a cell must be fully selected (highlighted) to be moved, not just have the
cursor in it. The background of a selected cell is visibly highlighted.
To select a single cell:
Click the cell, then hold Shift and click it again.
Alternatively, click and drag across two cells, then drag back to the first cell before releasing the
mouse.
To select multiple cells:
Click one cell to select it.
Hold Shift or Ctrl and click additional cells to add them to the selection.
Sort automatically
To sort automatically, right-click within the pivot table and choose Properties. This will open the
Pivot Table Layout dialog (Figure 304). Double-click the row or column field you want to sort. In
the Data Field dialog which opens (Figure 315), click Options to display the Data Field Options
dialog (Figure 321).
For Sort by, select either Ascending, Descending, or Manual. If the selected field is the field for
which the dialog was opened, the items are sorted by name. If a data field was selected, the
items are sorted by the resultant value of the selected data field. Ascending sorts the values
from the lowest value to the highest value. Similarly, Descending sorts the values descending
from the highest value to the lowest value. Manual sorts values alphabetically.
Drilling
Use drilling to show the related detailed data for a single, compressed value in the pivot table
result. This facility is available only if you selected the Enable drill to details option on the Pivot
Table Layout dialog.
To activate a drill, double-click on the cell or choose Data > Group and Outline > Show
Details. There are two possibilities:
1) The active cell is a row or column field. In this case, drill means an additional
breakdown into the categories of another field. For example, double-click on the cell
with the value Golf. In this instance, the values that are aggregated within Golf can be
subdivided using another field.
Figure 342: Before the drill down for Golf
The Show Detail dialog appears allowing you to select the field to use for further
subdivision. In this example, Employee.
Chapter 10 Using Pivot Tables | 351
Figure 343: Selecting the field for the subdivision
Figure 344: After the drill down
To hide the details again, double-click on the cell Golf or choose Data > Group and
Outline > Hide Details.
The pivot table remembers your selection (in our example the field Employee) by
adding and hiding the selected field so that for the next drill-down for a field in the
Category column the dialog does not appear. To remove the selection Employee, open
the Pivot Table Layout dialog and delete the unwanted selection in the Row or Column
Fields area.
2) The active cell is a data field. In this case, drill-down results in a listing of all data entries
of the data source that aggregate to this value.
In our example, if we double-click on the cell with the value $18,741 from Figure 342,
we would have a new list of all data sets that are included in this value. This list is
displayed in a new sheet.
Figure 345: New sheet after the drill down for a value in a data field
Filtering
To limit the pivot table analysis to a subset of the information that is contained in the data basis,
you can filter the pivot table results.
352 | Calc Guide 26.2
Note
An AutoFilter or Standard Filter used on the sheet containing the raw data has no
effect on the pivot table analysis process. The pivot table always uses the complete
list that was selected when it was started.
To do this, click the Filter button at the top left above the results, or right-click in the results and
select Filter in the context menu.
Note
The Filter button is available only if the Add filter option on the Pivot Table Layout
dialog is selected.
Figure 346: Filter button in the upper left area of the pivot table
In the Filter dialog (Figure 347), you can define up to three filter options that are used in the
same way as Calc’s Standard Filter. The controls in the Options section of this dialog are similar
to the equivalent controls on Calc’s Standard Filter dialog – see Chapter 2, Entering and Editing
Data for more information.
Figure 347: Dialog for defining the filter
The data presented in a pivot table can also be filtered using the drop-downs on the right-hand
side of column headings or by using filter fields. Filtering through column headings is described
in “Select sort order from drop-down menus on each column heading” above.
Filter fields (that is, fields that you placed in the Filters area of the Pivot Table Layout dialog) are
another practical way to filter the results of the pivot table. The advantage is that the filtering
criteria used are clearly visible. Click the arrow on the right side of the filter field button to access
the associated filtering dialog (Figure 348).
Chapter 10 Using Pivot Tables | 353
Figure 348: Filter field filtering dialog
The text adjacent to a filter field button indicates the filtering status, that is “- all -” when nothing
is filtered, “- multiple -” when multiple but not all items are filtered, or the value when only that
value is not filtered.
Updating (refreshing) changed values
After you have created the pivot table, changes in the source data do not cause an automatic
update in the resulting table. You must update (refresh) the pivot table manually after changing
any of the underlying data values.
Changes in the source data could appear in two ways:
• The content of existing data sets has been changed.
For example, you might have changed a sales value. To update the pivot table, left-click
in the results area and choose Data > Pivot Table > Refresh on the Menu bar, or right-
click in the results area and choose Refresh in the context menu.
• You have added or deleted data sets in the original list.
In this case, the change means that the pivot table has to use a different area of the
spreadsheet for its analysis. If a simple addition to the list was made (for example, a
new sale from a different employee was inserted), it is possible to update the pivot table
by changing the range in the Selection field in the Source area of the Pivot Table Layout
dialog. In the case of more complex changes to the data set collection, you must redo
the pivot table from the beginning.
Cell formatting
The cells in the results area of the pivot table are automatically formatted by Calc. You can
change this formatting using all the tools in Calc. However, if you make any change in the design
of the pivot table using direct formatting, the formatting will return to that applied automatically by
Calc when the table is refreshed.
On creating a pivot table, six standard cell styles are added to the list of styles in the document if
they are not included already. Each of these styles is applied to part of the pivot table. The
customizable pivot table styles include:
Pivot Table Category
Pivot Table Corner
Pivot Table Field
354 | Calc Guide 26.2
Pivot Table Result
Pivot Table Title
Pivot Table Value
Tip
Use the pivot table styles to make sure that the format of your pivot table is not
unexpectedly changed during updates and that all pivot tables in your document
have the same appearance.
Calc applies the number format from the source list to the data field in the pivot table. For
example, if the source values are in currency format, the corresponding cells in the pivot table
will also use the currency format.
However, this can cause issues if the result is a fraction or percentage, as the pivot table doesn’t
automatically adjust the format. Such results should either have no unit or be displayed as
percentages. While you can manually fix the number format, the changes will reset after the
pivot table is updated.
Deleting a pivot table
To delete a pivot table, left-click in any cell of the pivot table and select Data > Pivot Table >
Delete on the Menu bar, or right-click in any cell of the pivot table and select Delete in the
context menu.
Caution
If you delete a pivot table with an associated pivot chart, the pivot chart is also
deleted. Calc opens a dialog box to confirm the pivot chart deletion.
Using pivot table results elsewhere
The problem
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 pivot table, it contains the result that was
calculated by referencing specific categories of the row and column fields. In Figure 349, cell C6
contains the sum of the sales values of the employee Hans in the category Sailing. The formula
in cell C12 uses this value.
Figure 349: Formula reference to a cell of the pivot table
Chapter 10 Using Pivot Tables | 355
If the underlying data or the layout of the pivot table changes, then you must take into account
that the sales value for Hans in the Sailing category might appear in a different cell. Your formula
still references the cell C6 and therefore uses a wrong value. The correct value is in a different
location. For example, in Figure 350, the location is now C7.
Figure 350: The value that you really want to use is now in a different location
The solution: Function GETPIVOTDATA()
Use the function GETPIVOTDATA() to have a reference to a value inside the pivot table by using
the specific identifying categories for this value. This function can be used with formulas in Calc
if you want to reuse the results from the pivot table elsewhere in your spreadsheet.
Syntax
The syntax has two variations:
=GETPIVOTDATA(Target Field; Pivot Table[; Field 1; Item 1][; ... [Field 126; Item
126]])
or
=GETPIVOTDATA(Pivot Table; Constraints)
The square brackets in the first variation surround optional arguments.
First syntax variation
The Target Field specifies which data field of the pivot table is used within the function. If your
pivot table has only one data field, this entry is ignored, but you must enter it anyway.
If your pivot table has more than one data field, then you have to enter the field name from the
underlying data source (for example “Sales Value”) or the field name of the data field itself (for
example “Sum – Sales Value”).
The argument Pivot Table specifies the pivot table that you want to use. Your document may
contain more than one pivot table. Enter here a cell reference that is inside the area of your pivot
table. It might be a good idea to always use the upper left corner cell of your pivot table so that
you can be sure that the cell will always be within your pivot table, even if the layout changes.
Example: =GETPIVOTDATA("Sales Value",A1)
If you enter only the first two arguments, then the function returns the total result of the pivot
table (“Sum – Sales Value” entered as the field will return a value of 408,765).
You can add more arguments as pairs with Field names and Elements to retrieve specific
partial sums. In the example in Figure 351, where we want to get the partial sum of Hans for
Sailing, the formula in cell C12 would look like this:
356 | Calc Guide 26.2
=GETPIVOTDATA("Sales Value",A1,"Employee","Hans","Category","Sailing")
Figure 351: First syntax variation
Second syntax variation
The argument Pivot Table has to be given in the same way as for the first syntax variation.
For the Constraints, enter a list separated by spaces to specify the value you want from the
pivot table. This list must contain the name of the data field if there is more than one data field;
otherwise, it is not required. To select a specific partial result, add more entries in the form of
Field name[Element].
In the example in Figure 352, where we want to get the partial sum of Hans for Sailing, the
formula in cell C12 would look like this:
=GETPIVOTDATA(A1,"Sales Value Employee[Hans] Category[Sailing]")
Figure 352: Second syntax variation
Pivot charts
A pivot chart provides a visual representation of the information in a pivot table. You can create a
pivot chart from the output of a pivot table and, if the pivot table gets changed, so does the pivot
chart.
Pivot charts are a special case of the more general Calc charts described in Chapter 6, Creating
Charts and Graphs. The main differences between pivot charts and other charts in Calc are as
follows:
• A pivot chart tracks the changes in the data issued from a pivot table and Calc
automatically adjusts the data series and data range of the pivot chart accordingly.
Chapter 10 Using Pivot Tables | 357
• Pivot charts include special buttons not found on Calc’s standard charts. These buttons
represent the layout and fields of the underlying pivot table:
– Filter field buttons: Displayed at the top of the pivot chart.
– Row field buttons: Shown at the bottom of the pivot chart.
– Column field buttons: Stacked in the legend on the right side of the chart.
These buttons also allow you to filter the data displayed in the pivot chart.
Creating a pivot chart
To create a pivot chart, click inside the pivot table and select Insert > Chart on the Menu bar or
click the Insert Chart icon on the Standard toolbar.
Calc automatically detects the pivot table and opens the Chart Wizard. Through the Chart
Wizard, you can select the chart type and chart elements for the pivot chart. The wizard is similar
to the corresponding wizard for normal charts but for pivot charts, the steps to define data range
and data series are disabled.
Figure 353: Sample pivot chart and associated pivot table
The first step in the wizard is to select the chart type and the same options are available as for a
normal chart (Figure 354).
358 | Calc Guide 26.2
Figure 354: Select the chart type through the Chart Wizard when creating a pivot chart
The second step is to select the chart elements and these are similar to those for normal charts
(Figure 355).
Figure 355: Enter chart elements through the Chart Wizard when creating a pivot chart
Click Finish to close the wizard and create the pivot chart.
Editing a pivot chart
Calc provides tools for changing the chart type, chart elements, fonts, colors, and many other
options. The facilities provided for pivot charts are the same as those available for normal charts;
see Chapter 6, Creating Charts and Graphs.
Updating a pivot chart
If the source data of the pivot table changes, refresh the pivot table and the pivot chart is also
updated accordingly. To refresh the pivot table (and thus the pivot chart), click in any cell within
the pivot table and select Data > Pivot Table > Refresh on the Menu bar or select Refresh in
the context menu.
Chapter 10 Using Pivot Tables | 359
Filtering a pivot chart
Filters can remove unwanted data from a pivot chart, and any filters applied to the linked pivot
table will automatically update the chart since both display the same data.
How to Filter Using Pivot Chart Buttons:
• Filter Indicators: Pivot chart buttons have a down arrow indicating a pop-up action. If a
filter is applied, the arrow turns blue.
• Edit Mode: Double-click the chart to activate edit mode, indicated by a gray frame
around the chart.
Using Filter Buttons on the Chart:
• Top Buttons (Filter Fields): Click the filter button at the top of the chart to open a filtering
dialog (similar to Figure 347). This allows you to adjust filters for both the pivot table and
chart. The button's legend indicates the filter status:
– "- all -": No filters applied.
– "- multiple -": Some, but not all, items filtered.
– A specific value: Only that value is unfiltered.
• Bottom and Right Buttons (Row/Column Fields): Buttons here with a down arrow open a
sorting and filtering dialog (similar to Figure 340). Use this to modify sorting and filtering
for the table and chart.
Figure 356: Filtering applied to filter and row fields
Deleting a pivot chart
To delete a pivot chart, select the chart and press Del on the keyboard.
Note
When you delete a pivot chart, the associated pivot table is not affected.
Caution
If you delete a pivot table with an associated pivot chart, the pivot chart is also
deleted. Calc opens a dialog box to confirm the pivot table deletion.
360 | Calc Guide 26.2
Calc Guide 26.2
Chapter 11
Data Analysis
Using Scenarios, Goal Seek, Solver, Statistics, others
Introduction
Once you are familiar with functions and formulas described in the previous chapter, the next
step is to learn how to use Calc’s automated processes to quickly perform useful analysis of your
data.
Besides formulas and functions, Calc offers various tools for data processing. These tools
include features for copying and reusing data, creating subtotals, conducting what-if analysis,
and performing statistical analysis. You can find them under the Tools and Data menus on the
Menu bar. While not essential for using Calc, these tools can save you time and effort when
managing large data sets or preserving your work for future review.
Note
A related tool, the Pivot Table, is not discussed here due to its complexity, which
warrants a dedicated chapter. For more information, refer to Chapter 10, Using Pivot
Tables.
Consolidating data
The Consolidate tool allows you to combine and aggregate data spread across one or more
sheets. This tool is useful if you need to quickly summarize a large, scattered set of data for
review. For example, you could use it to consolidate multiple department budgets from different
sheets into a single company-wide budget contained in a master sheet.
To consolidate data:
1) Open the document containing the cell ranges to be consolidated.
2) Select Data > Consolidate on the Menu bar to open the Consolidate dialog (Figure
357).
3) Click on the Source data ranges field, then type a reference to a source data range, a
named range, or select it with the mouse. Use the associated Shrink / Expand button if
you need to minimize the dialog while you select the range. Alternatively, select a
named range from the drop-down list to the left of the field.
4) Click Add. The selected range is added to the Consolidation ranges list.
5) Repeat steps 3) and 4) to add additional source ranges.
6) To delete an entry in the Consolidation ranges list, select it and click Delete. The
deletion is carried out without further confirmation.
7) Click on the Copy results to field, then type a reference to the first cell of the target
range or select it with your mouse. You can also select a named range in the drop-down
list to the left of the field.
8) Select a function to aggregate your data in the Function drop-down list. The default is
Sum. Other available functions are Count, Average, Max, Min, Product, Count (numbers
only), StdDev (sample), StDevP (population), Var (sample), and VarP (population).
9) Click OK to consolidate the ranges. Calc runs the function from step 8) on your source
data ranges and populates the target range with the results.
362 | Calc Guide 26.2
Tip
If you are consolidating the same cell ranges repeatedly, consider converting them
into reusable named ranges to make the process easier. For more information about
named ranges, see Chapter 15, Calc as a Database.
Figure 357: Consolidate dialog
Consolidation settings
In the Consolidate dialog, expand the Options section to access the settings shown in Figure
358.
Figure 358: Consolidate dialog – Options section
Consolidate by
In this section, choose whether to consolidate your source data ranges by their range
position or by matching labels. Consolidation labels must be contained within each
range, and the text of corresponding row or column labels must match for the rows or
columns to be combined.
– Row labels – Consolidates rows by matching label. If this option is unchecked, the
tool will consolidate rows by position instead.
– Column labels – Works the same as Row labels, but with columns instead.
Chapter 11 Data Analysis | 363
Options
Select Link to source data to add formulas in the target range that link back to values
in the source ranges. When you select this option, any changes you make in the source
ranges will automatically update values in the target range.
Note
If you use the Link to source data option, each source link is inserted into the target
range, then ordered and hidden from view. Only the final results of consolidation are
displayed by default.
Consolidation example
Figures 359, 360, and 361 show a simple example of consolidation using a spreadsheet with the
sheets Year 1, Year 2, and Consolidated Sales. Figure 359 shows the contents of the Year 1
sheet, with sales figures by region for each of the four product colors.
Figure 359: Year 1 sales by region
Figure 360 shows the Year 2 sheet, sales figures by region for each of four product colors. Note
the different ordering of row and column labels between the two figures.
Figure 360: Year 2 sales by region
Figure 361 shows the consolidated sales data, created by using the Consolidate dialog settings
shown in Figure 358. Note that because the Link to source data option was selected, clicking
on the plus sign (+) indicators to the left of the data will reveal formula links back to the source
ranges.
364 | Calc Guide 26.2
Figure 361: Consolidated sales by region
The source ranges and target range are saved as part of the document. If you later open a
document with consolidated ranges, they will still be available in the Consolidation ranges list of
the Consolidate dialog.
Creating subtotals
Calc offers two methods of creating subtotals: the SUBTOTAL function and the Subtotals tool.
Using the SUBTOTAL function
The SUBTOTAL function is listed under the Mathematical category of the Function Wizard, and
the Functions deck of the Sidebar, which are described in Chapter 9, Using Formulas and
Functions. SUBTOTAL is a relatively limited method for generating a subtotal, and works best if
used with only a few categories.
A SUBTOTAL example
To illustrate how to use the SUBTOTAL function, we use the sales data sheet shown in Figure
362. The AutoFilter function is already applied to the sales data, as indicated by the down arrow
buttons at the head of each column. AutoFilters are described in Chapter 2, Entering, Editing
and Formatting Data.
Figure 362: Sales data with AutoFilter applied (only the first few rows are shown)
To create a summation subtotal for the Sales Value field using the Function Wizard:
1) Select the cell to contain a subtotal. Typically, this cell is at the bottom of the column
being subtotaled, which, for our example, is the Sales Value column.
2) Use one of the following methods to open the Function Wizard dialog (Figure 363):
– Select Insert > Function on the Menu bar
– Click the Function Wizard icon on the Formula bar
– Press Ctrl+F2
Chapter 11 Data Analysis | 365
3) Select SUBTOTAL in the Function list of the Function Wizard dialog and click Next.
4) Enter the numeric code of a function into the Function field on the right side of the
dialog. This code must be a value in the range 1 to 11, or 101 to 111, with the meaning
of each value shown in Table 19.
Figure 363: Function Wizard dialog
Note
Values 1 to 11 include hidden values in the calculated subtotal, while values 101 to
111 do not. Hiding and showing data is described in Chapter 2, Entering, Editing and
Formatting Data. Filtered-out cells are always excluded by the SUBTOTAL function.
Table 19: SUBTOTAL function numbers
Function index Function index
Function
(includes hidden values) (ignores hidden values)
1 101 AVERAGE
2 102 COUNT
3 103 COUNTA
4 104 MAX
5 105 MIN
6 106 PRODUCT
7 107 STDEV
8 108 STDEVP
366 | Calc Guide 26.2
Function index Function index
Function
(includes hidden values) (ignores hidden values)
9 109 SUM
10 110 VAR
11 111 VARP
5) Click on the Range field, then type a reference to the Sales Value range or select the
cells with your mouse (Figure 363). Use the Shrink / Expand button if you need to
temporarily minimize the dialog while selecting the cells.
6) Click OK to close the Function Wizard dialog. The cell you selected in step 1) now
contains the total sales value.
7) Click on the AutoFilter down arrow button at the top of the Employee column and
remove all marks from the filter area except those next to Brigitte and (empty). The cell
that you selected in step 1) should now reflect the sum of all of Brigitte’s sales (Figure
364).
Note
If the cell range used to calculate a subtotal contains other subtotals, these subtotals
will not be counted in the final one. Similarly, if you use this function with AutoFilters,
only the data satisfying the current filter selections will be displayed. Any filtered-out
data is ignored.
Figure 364: SUBTOTAL result for Brigitte’s sales
The Subtotals tool
Calc offers the Subtotals tool as a more comprehensive alternative to the SUBTOTAL function.
In contrast to SUBTOTAL, which only works on a single array, the Subtotals tool can create
subtotals for up to three arrays arranged in labeled columns. It also groups subtotals by category
and sorts them automatically, thereby eliminating the need to apply AutoFilters and filter
categories by hand.
Using the Subtotals tool
To insert subtotal values into a sheet:
1) Select the cell range for the subtotals that you want to calculate, and remember to
include the column heading labels. Alternatively, click on a single cell within your data to
allow Calc to automatically identify the range.
2) Select Data > Subtotals on the Menu bar to open the Subtotals dialog (Figure 365).
3) In the Group by drop-down list on the 1st Group tab, select a column by its label.
Entries in the cell range from step 1) will be grouped and sorted by matching values in
this column.
Chapter 11 Data Analysis | 367
4) In the Calculate subtotals for box on the 1st Group tab, select a column containing
values to be subtotaled. If you later change values in this column, Calc will
automatically recalculate the subtotals.
5) In the Use function box on the 1st Group tab, select a function to calculate the subtotals
for the column selected in step 4).
6) Repeat steps 4) and 5) to create subtotals for other columns on the 1st Group tab.
7) You can create two more subtotal categories by using the 2nd Group and 3rd Group
tabs and repeating steps 3) to 6). If you do not want to add more groups, then leave the
Group by list for each page set to “- none -”.
8) Click OK. Calc will add subtotal and grand total rows to your cell range.
Figure 365: Subtotals dialog
For our sales data example, a partial view of the results is shown in Figure 366. The group
settings are identified in Table 20.
Table 20: Group settings used on Subtotals dialog for example sales data
Tab Group by Calculate subtotals for Use function
1st Group Employee Sales Value Sum
2nd Group Category Sales Value Sum
3rd Group - none - - -
Subtotal outline
When you use the Subtotals tool, Calc inserts an outline to the left of the row number column.
This outline represents the hierarchical structure of your subtotals, and can hide or show data at
different levels in the hierarchy using the numbered column indicators at the top of the outline or
the group indicators, denoted by plus (+) and minus (-) signs.
This feature is useful if you have many subtotals, as you can simply hide low-level details, such
as individual entries, to produce a high-level summary of your data. For more information on how
to use outlines, see Chapter 2, Entering, Editing and Formatting Data.
To turn off outlines, select Data > Group and Outline > Remove Outline on the Menu bar. To
reinstate them, select Data > Group and Outline > AutoOutline.
368 | Calc Guide 26.2
Figure 366 shows the outline for our sales data example.
Figure 366: Partial outlined view of sales data example with subtotals
Column 1 represents the highest group level, the grand total over all employees. Outline
columns 2 to 5 show descending group levels as follows:
• Column 2 represents the grand total over all categories.
• Column 3 represents the total for each employee.
• Column 4 represents the total for each category for an individual employee.
• Column 5 shows individual entries.
Subtotals tool options
Click on the Options tab of the Subtotals dialog to access the following settings:
Groups
Defines how subtotal data is organized.
– Page break between groups – inserts page breaks between each subtotal group
so that each group displays on a separate page when you print the data.
– Case-sensitive – prevents the tool from grouping entries by data labels that differ
by case. In our sales data example, entries with “Brigitte” and “brigitte” under the
Employee column will not match if this option is selected.
– Pre-sort area according to groups – sorts entries by group before calculating
subtotals. Disabling this option prevents the tool from grouping matching entries
Chapter 11 Data Analysis | 369
together. As a result, distinct subtotals will be created for matching entries if they do
not appear on consecutive rows. For example, two entries under the “Golf” category
will not count towards the same group subtotal if there is an entry for “Tennis” in
between them.
– Summary below data – gives the user the option to put subtotals below the data (if
checked) or above the data.
Figure 367: Options tab of the Subtotals dialog
Sort
Defines how subtotal data is sorted. This section is disabled if Pre-sort area according
to groups is unchecked.
– Ascending or Descending – sorts entries by value from lowest to highest and
highest to lowest, respectively. You can modify these sort rules by using Data > Sort
on the Menu bar. For more detail, see Chapter 2, Entering, Editing and Formatting
Data.
– Include formats – carries over formatting, such as the currency format, from the
data to the corresponding subtotals.
– Custom sort order – sorts your data according to one of the predefined custom
sorts defined in Tools > Options > LibreOffice Calc > Sort Lists on the Menu bar.
For more details about custom sort lists, see Chapter 2, Entering, Editing and
Formatting Data.
Reset and Remove
In the Subtotals dialog, use the Reset button to undo any changes made on the current tab. Use
the Remove button to remove any subtotals that have already been created using the Subtotals
tool. Use these features with care, as no confirmation dialog is displayed.
370 | Calc Guide 26.2
Using scenarios
Scenarios are cell ranges that have been saved and named. They can be used to answer “what-
if” questions about your data. You can create multiple scenarios for the same calculation set,
then quickly swap between them to view the outcomes of each. This feature is useful if you need
to test the effects of different conditions on your calculations, but do not want to deal with
repetitive manual data entry. For example, if you wanted to test different interest rates for an
investment, you could create scenarios for each rate, then switch between them to find out
which rates work the best for you.
Creating scenarios
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 on the Menu bar to open the Create Scenario dialog
(Figure 368).
Figure 368: Create Scenario dialog
3) Enter a name for the new scenario in the Name of Scenario field.
Tip
When naming a new scenario, use a unique name that clearly identifies and
distinguishes it from other scenarios. The default name suggested by Calc may not
be the best choice, especially if you have a large set of scenarios.
4) Optionally, add information to the Comment field. The example in Figure 368 shows the
default comment.
5) Click OK to close the dialog. The new scenario is automatically activated upon creation.
6) Repeat steps 1) to 5) to create additional scenarios. Select the same cell range that you
used for the first scenario to have multiple scenarios for the same calculations.
Chapter 11 Data Analysis | 371
Tip
To keep track of which calculations are dependent on your scenarios, use Tools >
Detective > Trace Dependents on the Menu bar after highlighting your scenario
cells. For more information about the Detective tool, see Chapter 9, Using Formulas
and Functions.
Scenario settings
The Settings section of the Create Scenario dialog (Figure 369) contains the following options:
Figure 369: Create Scenario dialog – Settings
Display border
Places a colored border around the cell range that contains your scenario (Figure 370).
Figure 370: Scenario cell range with border
To choose the color of the border, use the drop-down field to the right of this option. The
border has a title bar displaying the name of the active scenario and a down arrow
button that opens a drop-down list of all the scenarios defined for the current cell range.
You can swap to another scenario by selecting it in this list.
Copy back
Copies any changes made to a scenario’s cell values back into the active scenario. If
you uncheck this option, then the scenario’s initial values cannot be overwritten. The
actual behavior of the Copy back setting depends on the current cell and sheet
protections and the Prevent changes setting (see Table 22 on page 373).
Caution
When creating a new scenario from the cells of a scenario with Copy back enabled,
be careful not to overwrite the old scenario. To avoid this situation, create the new
scenario with Copy back enabled first, then change its values only once it is active.
372 | Calc Guide 26.2
Copy entire sheet
Creates a copy of the sheet with the new active scenario. The sheet is named after this
scenario. Note that changing scenario values in the copy sheet will not affect the active
scenario, even if it has Copy back enabled.
Prevent changes
Prevents changes to a scenario with Copy back enabled when the sheet is protected,
but the cells are not. Also prevents changes to the scenario’s settings while the sheet is
protected. This option and its effects are more fully explained in the next section.
Changing scenarios
Scenarios have two aspects that can be altered independently:
• Scenario properties (that is, its settings)
• Scenario cell values
The extent to which these aspects can be changed depends on the active scenario's properties
and the current sheet and cell protections. For more detail about sheet and cell protections, see
Chapter 2, Entering, Editing and Formatting Data.
Changing scenario properties
Table 21 summarizes how sheet protection and the Prevent changes option affect your ability to
change scenario properties.
Table 21: Changing scenario properties
Sheet Prevent
Property changes
protection changes
On On No scenario properties can be changed.
Display border and Copy back can be changed. Prevent
On Off
changes and Copy entire sheet cannot be changed.
All scenario parameters except for Copy entire sheet can be
Off Any setting changed. In this case, the Prevent changes option has no
effect.
Changing scenario cell values
Table 22 summarizes the interaction of various settings in making changes to scenario cell
values.
Table 22: Changing scenario cell values
Scenario
Sheet Prevent
cell Copy back Change allowed
protection changes
protection
Scenario cell values cannot be
On Off On On
changed.
Scenario cell values can be
On Off Off On changed, and the scenario is
updated.
Scenario cell values can be
changed, but the scenario is not
On Off Any setting Off
updated due to the Copy back
setting.
Chapter 11 Data Analysis | 373
Scenario
Sheet Prevent
cell Copy back Change allowed
protection changes
protection
Scenario cell values cannot be
On On Any setting Any setting
changed.
Scenario cell values can be
changed and the scenario is
Off Any setting Any setting Any setting
updated or not, depending on
the Copy back setting.
Working with scenarios using the Navigator
Scenarios that have been added to a spreadsheet may be viewed using the Navigator. To open
a scenario, select View > Navigator from the Menu bar, then click on the Scenarios icon in the
Navigator and choose a scenario from the list (Figure 371). All defined scenarios are listed along
with the comments entered when each scenario was created. You can also use the equivalent
features in the Navigator deck of the Sidebar. For more information about the Navigator, refer to
Chapter 1, Introduction.
Figure 371: Scenarios in the Navigator
To apply a scenario to the current sheet, double-click the scenario name in the Navigator.
To delete a scenario, right-click the name in the Navigator and choose Delete, or press the
Delete key after selecting it. A confirmation dialog will be displayed.
To edit a scenario, right-click the name in the Navigator and choose Properties. Calc displays
the Edit Scenario dialog, which is similar to the Create Scenario dialog (Figure 368).
Using the Multiple Operations tool
Similar to scenarios, the Multiple Operations tool conducts what-if analysis on your calculations.
However, unlike scenarios that represent individual sets of values for multiple formula variables,
this tool uses a range of values for just one or two variables. It then applies one or more
formulas to generate a corresponding range of solutions. Because each solution is linked to one
or two variable values, both the variable and solution ranges can be easily organized in a tabular
format. Consequently, the Multiple Operations tool is ideal for producing data that is easy to
read, share, or visualize using graphs.
374 | Calc Guide 26.2
Tip
Exercising good organization can make using this tool relatively painless. For
example, we recommend keeping your data together on one sheet and using labels
to identify your formulas, variables, and table ranges.
Multiple Operations with one formula and one variable
The simplest way to learn how to use the Multiple Operations tool is by starting with one formula
and one variable. For guidance on using the tool with multiple formulas or with two variables,
refer to the sections "Calculating with several formulas simultaneously" and "Multiple operations
with two variables" on page 378, respectively.
To use the Multiple Operations tool with one formula and one variable:
1) In the cells of a worksheet, enter a formula and at least one variable that it uses.
2) In the same worksheet, enter values into a cell range that occupies a single column or
row. These values are used for one of the variables of the formula that you defined in
step 1).
3) With the mouse, select the range containing both the variable range that you defined in
step 2) and the adjacent empty cells that follow it. Depending on how your variable
range is arrayed, these empty cells will either be in the column to the right (if the range
is in a column) or in the row immediately below (if it is in a row).
4) Select Data > Multiple Operations on the Menu bar to open the Multiple Operations
dialog (Figure 372).
Figure 372: Multiple Operations dialog
5) Click on the Formulas field and type a cell reference to the formula you defined in step
1) or select the cell with the mouse. Use the associated Shrink / Expand button if you
need to minimize the dialog while selecting the cell.
6) If the range from step 2) is arrayed in a column, then click on the Column input cell field
and type a cell reference to the variable that you want to use or select the cell with the
mouse. If the range is in a row, then use the Row input cell field instead.
7) Click OK to run the tool. The Multiple Operations tool will generate its results in the
empty cells that you selected in step 3). Each result value corresponds to the variable
value adjacent to it, and together they form the entries of a results table.
An example with one formula and one variable
Using the Multiple Operations tool is best explained by example. Suppose that you produce toys
that you sell for $10 each (cell B1 of a worksheet). Each toy costs $2 to make (B2), and you
have a fixed annual cost of $10,000 (B3). What is the minimum number of toys that you must
sell to break even? Suppose that our initial estimate of quantity sold is 2,000 (B4).
Chapter 11 Data Analysis | 375
Figure 373: Inputs to Multiple Operations tool for one formula, one variable
To answer this question:
1) Enter the following formula into B5: =B4*(B1-B2)-B3. This formula represents the
equation Profit = Quantity * (Selling price – Direct costs) – Fixed costs. With this
equation, our initial quantity produces a $6,000 profit, which is higher than the break-
even point.
2) In D2:D11, enter a range of alternate quantities from 500 to 5000 in steps of 500.
3) Select the range D2:E11 to define the results table. This range includes the alternate
quantity values (column D) and the empty results cells (column E).
4) Select Data > Multiple Operations on the Menu bar to open the Multiple Operations
dialog.
5) Using the Formulas field, select the cell B5.
Figure 374: Results of Multiple Operations tool for one formula and one variable
6) Using the Column input cell field, select the cell B4 to set the quantity as the variable for
our calculations. Figure 373 shows the worksheet and Multiple Operations dialog at this
point.
376 | Calc Guide 26.2
7) Click OK. The profits for the different quantities are now shown in column E (Figure
374). We can see that the break-even point is between 1000 and 1500 toys sold –
namely, 1250. Figure 374 shows an XY (Scatter) chart showing the profit as a function
of quantity.
Figure 375: XY (Scatter) plot of profit over quantity of toys sold (visualization example)
Calculating with several formulas simultaneously
Using the Multiple Operations tool with multiple formulas follows nearly the same process as
with one formula, but with two important differences:
1) For each formula that you add, you must also add a corresponding column or row to the
results table to contain the output of that formula.
2) How you initially arrange your formulas determines how their results will be displayed in
the results table. For example, if you arrange the formulas A, B, and C in a single row in
that order, then Calc will generate the results of A in the first results table column, the
results of B in the second column, and the results of C in the third.
Note
The Multiple Operations tool only accepts formulas arranged in a single row or
column, depending on how your results table is oriented. If the table is column-
oriented – that is, the way it is in our sales data example – then your formulas must
be arranged in a row. If the table is row-oriented, then your formulas must be in a
column.
Caution
Be careful not to add empty cells between formulas, as they will create gaps in the
results table and may cause some results not to appear if you don't select enough
rows or columns for the table.
An example with two formulas and one variable
Using our sales data example, suppose that we want to calculate the annual profit per item sold
in addition to the annual overall profit. To calculate the results:
1) In the sheet from the previous example, delete the results in column E.
2) Enter the following formula in C5: =B5/B4. You are now calculating the annual profit per
item sold.
Chapter 11 Data Analysis | 377
3) Select the range D2:F11 for the results table. Column F will contain the results of the
annual profit per item formula in C5.
4) Select Data > Multiple Operations on the Menu bar to open the Multiple Operations
dialog.
5) Using the Formulas field, select the range B5:C5.
6) Using the Column input cell field, select the cell B4. Figure 376 shows the worksheet
and the dialog at this point.
Figure 376: Inputs to Multiple Operations tool for one variable and two formulas
7) Click OK. Now the profits are listed in column E and the annual profit per item in column
F.
Figure 377: Results of Multiple Operations tool for one variable and two formulas
Multiple operations with two variables
When using the Multiple Operations tool with two variables, it generates a two-dimensional
results table. Each variable defines one dimension of the table: the alternate values for one
variable form the row headings, while the values for the other variable form the column
headings. Each cell in the table represents a unique combination of row and column values, with
the results calculated based on these paired values.
Since two variables are involved, you must specify both the Column input cell and Row input
cell fields. The order of these inputs is critical: the Column input cell field determines the row
heading values, and the Row input cell field determines the column heading values.
378 | Calc Guide 26.2
Tip
Since column headings are in a row at the top of the table, they correspond to the
Row input cell field. Likewise, row headings are in a column, so they correspond to
the Column input cell field.
Note
If you use two variables, the Multiple Operations tool will not work with multiple
formulas. It will allow you to enter the extra formulas, but will not generate the
expected results for any formula beyond the first.
Calculating with two variables
Using our sales example, suppose that in addition to varying the quantity of toys sold, you also
want to vary the unit sale price as well. To calculate the results:
1) Expand the sales data table by entering $8, $10, $15 and $20 in the range E1:H1.
2) Select the range D1:H11 for the results table.
3) Select Data > Multiple Operations on the Menu bar to open the Multiple Operations
dialog.
4) Using the Formulas field, select cell B5.
5) Using the Row input cell field, select cell B1. The column headings – $8, $10, $15 and
$20 – are now linked to the unit sale price variable defined in cell B1.
6) Using the Column input cell field, select cell B4. The row headings – 500, 1000, ... ,
5000 – are now linked to the quantity sold variable defined in cell B4. Figure 378 shows
the worksheet and dialog at this point.
7) Click OK. The profits for the different sale prices and quantities are now shown in the
range E2:H11 (Figure 379).
Figure 378: Inputs to Multiple Operations tool for two variables
Chapter 11 Data Analysis | 379
Figure 379: Results of Multiple Operations tool for two variables
Using Goal Seek
Besides scenarios and the Multiple Operations tool, Calc offers a third "what-if" analysis tool
called Goal Seek. Typically, you use a formula to calculate a result from given values. However,
with Goal Seek, you start with the desired result and work backwards to find the values that
produce it. This feature is useful when you know the outcome you want but need to determine
how to achieve it or how it might change if you adjust certain conditions.
Note
Only one argument can be altered at a time in a single goal seek. If you need to test
multiple arguments, then you must run a separate goal seek on each one.
Goal Seek example
Suppose that we want to calculate the annual interest return for an account. To calculate annual
interest (I), we must create a table with values for the capital (C), the interest period length in
years (n), and the interest rate (i). The formula is I = C*n*i.
Suppose that the interest rate i = 7.5% (cell B3 of a worksheet) and the period length n = 1
(B2) remain constant. We want to know how much investment capital C is needed to achieve a
return of I = $15,000. Assume that our initial capital estimate is C = $100,000 (B1).
To calculate the return:
1) Enter the return formula (=B1*B2*B3) into B4 and select the cell with the mouse.
2) Select Tools > Goal Seek on the Menu bar to open the Goal Seek dialog (Figure 380).
Figure 380: Goal Seek dialog
3) B4 should already be entered in the Formula cell field. However, if you want to select a
different cell, use the associated Shrink / Expand button to minimize the dialog while
you select the required cell.
380 | Calc Guide 26.2
4) Click on the Variable cell field, then type a reference to cell B1 or select it with the
mouse to make the capital the variable in the current Goal Seek.
5) Enter the desired formula result in the Target value field. In this example, the value is
15000. Figure 381 shows the cells and dialog fields at this point.
Figure 381: Example setup for goal seek
6) Click OK. A dialog appears informing you that the goal seek was successful (Figure
382).
Figure 382: Goal seek result dialog
7) Click Yes to enter the goal value into the variable cell. The result is shown in Figure
383, indicating that a capital requirement of $200,000 is needed to achieve a $15,000
return.
Figure 383: Result of goal seek in worksheet
Note
Not every goal seek problem succeeds in returning a good result. It depends on the
formula used, goal value, and initial value. The goal seek algorithm iterates internally
several times converging to the goal.
If the goal seek is unsuccessful, Calc displays an information dialog reporting the
failure. This dialog offers the choice of inserting the closest value into the variable
cell. Press Yes or No as required.
Chapter 11 Data Analysis | 381
Using the Solver
A more elaborate form of goal seek, the Solver, allows you to solve mathematical programming
or optimization problems. A mathematical programming problem is concerned with minimizing or
maximizing a function subject to a set of constraints. These types of problems occur across
various fields, including science, engineering, business, and more. While a comprehensive
explanation of mathematical programming is beyond the scope of this guide, readers can
explore the topic further on the Mathematical Optimization Wikipedia page. This page offers an
overview and links to more in-depth resources.
Calc offers the following selection of solver engines:
• DEPS (Differential Evolution & Particle Swarm Optimization) Evolutionary Algorithm.
• SCO (Social Cognitive Optimization) Evolutionary Algorithm.
• LibreOffice CoinMP Linear Solver.
• LibreOffice Linear Solver.
• LibreOffice Swarm Non-Linear Solver (experimental).
Caution
As the LibreOffice Swarm Non-Linear Solver is an experimental tool, it may not be
supported in future versions of Calc, and we recommend that you do not use it
unless you are familiar with non-linear programming concepts.
The DEPS and SCO Evolutionary Algorithms are designed for solving non-linear problems. To
use them, you must have a Java runtime environment installed on your computer and enable the
Tools > Options > LibreOffice > Advanced > Use a Java runtime environment setting. If
available, the DEPS Evolutionary Algorithm is the default solver; otherwise, the LibreOffice
CoinMP Linear Solver is used by default.
These options offer flexibility, allowing you to select the algorithm that best fits your specific
problem—whether linear or non-linear—and your performance needs. For more detailed
information on the available algorithms and their configuration, refer to the Help system.
To use the Solver to solve a mathematical programming problem, you must formulate the
problem as follows:
• Decision variables – a set of n non-negative variables x1, … , xn,. Decision variables
may be real numbers, but generally tend to be integers in many real world problems.
• Constraints – a set of linear equalities or inequalities involving the decision variables.
• Objective function – a linear expression involving the decision variables.
The goal is usually to find values of the decision variables that satisfy the constraints and
maximize or minimize the result of the objective function.
Note
Calc saves solver settings to the ODS file and each tab can have its own model. To
support interoperability, the mechanism to save/load solver configurations is
compatible with Microsoft Excel.
382 | Calc Guide 26.2
Solver dialog
Note
Depending on the configuration of your computer, a message may be displayed the
first time that you select Tools > Solver after starting Calc. The nature of this
message will change dependent on the existence of a Java runtime environment
(JRE) on your system. If no JRE is detected, the message will simply be a warning to
that effect.
In the case where a JRE is detected but the Tools > Options > LibreOffice >
Advanced > Use a Java runtime environment option is disabled, then the
message will include a button to enable that option.
After setting up the data for the problem in your Calc spreadsheet, select Tools > Solver on the
Menu bar to open the Solver dialog (Figure 384).
Figure 384: Solver dialog
Target cell
Type a cell reference to the objective function or select it with the mouse.
Optimize result to
Select Maximum to find the maximum result for the objective function, Minimum to find
the minimum result, or Value of to set it to a specific value. If you select Value of, enter
the required value or a reference to the cell containing that value.
Chapter 11 Data Analysis | 383
By changing cells
Enter the locations of any cells that define your decision variables.
Limiting Conditions
Enter your constraints in the fields in this area:
– Cell reference – enter a cell reference to a decision variable.
– Operator – defines a parameter for a constraint. Available options include <= (less
than or equal to), = (equal to), => (greater than or equal to), Integer (values without
decimals), and Binary (only 0 or 1).
– Value – enter a value or a cell reference to a constraint formula.
– Remove button – deletes the currently-defined constraint.
Tip
Remember that for some of these options, you can minimize the Solver dialog using
the associated Shrink / Expand buttons if you need to select cells with the mouse.
After setting up the Solver, click the Solve button to begin adjusting values and calculating
results. Depending on the complexity of the problem, this process may take some time. To
restart, click the Reset All button, which clears the data entered in the Solver dialog (Figure
384).
If you are using the DEPS or SCO Evolutionary Algorithm, Calc may occasionally pause the
solver engine to display the Solver Status dialog (Figure 385). This dialog provides diagnostic
information about the engine’s current progress, which can be useful for advanced users. Click
OK to close the dialog and complete the calculations, or click Continue to process one more
step, with updated diagnostic information appearing at the next pause. By default, the Solver
Status dialog is enabled, but you can disable it by unchecking the Show enhanced solver
status option in the Solver Options dialog.
Figure 385: Solver Status dialog
On successful completion, Calc presents a Solving Result dialog (Figure 386). This dialog
includes buttons to save (Keep Result) or discard (Restore Previous) your results.
384 | Calc Guide 26.2
Figure 386: Solving Result dialog
The Options button (Figure 384) opens the Options dialog shown in Figure 387.
Solver options
Figure 387: Solver Options dialog
Solver engine
With the standard LibreOffice download, and an enabled Java runtime environment, the
Solver engine drop-down list provides five options:
– DEPS Evolutionary Algorithm
– SCO Evolutionary Algorithm
– LibreOffice CoinMP Linear Solver
– LibreOffice Linear Solver
– LibreOffice Swarm Non-Linear Solver (experimental)
Settings
This area enables the user to adjust the detailed processing parameters of the selected
solver engine, and the options available vary between engines.
Chapter 11 Data Analysis | 385
Figure 388: Solver Options settings dialog
Selecting the Generate sensitivity report setting (Figure 388) results in the creation of a new
sheet named Model_Sensitivity (Figure 389).
Figure 389: Sensitivity report
386 | Calc Guide 26.2
Solver example
Suppose that you have $10,000 that you want to invest in two mutual funds for one year. Fund X
is a low risk fund with an 8% interest rate and Fund Y is a higher risk fund with a 12% interest
rate. How much money should be invested in each fund to earn a total interest of $1,000?
To find the answer using the Solver:
1) Enter the following labels and data into a worksheet:
– Row labels: Fund X, Fund Y, and Total in cells A2, A3, and A4.
– Column labels: Interest earned, Amount invested, Interest rate, and Time period in
cells B1 thru E1.
– Interest rates: 8% and 12% in cells D2 and D3.
– Time period: 1 in cells E2 and E3.
– Total amount invested: $10000 in cell C4.
– Enter an arbitrary value ($0 or leave blank) in cell C2 as the amount invested in
Fund X.
2) Enter the following formulas:
– In cell C3, enter the formula =C4–C2 (total amount – amount invested in Fund X) as
the amount invested in Fund Y.
– In cells B2 and B3, enter the formulas =C2*D2*E2 (B2) and =C3*D3*E3 (B3).
– In cell B4, enter the formula =B2+B3 as the total interest earned. Figure 390 shows
the worksheet at this point.
Select Tools > Solver on the Menu bar to open the Solver dialog (Figure 384).
Figure 390: Solver example setup
3) Using the Target cell field, select the cell that contains the target value. In this example,
it is B4, which contains the total interest value.
4) Select Value of and enter 1000 in the field next to it. In this example, the target cell
value is 1000 because your target is a total interest earned of $1,000.
5) Using the By changing cells field, select cell C2 in the sheet. In this example, you need
to find the amount invested in Fund X (cell C2).
6) Enter the following limiting conditions for the variables by using the Cell reference,
Operator, and Value fields:
– C2 <= C4 – the amount invested in Fund X cannot exceed the total amount
available.
– C2 => 0 – the amount invested in Fund X cannot be negative.
– C2 is an Integer – specified for convenience.
7) Click Solve. The result is shown in Figure 391.
Chapter 11 Data Analysis | 387
Figure 391: Solver example result
Using Statistics tools
The tools found under Data > Statistics on the Menu bar (Figure 392) are useful for quick and
easy statistical analysis of your data.
Figure 392: Statistics menu
These tools are described in the subsections that follow.
Sampling tool
Selecting Data > Statistics > Sampling on the menu bar opens the Sampling dialog shown in
Figure 34. The Sampling tool creates a target table with data sampled from a source table. It can
pick samples randomly or periodically. Sampling is done by rows, with whole rows of the source
table copied into rows of the target table.
Figure 393: Sampling dialog
388 | Calc Guide 26.2
Input range
Specifies the cell range containing the source table.
Results to
Specifies the top left cell of the target table. When you run the tool, it will fill out the rest
of the target table starting from this cell. Be careful, Calc will replace any data that is in
the range of the table to be created.
Random
Enables random sampling mode when selected.
Sample size
Defines the number of lines to be sampled from the source table during random
sampling. Only available if the Random option is selected. If With replacement is
deselected, the maximum value that can be entered in this field is limited to the number
of rows in the source table.
With replacement
When this option is selected, a sample drawn from the source table can be returned to
the pool, making it eligible for re-sampling. This allows the sample size to exceed the
number of rows in the source table. If the option is not selected, samples cannot be re-
used, and the sample size is limited to the number of rows in the source table. For
periodic sampling, this option is automatically disabled. Note that the With replacement
and Keep order options cannot be selected at the same time.
Keep order
If this option is selected, samples are drawn from the source table in order of the data in
the source table. If deselected, samples are drawn in random order from the source
table. This option is automatically selected for periodic sampling. It is not possible to
have both With replacement and Keep order options selected simultaneously.
Periodic
Enables periodic sampling mode when selected.
Period
Defines the number of lines to skip between samples during periodic sampling. For
example, a value of 2 will cause alternate lines to be sampled from the source table,
starting with the second line. Only available if the Periodic option is selected. The
maximum value that can be entered in this field is limited to the number of rows in the
source table.
Tip
The Shrink / Expand buttons in the upper-right corner of the dialog may be used to
shrink the dialog using the mouse.
Figure 394 shows the source table (below the Source Data heading) and the corresponding
target table (under the Target Data heading), sampled using the settings shown in Figure 393.
Chapter 11 Data Analysis | 389
Figure 394: Example data for the Sampling tool
Descriptive Statistics tool
Selecting Data > Statistics > Descriptive Statistics on the Menu bar opens the Descriptive
Statistics dialog (Figure 395). Given a set of data, this tool creates a tabular report of the data
set’s primary statistical properties, such as information about its central tendency and variability.
Figure 395: Descriptive Statistics dialog
Input range
Specifies the cell range containing the source data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will fill out the rest
of the report table starting at this cell. Be careful, Calc will replace any data that is in the
range of the table to be created.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
Figure 396 shows a small data set comprising student examination results in three subjects.
390 | Calc Guide 26.2
Figure 396: Input data for descriptive statistics analysis
Figure 397 shows the statistics report generated for this input data using the settings shown in
Figure 395.
Figure 397: Results from Descriptive Statistics tool
Tip
For more information on descriptive statistics, refer to the corresponding Wikipedia
article at [Link]
Analysis of Variance (ANOVA) tool
Selecting Data > Statistics > Analysis of Variance (ANOVA) on the Menu bar opens the
Analysis of Variance (ANOVA) dialog (Figure 398). This tool compares the means of two or more
groups in a sample.
Input range
Specifies the cell range containing the source data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will fill out the
analysis of variance report table starting at this cell. Be careful, Calc will replace any
data that is in the range of the table to be created.
Chapter 11 Data Analysis | 391
Figure 398: Analysis of Variance (ANOVA) dialog
Single factor / Two factor
Determines whether the analysis is for single factor or two factor ANOVA.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows. Only
available if Single factor is selected.
Alpha
In this field, enter a significance level in the range 0.01 to 0.99. The default is 0.05.
Rows per sample
Defines how many rows a sample has. This option is always set to 1 in this version of
Calc.
To illustrate how to use this tool, we use the input data set from Figure 396. Figure 399 shows
the analysis of variance results generated for this data using the settings shown in Figure 398.
Figure 399: Results from Analysis of Variance (ANOVA) tool
Tip
For more information on analysis of variance, refer to the corresponding Wikipedia
article at [Link]
392 | Calc Guide 26.2
Correlation tool
The Correlation tool measures the relationship between two sets of numeric data and calculates
the correlation coefficient. This coefficient, ranging from -1 to +1, indicates the strength and
direction of the relationship between the two variables. A coefficient of +1 signifies a perfect
positive correlation (the data sets align perfectly), while a coefficient of -1 represents a perfect
negative correlation (the data sets are completely inverse). To use this tool, go to Data >
Statistics > Correlation in the Menu bar to open the Correlation dialog (Figure 400).
Figure 400: Correlation dialog
Input range
Specifies the cell range containing the source data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will fill out the
correlation coefficient table starting at this cell. Be careful, Calc will replace any data
that is in the range of the table to be created.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
To illustrate how to use this tool, we again use the data set from Figure 396. Figure 401 shows
the correlation coefficients generated for this input data using the settings shown in Figure 400.
Figure 401: Correlation results
Tip
For more information on statistical correlation, refer to the corresponding Wikipedia
article at [Link]
Covariance tool
Selecting Data > Statistics > Covariance on the Menu bar opens the Covariance dialog (Figure
402). This tool measures how much two sets of numeric data vary together.
Chapter 11 Data Analysis | 393
Figure 402: Covariance dialog
Input range
Specifies the cell range containing the source data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will fill out the
covariance table starting at this cell. Be careful, Calc will replace any data that is in the
range of the table to be created.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
To illustrate how to use this tool, we again use the data set from Figure 396. Figure 403 shows
the six covariance values generated for this input data using the settings shown in Figure 402.
Figure 403: Covariance results
Tip
For more information on statistical covariance, refer to the corresponding Wikipedia
article at [Link]
Exponential Smoothing tool
Selecting Data > Statistics > Exponential Smoothing on the Menu bar opens the Exponential
Smoothing dialog (Figure 404). This tool filters a data set to produce smoothed results. It is used
in domains such as stock market analysis and in sampled measurements.
394 | Calc Guide 26.2
Figure 404: Exponential Smoothing dialog
Input range
Specifies the cell range containing the source data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will generate
smoothed results starting at this cell. Be careful, Calc will replace any data that is in the
range of the table to be created.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
Smoothing factor
Enter a value here between 0 and 1 (default is 0.2) that represents the damping factor
alpha in the smoothing equation.
To illustrate how to use this tool, we use the data set shown in Figure 405. The table has two
time series representing impulse functions at times t=0 and t=2.
Figure 405: Input data set for exponential smoothing example
Figure 406 shows the smoothed results for this input data using the settings shown in Figure
404. In the result table, it is possible to change the outcome by varying the Alpha parameter.
Tip
For more information on exponential smoothing, refer to the corresponding Wikipedia
article at [Link]
Chapter 11 Data Analysis | 395
Figure 406: Results from Exponential Smoothing tool
Moving Average tool
Selecting Data > Statistics > Moving Average on the Menu bar opens the Moving Average
dialog (Figure 407). This tool calculates the moving average of a time series data set.
Figure 407: Moving Average dialog
Input range
Specifies the cell range containing the source data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will generate the
moving average results starting at this cell.
Trim input range to actual data content
Specifies whether to allow trimming of the input range to the actual data content before
computing the moving average. Enabled by default to provide better performance.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
Interval
Specifies the number of samples used in the moving average calculation (the default
value is 2).
396 | Calc Guide 26.2
To illustrate how to use this tool, we again use the data set from Figure 405. Figure 408 shows
the moving averages calculated for this input data using the settings shown in Figure 407.
Tip
For more information on the moving average, refer to the corresponding Wikipedia
article at [Link]
Figure 408: Calculated moving averages
Regression tool
Selecting Data > Statistics > Regression on the Menu bar opens the Regression dialog (Figure
409).This tool performs linear, logarithmic, or power regression analysis of a data set comprising
one dependent variable and multiple independent variables.
Independent variable(s) (X) range
Specifies the cell range containing the independent variables in the source data.
Dependent variable (Y) range
Specifies the cell range containing the dependent variable in the source data.
Both X and Y ranges have labels
Specifies whether the ranges above include data labels.
Results to
Defines the top-left cell of the results area. When the tool is executed, the regression
analysis table will begin at this specified cell. Note that Calc will overwrite any existing
data within the range occupied by the generated table.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
Linear Regression
Select this option to use linear regression. Linear regression finds a linear function in
the form of y = b + a1.[x1] + a2.[x2] + a3.[x3] ..., where ai is the i-th slope, [xi] is the i-th
independent variable, and b is the intercept that best fits the data.
Chapter 11 Data Analysis | 397
Figure 409: Regression dialog
Logarithmic Regression
Select this option to use logarithmic regression. Logarithmic regression finds a
logarithmic curve in the form of y = b + [Link][x1] + [Link][x2] + [Link][x3] ..., where ai is
the i-th coefficient, b is the intercept and ln[xi] is the natural logarithm of the i-th
independent variable, that best fits the data.
Power Regression
Select this option to use power regression. Power regression finds a power curve in the
form of y = exp(b + [Link][x1] + [Link][x2] + [Link][x3] ...), where ai is the i-th power, [xi] is
the i-th independent variable, and b is intercept that best fits the data.
Confidence level
Specifies the confidence level, which is a value between 0 and 1. The default value is
0.95. Calc uses this percentage to compute the corresponding confidence intervals for
each of the estimates (namely the slopes and intercept)
Calculate residuals
Select whether to opt in or out of computing the residuals, which may be beneficial in
cases where you are interested only in the slopes and intercept estimates and their
statistics. The residuals give information on how far the actual data points deviate from
the predicted data points, based on the regression model.
Force intercept to be zero
Specifies whether to force the regression intercept to be 0.
Tip
Calc utilizes the small, otherwise blank area above the Help, OK, and Cancel
buttons to provide feedback on erroneous selections on the dialog. For example, the
text “Independent variable(s) range is not valid.” appears if a valid cell range has not
398 | Calc Guide 26.2
been entered in the Independent variable(s) (X) range field. In this circumstance, the
OK button is disabled until the error is corrected.
To illustrate how to use this tool, we use the data set shown in Figure 410. This table contains
measurements taken at 1 second intervals. Figure 411 shows the regression outputs calculated
for this input data using the settings shown in Figure 409.
Figure 410: Input data set for regression analysis
Tip
For more information on regression analysis, refer to the corresponding Wikipedia
article at [Link]
Figure 411: Linear regression outputs
Chapter 11 Data Analysis | 399
Paired t-test tool
Selecting Data > Statistics > Paired t-test on the Menu bar opens the Paired t-test dialog
(Figure 412). This tool compares the population means of two related sample sets and
determines the difference between them.
Variable 1 range
Specifies the cell range containing the first set of input data.
Variable 2 range
Specifies the cell range containing the second set of input data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will generate the
paired t-test table starting at this cell. Be careful, Calc will replace any data that is in the
range of the table to be created.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
Figure 412: Paired t-test dialog
To provide an example of using this tool, we make use of the input data set shown in Figure 413.
The data sets in columns A and B represent two sets of paired values referred to as Variable 1
and Variable 2.
Figure 413: Input data for paired t-test example
Figure 414 shows the paired t-test results calculated for this input data using the settings shown
in Figure 412.
In the resulting table, it is possible to insert different values for Alpha and Hypothesized Mean
Difference. The t values (Stat, Critical one-tail, and Critical two-tail) will be updated automatically.
400 | Calc Guide 26.2
Tip
For more information on paired t-tests, refer to the corresponding Wikipedia article at
[Link]
Figure 414: Results from Paired t-test tool
F-test tool
Clicking Data > Statistics > F-test on the Menu bar opens the F-test dialog shown in Figure 415
and define the required inputs to the [Link] tool calculates the F-test of two data samples to
test the hypothesis that the variance of two populations are equal.
Figure 415: F-test dialog
Variable 1 range
Specifies the cell range containing the first set of input data.
Variable 2 range
Specifies the cell range containing the second set of input data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will generate the
F-test table starting at this cell. Be careful, Calc will replace any data that is in the range
of the table to be created.
Chapter 11 Data Analysis | 401
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
To illustrate how to use this tool, we again use the data set from Figure 413. In this case, the
data in columns A and B represent two independent sample sets, referred to as Variable 1 and
Variable 2. Figure 416 shows the F-test results calculated for this input data using the settings
shown in Figure 415.
In the resulting table, it is possible to insert different values for Alpha. The F Critical values (right-
tail, left-tail, and two-tail) will be updated automatically.
Tip
For more information on F-tests, refer to the corresponding Wikipedia article at
[Link]
Figure 416: Results from F-test tool
Z-test tool
Clicking Data > Statistics > Z-test on the Menu bar opens the Z-test dialog shown in Figure 417
and define the required inputs to the tool. This tool calculates the Z-test of two data samples. It
performs a two sample Z-test to test the null hypothesis that there is no difference between the
means of the two data sets. The Z-test works better than the Paired t-test tool for large samples
(n > 30).
Variable 1 range
Specifies the cell range containing the first set of input data.
Variable 2 range
Specifies the cell range containing the second set of input data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will generate the
Z-test table starting at this cell. Be careful, Calc will replace any data that is in the range
of the table to be created.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
402 | Calc Guide 26.2
Figure 417: z-test dialog
To provide an example of using this tool, we again make use of the input data set shown in
Figure 413. In this case the data in columns A and B represent two data sets, referred to as
Variable 1 and Variable 2. Figure 418 shows the Z-test results calculated for this input data using
the settings shown in Figure 417.
Figure 418: Results from Z-test tool
For the Z-test tool to work properly, a known variance for each sample must be inserted in the
related cell. In the example shown in Figure 418, the variances (125.076923 and 94.435897)
were inserted using the formula =VAR(A1:A13) into cell E5 and the formula =VAR(B1:B13)
into cell F5. The subsequent z and P values will be updated automatically.
It is also possible to insert different values for Alpha (cell E2 in the example) and Hypothesized
Mean Difference (cell E3 in the example) inputs. As with the known variances changes described
above, after changing the Alpha and the Hypothesized Mean Difference, the subsequent z and P
values will be updated automatically.
Tip
When analyzing the Z-test results, compare the selected Alpha level with the
appropriate calculated P value (depending on whether a one-tailed or two-tailed test
is required). If the calculated P value is smaller than the Alpha level, the hypothesis
(which, in the example given, is that the means of the two data sets are the same)
should be rejected.
Chapter 11 Data Analysis | 403
Tip
For more information on z-tests, refer to the corresponding Wikipedia article at
[Link]
Chi-Square Test tool (Test of Independence)
Selecting Data > Statistics > Chi-square Test on the Menu bar opens the Test of
Independence (Chi-Square) dialog shown below. This tool calculates the chi-square test of a
data sample, which determines how well a set of measured values fit a corresponding set of
expected values.
Input range
Specifies the cell range containing the source data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will generate the
Chi-square table starting at this cell. Be careful, Calc will replace any data that is in the
range of the table to be created.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
Figure 419: Test of Independence (Chi-Square) dialog
To provide an example of using this tool, we again make use of the input data set shown in
Figure 413. In this case the data in column A is the observed data while the data in column B are
the corresponding expected values. Figure 420 shows the chi-square results calculated for this
input data using the settings shown in Figure 413.
Figure 420: Results of chi-square test
In the resulting table, it is possible to insert different values for Alpha. The Critical Value will be
updated automatically.
Tip
For more information on chi-square tests, refer to the corresponding Wikipedia article
at [Link]
404 | Calc Guide 26.2
Fourier Analysis tool
Selecting Data > Statistics > Fourier Analysis on the Menu bar opens the Fourier Analysis
dialog (Figure 421). This tool performs the Fourier analysis of a data set by computing the
Discrete Fourier Transform (DFT) of an input array of complex numbers, using Fast Fourier
Transform (FFT) algorithms.
Figure 421: Fourier Analysis dialog
Input range
Specifies the cell range containing the source data. Usually a 2 x N or N x 2 range
representing an array of complex numbers to be transformed, where N is the length of
the array. The array contains the real and imaginary parts of the data.
Results to
Specifies the top left cell of the results area. When you run the tool, it will generate the
Fourier transform table starting at this cell. Be careful, Calc will replace any data that is
in the range of the table to be created.
Input range has label
Specifies whether the first row or column of the input array is a label and not part of the
data to be analyzed.
Columns / Rows
Specifies whether the data to be analyzed is organized in columns or rows.
Inverse
If ticked, the tool calculates an inverse Discrete Fourier Transform.
Output in polar form
If ticked, the tool outputs the results in polar coordinates (that is, magnitude and phase).
Minimum magnitude for polar form output
This option is only relevant when you select to output results in polar form. All frequency
components with magnitude less than the specified value in decibels will be suppressed
with a zero magnitude-phase entry. This is useful when looking at the magnitude-phase
spectrum of a signal because there is always some tiny rounding error when performing
FFT algorithms, which results in incorrect non-zero phase for non-existent frequencies.
Chapter 11 Data Analysis | 405
By providing a suitable value to this parameter, these non-existent frequency
components can be suppressed.
Tip
Calc utilizes the small, otherwise blank area above the Help, OK, and Cancel
buttons to provide feedback on erroneous selections on the dialog. For example, the
text “Output address is not valid.” appears if a valid cell range has not been entered
in the Results to field. In this circumstance, the OK button is disabled until the error is
corrected.
To provide an example of using this tool, we make use of the input data set shown in columns B
(real values) and C (imaginary values) of the spreadsheet shown in Figure 422. The data shown
in columns E (real values) and F (imaginary values) of the spreadsheet are the Fourier transform
results calculated by the tool for this input data, using the settings shown in Figure 421.
Figure 422: Fourier analysis tool - example input data and results
406 | Calc Guide 26.2
Note
The Fourier Analysis tool uses different algorithms depending on the length of the
input sequence. If the sequence length is an even power of 2, a radix-2 decimation-
in-time FFT algorithm is applied. For sequences of other lengths, Bluestein’s FFT
algorithm is used. This detail may be of interest to those with a technical background
in algorithms.
Tip
For more information on Fourier analysis, refer to the corresponding Wikipedia article
at [Link]
Chapter 11 Data Analysis | 407
Calc Guide 26.2
Chapter 12
Linking Data
Sharing data in and out of Calc
Using multiple sheets
Why use multiple sheets?
Chapter 1, Introduction, introduced the concept of multiple sheets in a spreadsheet. Multiple
sheets help keep information organized; once you link those sheets together, you unleash the
full power of Calc. Consider this case:
John is having trouble keeping track of his personal finances.
He has several bank accounts and the information is
scattered and disorganized. He can’t get a good grasp on his
finances until he can see everything at once.
To resolve this, John decides to track his finances in
LibreOffice Calc. John knows Calc can do simple
mathematical computations to help him keep a running tab of
his accounts, and he wants to set up a summary sheet so
that he can see all of his account balances at once.
Note
For users with experience of using Microsoft Excel: what Excel calls a workbook,
Calc calls a spreadsheet (the whole document). Both Excel and Calc use the terms
sheet and worksheet.
Setting up multiple sheets
Chapter 1, Introduction, gives a detailed explanation of how to set up multiple sheets in a
spreadsheet. Here is a quick review.
Identifying sheets
When you open a new spreadsheet it has, by default, one sheet named Sheet1. You can specify
a different number of sheets to be created in a new document, or a different prefix name for new
sheets, by going to Tools > Options > LibreOffice Calc > Defaults on the Menu bar (Figure
423).
Figure 423: Options > LibreOffice Calc > Defaults dialog
Sheets in Calc are managed using tabs located at the bottom of the spreadsheet.
Inserting new sheets
There are several ways to insert a new sheet. The fastest method is to click on the Add Sheet
(+) icon located to the left of the sheet tabs, at the bottom of the spreadsheet. This inserts one
new sheet without opening any dialog, with a default name (Sheet2, for example) and with the
new sheet’s tab positioned at the right-hand end of the sheet tabs.
410 | Calc Guide 26.2
Use one of these other methods to insert more than one sheet, to rename the sheet at the same
time, or to insert the sheet somewhere else in the sequence.
• Left-click a sheet tab and select Sheet > Insert Sheet on the Menu bar. Calc displays
the Insert Sheet dialog with the Before current sheet and New sheet options
preselected.
• Select Sheet > Insert Sheet at End on the Menu bar. Calc displays the Append Sheet
dialog.
• Select Sheet > Insert Sheet from File on the Menu bar. Calc displays the Insert Sheet
dialog with the Before current sheet and From file options preselected. Click on the
Browse button to open a file browser dialog to enable you to select the source file
containing the sheet to be inserted.
• Right-click on a sheet tab and select Insert Sheet in the context menu (Figure 424).
Calc displays the Insert Sheet dialog with the Before current sheet and New sheet
options preselected.
• Right-click in the empty space at the right end of the line of sheet tabs and select Insert
Sheet in the context menu (Figure 424). Calc displays the Insert Sheet dialog with the
Before current sheet and New sheet options preselected.
Figure 424: Creating a new sheet through the sheet tabs area
The above methods use either the Insert Sheet dialog (Figure 425) or the Append Sheet dialog
(Figure 426).
Figure 425: Insert Sheet dialog
Chapter 12 Linking Data | 411
Figure 426: Append Sheet dialog
On the Insert Sheet dialog, you can:
• Choose whether to put the new sheet before or after the currently selected sheet tab.
• Choose how many sheets to insert.
• Choose the name for a single sheet (the Name field is unavailable if more than one
sheet is to be inserted).
The From file option is described in “Inserting sheets from a different spreadsheet” below.
For John’s spreadsheet we need six sheets, one for each of his five accounts and one as a
summary sheet. 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.
After creating a new spreadsheet with one sheet, we could:
• Insert five new sheets and rename all six sheets afterward
• Rename the existing sheet, then insert the five new sheets one at a time, renaming
each new sheet during the insert step.
To insert sheets and rename them afterward:
1) Make sure that the correct sheet tab is selected and open the Insert Sheet dialog.
2) Choose the position for the new sheets (in this example, we use After current sheet).
3) Choose New sheet and enter 5 after No. of sheets:. Because you are inserting more
than one sheet, the Name box is not available.
4) Click OK to insert the sheets.
For the subsequent steps to rename the sheets, see “Renaming sheets” (below).
To insert a sheet and name it at the same time:
1) Rename the existing sheet as Summary, as described in “Renaming sheets” (below).
2) Make sure that the correct sheet tab is selected and open the Insert Sheet dialog.
3) Choose the sheet tab position for the new sheet (Before current sheet or After
current sheet, as applicable).
4) Choose New sheet and enter 1 in the No. of sheets field. The Name box is now
available.
5) In the Name box, type a name for this new sheet, for example Checking Account.
6) Click OK to insert the sheet.
Repeat steps 2) to 6) for each new sheet, giving them the names Savings Account, Credit Card
1, Credit Card 2, and Car Loan.
Inserting sheets from a different spreadsheet
On the Insert Sheet dialog, you can also add a sheet from a different spreadsheet (for example,
another Calc or Microsoft Excel file), by choosing the From file option. Click Browse, select the
412 | Calc Guide 26.2
file using the file browser dialog, and click Open. A list of the available sheets in that file appears
in the adjacent list box (Figure 427). Select the sheet to import (you can only import one at a
time). If, after you select the file, no sheets appear, you probably selected an invalid file type (not
a spreadsheet, for example).
Figure 427: From file area of Insert Sheet dialog, with file path and available sheet names
If you prefer, select the Link option to insert the external sheet as a link instead of as a copy.
This is one of several ways to include “live” data from another spreadsheet – see also “Linking to
external data” (below). The links can be updated manually to show the current contents of the
external file using Edit > Links to External Files on the Menu bar. Alternatively the links can be
updated automatically whenever the file is opened, depending on the options set on the dialog
accessed by selecting Tools > Options > LibreOffice Calc > General on the Menu bar. The
three options available in the Update links when opening section are Always (from trusted
locations), On request, and Never.
To define trusted file locations, select Tools > Options > LibreOffice > Security > Macro
Security (Trusted Sources tab) on the Menu bar. All current trusted folders are listed in the
Trusted File Locations section. To add another folder, click on the Add button. This is useful if
you want to use macros in your spreadsheet. For more information about macros and trusted
sources, see Chapter 14, Macros.
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.
• Double-click on the relevant sheet tab and replace the existing name through the
Rename Sheet dialog (Figure 428).
• Right-click on the relevant sheet tab, select Rename Sheet in the context menu, and
replace the existing name through the Rename Sheet dialog.
• Left-click on the relevant sheet tab to select it, select Sheet > Rename Sheet on the
Menu bar, and replace the existing name through the Rename Sheet dialog.
Figure 428: Rename Sheet dialog
A sheet name cannot be empty and must not be a duplicate of an existing name.
Chapter 12 Linking Data | 413
Note
The following characters are not allowed in sheet names: colon (:), backslash (\),
forward slash (/), question mark (?), asterisk (*), left square bracket ([), right square
bracket (]). The apostrophe (') character is not allowed as the first or last character of
the name.
Tip
In some LibreOffice Calc installations you can hold down the Alt key, click on the
sheet name, and enter the new name directly.
Your sheet tab area should now look like this.
Figure 429: Six renamed sheets
Now we will set up the account ledgers. This is just a simple summary that includes the previous
balance plus the amount of the current transaction. For withdrawals, we enter the current
transaction as a negative number so the balance gets smaller. A basic ledger is shown in Figure
430.
This ledger is set up in the sheet named Checking Account. The total balance is added up in cell
F3. You can see the equation for it in the Formula bar. It is the summary of the opening balance,
cell C3, and all the subsequent transactions.
Figure 430: Checking ledger
Moving through sheets
Refer to Chapter 1, “Introduction” to learn more about managing sheets.
Note
To show previously hidden sheets, use the Show Sheet dialog after clicking on
Sheet > Show Sheet menu or right-click on any spreadsheet tab, then select the
Show Sheet menu.
Referencing other sheets
On the Summary sheet we display the balance from each of the other sheets. If you copy the
example in Figure 430 onto each of the five account sheets, the current balances will be in cell
F3 of each sheet.
414 | Calc Guide 26.2
There are two ways to reference cells in other sheets: by entering the formula directly using the
keyboard or by using the mouse.
Creating the reference with the mouse
On the Summary sheet, set up a place for all five account balances, so we know where to put
the cell reference. Figure 431 shows the Summary sheet with a blank Balance column. We want
to place the reference for the Checking Account balance in cell B3.
Figure 431: Blank Summary sheet
To make the cell reference in cell B3, select the cell and follow these steps:
1) Click on the = icon next to the Input line on the Formula bar or, press Ctrl + Shift +
F2. The icons on the Formula bar change and an equal character appears in the Input
line (Figure 432).
Figure 432: Equals character in Input line of Formula bar
2) Now, click on the sheet tab for the sheet containing the cell to be referenced. In this
case, that is the Checking Account sheet (Figure 433).
Figure 433: Click on the Checking Account sheet tab
3) Click on cell F3 (where the balance is) in the Checking Account sheet. The phrase
$'Checking Account'.F3 should appear in the Input line (Figure 434) and the
selected cell is surrounded by a colored border.
Chapter 12 Linking Data | 415
Figure 434: Cell reference selected
4) Click the Accept icon in the Input line of the Formula bar, or press the Enter key to
finish.
5) The Summary sheet should now look like Figure 435.
Figure 435: Finished Checking Account reference
Creating the reference with the keyboard
From Figure 435, you can deduce how the cell reference is constructed. The reference has two
parts: the sheet name prefixed by a dollar symbol ($'Checking Account'), and the cell
reference (F3). Notice that they are separated by a period. The default behavior of Calc is to
insert the dollar symbol to form an absolute sheet reference while giving a relative cell reference.
Note
The sheet name is in single quotation marks because it contains a space, and the
mandatory period (.) always falls outside any quotation marks.
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 (Figure 436).
Figure 436: Savings Account cell reference
416 | Calc Guide 26.2
Protect spreadsheet structure
When you are satisfied with the structure of your spreadsheet in terms of its constituent sheets,
select Tools > Protect Spreadsheet Structure on the Menu bar to lock that structure. Calc
displays the Protect Spreadsheet Structure dialog (Figure 437). Press OK to inhibit the addition,
deletion, repositioning, and renaming of sheets from unauthorized users. Cell editing is still
possible. To subsequently unlock the structure, select Tools > Protect Spreadsheet Structure
again. See more on the “Cell protection” section in Chapter 3, Getting Started with Calc from the
Getting Started Guide.
Figure 437: Protect Spreadsheet Structure dialog
Caution
Spreadsheet structure protection must not be used for data protection or privacy. Its
purpose is to prevent accidental editing.
Referencing other documents
John decides to keep his family account information in a different spreadsheet file from his own
summary. Fortunately Calc can link different files together. The process is the same as described
for different sheets in a single spreadsheet, but we add one more step to indicate which file the
sheet is in.
Creating the reference with the mouse
To create the reference with the mouse, both spreadsheets need to be open.
1) If necessary, switch to the spreadsheet containing the cell in which the formula is going
to be entered.
2) Select the cell in which the formula is going to be entered.
3) Click the = icon next to the Input line in the Formula bar.
4) Switch to the other spreadsheet (the process to do this may vary depending on which
operating system you are using).
5) Select the sheet (Savings Account) and then the reference cell (F3); see Figure 438.
You can press the keyboard Enter key at this point, or continue with steps 6) and 7).
Chapter 12 Linking Data | 417
Figure 438: Selecting the Savings Account reference cell
6) Switch back to the original spreadsheet.
7) Click the Accept icon in the Formula bar.
Your spreadsheet should now resemble Figure 439.
You will get a good feel for the format of the reference if you look closely at the Input line in the
Formula bar. Based on the contents of this line, you can create the reference using the
keyboard.
Figure 439: Linked files
Creating the reference with the keyboard
Typing the reference is simple once you know the format the reference takes. The reference has
three parts to it:
• Path and file name
• Sheet name
• Cell reference
In Figure 439, you can see that the general format for the reference is:
='[Link] & File Name'#$'SheetName'.CellReference
Note
The reference for a file has three forward slashes ///, while the reference for an
Internet hyperlink has two forward slashes //. See “Using hyperlinks and URLs”
below.
Using hyperlinks and URLs
Hyperlinks can be used in Calc to jump to a different location from within a spreadsheet and can
lead to other parts of the current file, to different files, or even to web pages.
Relative and absolute hyperlinks
Hyperlinks stored within a file can be either relative or absolute.
418 | Calc Guide 26.2
A relative hyperlink says, Here is how to get there starting from where you are now (meaning
from the folder in which your current document is saved), while an absolute hyperlink says, Here
is how to get there no matter where you start from.
An absolute link will stop working if the target is moved. A relative link will stop working if the
start and target locations change relative to each other. For instance, if you have two
spreadsheets in the same folder linked to each other, and you move the entire folder to a new
location, an absolute hyperlink will break, but a relative one will not.
To change the way that Calc stores the hyperlinks in your file, select Tools > Options >
Load/Save > General and in the Save area of the dialog, choose if you want URLs (Universal
Resource Locators) saved relatively when referencing the file system, or the Internet, or both.
An absolute path such as c:\homepage\graphics\[Link] would no longer function on a web
server. Operating systems such as Unix or macOS do not recognize drive letters, and even if the
folder homepage\graphics existed, your picture would not be available. It is better to use relative
linking for file links. Relative linking is only possible when the document you are working on is on
the same drive as the link destination.
Calc will always display an absolute hyperlink. Do not be alarmed when it does this even when
you have saved a relative hyperlink. This ‘absolute’ target address will be updated if you move
the file.
Note
HTML (HyperText Markup Language) files containing links as relative to the file
system that are to be uploaded to a web server require the files be in a file structure
matching that of the web server. Otherwise, the links will point to the wrong folder.
Tip
When you rest the mouse pointer on a hyperlink, a help tip displays the absolute
reference, because Calc uses absolute path names internally. The complete path
and address can only be seen when you view the result of the HTML export (saving
a spreadsheet as an HTML file), by loading the HTML file as text, or by opening it
with a text editor.
Creating hyperlinks
You can insert a hyperlink into a Calc spreadsheet using one of these methods:
• Select the cell or text within a cell that you want to use for your hyperlink text, or place
the text cursor at the point where you want to insert a hyperlink. Select Insert >
Hyperlink on the Menu bar, or click the Insert Hyperlink icon on the Standard toolbar,
or press Ctrl+K, to access the Hyperlink dialog; see “Hyperlink dialog” below.
• Drag-and-drop an item from the Navigator to the point where you want to insert the
hyperlink (for example, a sheet or cell name).
• Type the target web address or URL at the point where you want to insert the hyperlink.
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 color to the text.
If this does not happen, you can enable this feature using Tools > AutoCorrect
Options > Options on the Menu bar and selecting URL Recognition. Make sure you
start the hyperlink with [Link] ftp or www.; if you type only [Link] for
example, Calc will not recognize it as a hyperlink.
Chapter 12 Linking Data | 419
When you use the Hyperlink dialog to insert a hyperlink, you can select either a text hyperlink
(Figure 440) or a button hyperlink (Figure 441) from the Form dropdown list in Further Settings
section. In both cases, the visible text can be different from the linked URL.
Figure 440: Example text hyperlink
Figure 441: Example button hyperlink
To change the color of text hyperlinks, go to Tools > Options > LibreOffice > Appearance on
the Menu bar, go to the section Customizations, then in Items dropdown list, select Unvisited
links and/or Visited links, pick the new colors, and click OK.
Note
This will change the color for all hyperlinks in all components of LibreOffice, which
may not be what you want.
A button hyperlink 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 the Writer Guide.
Opening hyperlinks
To open a text hyperlink, do one of the following:
• Ctrl-click with the mouse pointer positioned over the hyperlink. This method only works
if the Tools > Options > LibreOffice > Security > Security Options and Warnings >
Options > Ctrl-click required to open hyperlinks option is selected.
• Left-click with the mouse pointer positioned over the hyperlink. This method only works
if the Tools > Options > LibreOffice > Security > Security Options and Warnings >
Options > Ctrl-click required to open hyperlinks option is not selected.
• Right-click with the mouse pointer positioned over the selected hyperlink, and select the
Open Hyperlink option in the context menu.
To open a button hyperlink, left-click the button. This method only works when the form design
mode is deactivated; the status of this mode is controlled by clicking the Design Mode button on
either the Form Controls toolbar or the Form Design toolbar.
Hyperlink dialog
You can insert and modify hyperlinks using the Hyperlink dialog (Figure 442). To display this
dialog, choose Insert > Hyperlink on the Menu bar, or click the Insert Hyperlink icon on the
Standard toolbar, or press Ctrl+K.
420 | Calc Guide 26.2
On the left side of the dialog, select one of the four categories of hyperlink:
• Internet. The hyperlink points to a web address or Uniform Resource Locator (URL).
• Mail. The hyperlink points to an email address.
• Document. The hyperlink points to a location in either the current document or another
existing document.
• New Document. Opening the hyperlink creates a new document.
The Further Settings area is provided for all four hyperlink categories. The controls above the
Further Settings area vary dependent on which of the four hyperlink categories is selected on
the left side of the dialog.
A full description of all the choices and their interactions is beyond the scope of this chapter. The
following is a summary of the most common choices used in Calc spreadsheets.
Internet
– URL. Enter the required web address.
– Text. Enter 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.
Figure 442 shows the Hyperlink dialog with the Internet category selected.
Figure 442: Hyperlink dialog showing details for the Internet category
Mail
For Mail hyperlinks, the controls above the Further Settings area change to those
shown in Figure 443.
– Recipient. Enter the email address of the recipient, or select the address from an
existing database accessed by clicking the Data Sources button.
– Subject. Enter the text to be used as the subject line of the message.
The Text field (shown in the Hyperlink Settings area in Figure 442 is provided within the
Further Settings area for Mail, Document, and New Document hyperlinks. Its function
for these hyperlinks is as described above for Internet hyperlinks.
Chapter 12 Linking Data | 421
The Mail hyperlink only works if a mail client is installed.
Figure 443: Mail controls on the Hyperlink dialog
Document
For document hyperlinks, the controls above the Further Settings area change to those
shown in Figure 444.
– Path. Specify the path of the file to be opened. Leave this blank if you want to link to
a target in the same spreadsheet. The Open File icon opens a file browser for you
to locate the document to be opened.
– Target. Optionally specify the target in the document (for example a specific sheet).
Click on the Target in Document icon to open a Navigator window where you can
select the target, or if you know the name of the target, you can type it into the box.
Figure 444: Document controls on the Hyperlink dialog
New Document
For New Document hyperlinks, the controls above the Further Settings area change to
those shown in Figure 445.
– Edit now / Edit later. Specify whether to edit the newly created document
immediately or just create it.
– File. Enter the name of the file to be created. The Select Path icon opens a
directory picker dialog.
– File type. Select the type of document to be created (for example, text document,
spreadsheet, or drawing).
422 | Calc Guide 26.2
Figure 445: New Document controls on the Hyperlink dialog
The Further Settings section on the Hyperlink dialog is common to all the hyperlink categories,
although some choices are more relevant to some types of links and the Text option is omitted
from this area for Internet hyperlinks.
• Set the value of Frame to determine how the hyperlink will open. This applies to
documents that open in a web browser. Options are _top, _parent, _blank, and _self.
• Form specifies if the link is to be presented as text or as a button.
• Text specifies the text that will be visible to the user. If this is left blank, 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.
• Name is applicable to HTML documents. It specifies text that will be added as a NAME
attribute in the HTML code behind the hyperlink.
• Events button: opens the Assign Macro dialog. Select a macro to run when the link is
clicked. This function is not covered further in this chapter.
Editing hyperlinks
To edit an existing text hyperlink, do any of the following:
• If the Tools > Options > LibreOffice > Security > Security Options and Warnings >
Options > Ctrl-click required to open hyperlinks option is selected, then click the cell
containing the hyperlink. Select Insert > Hyperlink on the Menu bar, or click the Insert
Hyperlink icon on the Standard toolbar, or press Ctrl+K.
• Select the cell containing the hyperlink. In some cases you may need to select a nearby
cell that does not contain a hyperlink and use the arrow keys to move the selection to
the hyperlink cell. In other cases, you may need to select the actual hyperlink text.
Select Insert > Hyperlink on the Menu bar, or click the Insert Hyperlink icon on the
Standard toolbar, or press Ctrl+K.
• Right-click on the selected hyperlink text and select the Edit Hyperlink option in the
context menu.
Chapter 12 Linking Data | 423
In all cases, Calc opens the Hyperlink dialog, where you can modify the characteristics of the
hyperlink.
For a button hyperlink, the spreadsheet must have the form design mode enabled in order to edit
the hyperlink. With the button selected, select Insert > Hyperlink on the Menu bar, or click the
Insert Hyperlink icon on the Standard toolbar, or press Ctrl+K. Make your changes and click
OK.
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.
You can also edit a button hyperlink by selecting the button (with form design mode enabled),
right-clicking, and selecting Control Properties in the context menu. Calc displays the
Properties dialog. Modify the button text by editing the Label field and modify the link address by
editing the URL field. Note that the Properties dialog do not contain an OK button, so after
executing the desired changes, just close the dialog.
Removing hyperlinks
To remove a text or button hyperlink from the document completely, select it and use one of the
many available deletion mechanisms (for example, select Edit > Cut on the Menu bar or Cut on
the Standard toolbar; or right-click on the hyperlink and select Cut in the context menu; or press
Backspace or Delete on the keyboard).
To delete just the hyperlink data and keep the text visible for the user, apply one the techniques
already described for editing hyperlinks. Instead of modifying the URL, just remove it. Or, select
the hyperlink text, right-click on it and select Remove Hyperlink from the context menu.
Linking to external data
You can insert data from another document into a Calc spreadsheet as a link.
Two methods are described in this section: using the External Data dialog and using the
Navigator. If your file has named ranges, database ranges, or named tables, and you know the
name of the range or table you want to link to, using the External Data dialog is quick and easy.
However, if the file has several ranges and tables, and you want to pick only one of them, you
may not be able to easily determine which is which; in that case, the Navigator method may be
easier.
Calc provides other methods for including linked data from external sources, see for example
“Linking to registered data sources” (below) and “Dynamic Data Exchange (DDE)” (below).
Note
When you open a spreadsheet that contains links to external data, depending on
your settings you may be prompted to update the links or they may be updated
automatically. Depending on where the linked spreadsheets are stored, the update
process can take several minutes to complete.
Using the External Data dialog
The External Data dialog inserts data from an HTML, Calc, CSV (Comma-Separated Values), or
Microsoft Excel file into the current sheet as a link. Calc utilizes a Web Page Query import filter,
enabling you to insert tables from HTML documents.
To insert a link to external data using the External Data dialog:
1) Open the Calc document where the external data is to be inserted. This is the target
document.
424 | Calc Guide 26.2
2) Select the cell where the upper left cell of the external data is to be inserted.
3) Choose Sheet > External Links on the Menu bar. Calc displays the External Data
dialog (Figure 446).
Figure 446: External Data dialog
4) Type the URL of a web resource that is to be used as a data source, or type the
address of a source file, or select an entry in the drop-down list, or select a source file
from the file selection dialog accessed through the Browse button. For entries typed in,
press Enter on completion.
5) If you selected a HTML file as the data source at step 4), Calc displays the Import
Options dialog (Figure 447). On this dialog you can choose the import language of the
site. Select Automatic to let Calc import the data directly, or select Custom and choose
from the drop-down list of languages available. You can also select the option to have
Calc recognize special numbers, such as dates, on import.
Figure 447: Import Options dialog
d) Click OK on the Import Options dialog. Calc loads the list of available tables/ranges
into the Available Tables/Ranges area of the External Data dialog. The Web Page
Query import filter can create names for cell ranges as they are imported. As much
formatting as possible is retained while the filter intentionally does not import any
images. The filter additionally creates two additional entries in the list: HTML_all to
permit selection of the entire document and HTML_tables to permit selection of all
the tables. Where a HTML table has a caption element, the text of the caption is
appended to the associated entry in the list of available tables and ranges (Figure
448) and this helps identify a table of interest when there are many listed.
Chapter 12 Linking Data | 425
Figure 448: External Data dialog, with table captions
e) In the Available Tables/Ranges area, select the named ranges or tables you want to
insert (hold Ctrl to select multiple entries). The OK button then becomes available.
6) If you selected a CSV file as the data source at step 4), Calc displays the Text Import
dialog (Figure 449). This dialog is described in detail in Chapter 1, Introduction. Click
OK on the Text Import dialog and select CSV_all in the Available Tables/Ranges area of
the External Data dialog. The OK button then becomes available.
Figure 449: Text import dialog
7) If you selected a Calc or Microsoft Excel file as the data source at step 4), Calc
populates the Available Tables/Ranges area of the External Data dialog with the list of
426 | Calc Guide 26.2
range names and database ranges that are defined in the source file. Select the range
names and database ranges that you want to insert (hold Ctrl to select multiple
entries) and the OK button then becomes available.
Note
If the source Calc or Microsoft Excel spreadsheet contains no range names or
database ranges, then you cannot use that document as the source file in the
External Data dialog.
8) For all external data source file types, you can also specify that the data is refreshed at
a specific frequency, defined in seconds.
9) Click OK to close the External Data dialog and insert the linked data.
Calc adds the new entry to the Linked areas list in the Navigator (Figure 451). If you double-click
this entry, Calc highlights the linked data within the sheet. When you hover the mouse pointer
over the entry, a tooltip indicates the file location of the linked data.
To view a list of all external data links in the spreadsheet, select Edit > Links to External Files
on the Menu bar. Calc displays the Edit Links dialog (Figure 450).
Figure 450: Edit Links dialog
Figure 451: Linked areas in the Navigator
Chapter 12 Linking Data | 427
Note
The Edit Links dialog can display information about other links that were not created
using the External Data dialog.
For links that have been created using the External Data dialog, you can access that dialog
again by selecting the link on the Edit Links dialog and clicking the Modify button, or double-
clicking the link. If you click Break Link and confirm that you want to remove the selected link,
the previously-linked data becomes embedded in the spreadsheet. Click Update to refresh the
linked data in the target file so that it matches that in the source file.
Note
The Status column on the Edit Links dialog always shows Manual for a link created
using the External Data dialog. The status shown in this column does not reflect the
setting of the Update every … seconds option on the External Data dialog.
Using the Navigator
You can also use the Navigator dialog or the Navigator deck of the Sidebar to link external data.
Access the Navigator dialog by selecting View > Navigator on the Menu bar, or pressing F5.
See Chapter 1, Introduction, for more details about the Navigator.
To insert a link to external data using the Navigator:
1) Open the Calc spreadsheet in which the external data is to be inserted (target
document).
2) Open the document from which the external data is to be taken (source document) in
Calc. The source document does not need to be a Calc file; it could, for example, be a
Microsoft Excel file, an HTML file, or a CSV file. The selected spreadsheet source must
contain named ranges to be detected as importable regions. In the case of a HTML file,
Calc displays the Import Options dialog (Figure 447) before opening the file.
3) In the target document, open the Navigator (Figure 452). This illustration shows the
Navigator for a new file called Untitled 1, which currently has no range names, database
ranges, or linked areas.
Figure 452: Navigator for target file
428 | Calc Guide 26.2
4) At the bottom of the Navigator, select the source document in the drop-down menu
(Figure 453). In this case the source is called summary-indices-constituents and the file
contains three range names which are highlighted with a red box. You may need to click
the + icon at the left of the Range names field to view the names.
5) In the Navigator, select the Insert as Link option in the Drag Mode menu, as shown in
Figure 454.
Figure 453: Navigator for source file
You can also change the drag mode by right-clicking on a range name and selecting the required
option in the context menu.
Tip
The graphic on the Drag Mode icon on the Navigator changes to reflect the currently
selected drag mode.
Figure 454: Select Insert as Link from Drag Mode menu
Chapter 12 Linking Data | 429
6) Select the required Range names or Database ranges entry and drag it from the
Navigator into the target document, to the cell where you want the upper left cell of the
data range to be.
7) Re-select the target document in the drop-down menu at the bottom of the Navigator.
Instead of a + icon next to Range names, it shows a + icon next to Linked areas. Click
the + icon to see the entry dragged across from the source document, similar to Figure
451.
How to find the required data range or table
Calc’s Web Page Query import filter displays the data ranges (tables) in source order from the
web page. It also creates two additional range names:
• HTML_all – designates the entire document
• HTML_tables – designates all HTML tables in the document
If any of the data tables in the source HTML document have been given meaningful names
(using the ID attribute on the TABLE tag), those names appear in the Range names list, along
with the ranges Calc has sequentially numbered.
If the data range or table you want is not meaningfully named, how can you tell which one to
select?
Go to the source document, which you opened in Calc. In the Navigator, double-click on a range
name: that range is highlighted on the sheet. The example in Figure 455 shows a table of best-
selling albums of recorded music by year worldwide and was extracted from Wikipedia’s List of
best-selling albums page ([Link]
Figure 455: Using the Navigator to find a data range name
If the Formula bar is visible, the range name is also displayed in the Name Box at the left end
(Figure 456). The range name can be selected in the drop-down list to highlight it on the page.
430 | Calc Guide 26.2
Figure 456: Using the Name Box to find a data range name
Linking to registered data sources
You can access a variety of databases and other data sources and link them into Calc
documents.
First you need to register the data source with LibreOffice. To register means to tell LibreOffice
what type of data source it is and where the file is located. The way to do this depends on
whether or not the data source is a database in *.odb format.
To register a data source that is in *.odb format:
1) Select Tools > Options > LibreOffice Base > Databases on the Menu bar. Calc
displays the dialog shown in Figure 457.
Figure 457: Options – LibreOffice Base – Databases dialog
2) Click the New button to open the Create Database Link dialog (Figure 458).
Chapter 12 Linking Data | 431
Figure 458: Create Database Link dialog
3) Enter the location of the database file, select a database file in the drop-down list, or
click Browse to open a file browser and select the database file.
4) Type a name to use as the registered name for the database and click OK. The
database is added to the list of registered databases and LibreOffice uses the
registered name to access the database.
Note
The OK button on the Create Database Link dialog is enabled only when both the
Database file and Registered name fields are filled in.
To register a data source that is not in *.odb format:
1) Choose File > New > Database on the Menu bar to open the Database Wizard (Figure
459). For more about the Database Wizard, see the Base Handbook.
2) Select Connect to an existing database and select the appropriate database type in
the drop-down menu. The choices for database type depend on your operating system.
For example, Microsoft Access and other Microsoft products are not among the choices
if you are using Linux. The example database type menu shown in Figure 459 relates to
a Windows 10 installation.
Note
The exact interactions required to connect to a database vary depending on the type
of database. Steps 3) and 4) assume that you selected dBASE at step 2).
3) Click Next. Type the path to the folder where the dBase files are stored or click Browse
and use the folder selection dialog to navigate to the relevant folder before clicking the
Select Folder button.
4) Click Next. Select Yes, register the database for me, but clear the Open the
database for editing checkbox.
5) Click Finish. Name and save the database in the location of your choice.
Note
The above steps create a *.odb format database based on the content of the original
dBASE database. The original dBASE database remains unchanged.
432 | Calc Guide 26.2
Figure 459: Database Wizard
Once a data source has been registered, it can be used by any LibreOffice component (for
example, Calc or Writer).
Viewing data sources
Open a document in Calc. To view the data sources available, select View > Data Sources on
the Menu bar, or press Ctrl+Shift+F4. Calc opens the Data Source window above the
spreadsheet.
The Data Source window has four main components:
The Table Data toolbar
• The Table Data toolbar (Figure 460) is by default located at the top of the Data Source
window.
Figure 460: Table Data toolbar
(67) Save current record (74) Refresh (81) Reset Filter/Sort
(68) Edit Data (75) Sort (82) Data to Text
(69) Cut (76) Sort Ascending (83) Data to Fields
(70) Copy (77) Sort Descending (84) Mail Merge
(71) Paste (78) AutoFilter (85) Data Source of
(72) Undo (79) Apply Filter Current Document
(73) Find Record (80) Standard Filter (86) Explorer On/Off
The Data Source Explorer
• The Data Source Explorer (Figure 461) is by default located on the left side of the Data
Source window, below the Table Data toolbar.
Chapter 12 Linking Data | 433
• The Data Source Explorer provides a list of the registered databases, which by default
includes the built-in Bibliography database.
• To view each database, click on the expand icon to the left of the name of the database.
This has already been done for the Automobiles database in Figure 461. Click on the
expand icon left of Tables to view the individual tables within the selected database;
similarly you can click on the expand icon left of Queries to view the individual queries
within the selected database. Click on the name of a table to view all the records held in
that table.
Figure 461: Data Source Explorer
Data records for selected table
• The data records for the selected table are displayed in the area at the right side of the
Data Source window, below the Table Data toolbar.
Figure 462: Data Source window records
• To see more columns in this area, you can click the Explorer On/Off icon on the Table
Data toolbar to hide the Data Source Explorer. Click again to show it back.
• Below the data records is a navigation bar, which shows which record is selected and
the total number of records. This provides the following buttons, from left to right:
– First record
– Previous record
– Next record
– Last record
– Add new record
• A horizontal scroll bar appears when the available columns do not all fit in the visible
area. A vertical scroll bar appears when the available data records do not all fit in the
visible area.
Show / hide window
• At the bottom center of the Data Source window is a control to hide and show the entire
window. This control is highlighted with a red box in Figure 462.
434 | Calc Guide 26.2
Editing data sources
Only registered Data Sources can be edited in the Data Source window.
In editable data sources, records can be edited, added, or deleted. If you cannot save your edits,
you need to open the database in Base and edit it there; see “Launching Base to work on data
sources” below. You can also hide columns and make other changes to the display.
Launching Base to work on data sources
You can launch LibreOffice Base at any time from the Data Source Explorer. Right-click on a
database, Tables, a table name, Queries, or a query name, and then select Edit Database File
in the context menu. Once in Base, you can edit, add, and delete tables, queries, forms, and
reports.
For more about using Base, see the Getting Started Guide, or the Base Guide.
Using data sources in Calc spreadsheets
Data from a table displayed on the right side of the Data Source window can be placed into a
Calc document in a variety of ways.
You can select a single cell, a single row, or multiple rows in the Data Source window and drag
and drop the data into the spreadsheet. The data is inserted at the place where you release the
mouse button. If you selected one or more rows, Calc will also include the column headings
above the data you insert. To select the rows of data you want to add to the spreadsheet:
1) Click the gray box to the left of the first row you want to select. That row is highlighted.
2) To select multiple adjacent rows, hold down the Shift key while clicking the gray box of
the last row you need.
3) To select multiple separate rows, hold down the Control key while selecting each row.
The selected rows are highlighted.
4) To select all the rows, click the gray box in the upper left corner. All rows are highlighted.
An alternative method uses the Data to Text icon on the Table Data toolbar and will include the
column headings above the data you insert:
1) Click the cell of the spreadsheet which you want to be the top left of your data, including
the column names.
2) Select the rows of data you want to add to the spreadsheet, as described in the
previous paragraph.
3) Click the Data to Text icon in the Table Data toolbar to insert the data into the
spreadsheet cells.
You can also drag the data source column headings (field names) onto your spreadsheet to
create a form for viewing and editing individual records one at a time. Follow these steps:
1) Drag and drop the column header (containing the field name you wish to use) to where
you want the record to appear in the spreadsheet.
2) Repeat step 1) until you have moved all the fields you need to where you want them.
3) Close the Data Source window by selecting View > Data Sources on the Menu bar or
pressing Ctrl+Shift+F4.
4) Save the spreadsheet and select Edit > Edit Mode on the Menu bar, or press
Ctrl+Shift+M, to make the spreadsheet read-only.
Chapter 12 Linking Data | 435
5) Select File > Reload on the Menu bar. All of the fields will show the value for the data of
the first record of the data source that you selected.
6) Select View > Toolbars > Form Navigation to show the Form Navigation toolbar
(Figure 463). By default, this toolbar opens at the bottom of the Calc window, just above
the Status bar.
7) Click the arrows on the Form Navigation toolbar to view the different records of the
table. The toolbar indicates which record is currently displayed and the total number of
records available. The current record number changes as you move through the
records and the data in the spreadsheet fields updates to correspond to the data for that
particular record number.
Figure 463: Form Navigation toolbar
(1) Find Record (provides access (7) New Record (14) Sort Ascending
to the Record Search dialog) (8) Save Record (15) Sort Descending
(2) Absolute Record (type in the (9) Undo (16) AutoFilter
number of the required record) (10) Delete Record (17) Apply Filter
(3) First Record (11) Refresh (18) Form-Based Filters
(4) Previous Record (12) Refresh Control (19) Reset Filter/Sort
(5) Next Record (13) Sort (20) Data source as Table
(6) Last Record
Embedding spreadsheets
Spreadsheets can be embedded in other LibreOffice files and vice versa. This is often used in
Writer or Impress documents so that Calc data can be used in a text document or a
presentation. You can embed the spreadsheet as either an OLE (Object Linking and Embedding)
or DDE (Dynamic Data Exchange) 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
Writer as well as in the Calc document and both documents are in sync with each other.
Object Linking and Embedding (OLE)
The major benefit of an OLE object is that it is quick and easy to edit its contents just by double-
clicking on it. You can also insert a link to the object that will appear as an icon rather than an
area showing the contents itself.
OLE objects can be linked to a target document or embedded in the target document. Linking
inserts information which will be updated with any subsequent changes to the original file, while
embedding inserts a static copy of the data. If you want to edit the embedded spreadsheet,
double-click on the object.
Note
If your OLE object is empty, inactive, and not displayed as an icon, then it will be
transparent.
436 | Calc Guide 26.2
To embed a spreadsheet as an OLE object in a presentation, for example:
1) Place the cursor in the document at the location where you want the OLE object to be.
2) Select Insert > OLE Object > OLE Object on the Menu bar. Impress opens the Insert
OLE Object dialog shown in Figure 464, with the Create new option selected by default.
3) You can either create a new OLE object or create the OLE object from an existing file.
To create a new object:
1) Select the Create new option and select the required option from those available in the
Object Type list. In this example, you would select LibreOffice 7.2 Spreadsheet.
2) Click OK.
3) LibreOffice places an empty container in the slide, ready for you to enter information. By
default the Menu bar changes to reflect the Calc Menu bar; when you click on the slide,
anywhere outside the spreadsheet area, the Menu bar reverts to the Impress Menu bar.
Figure 464: Insert OLE Object dialog with Create new option selected
After clicking outside the spreadsheet area, double-click on the OLE object to re-enter the edit
mode of the object. The application devoted to handling that type of file (Calc in our example) will
open the object.
To save the inserted spreadsheet:
1) Click anywhere outside the spreadsheet to leave the edit mode.
2) Right-click on the spreadsheet and select Save Copy as in the context menu or select
Edit > OLE Object > Save Copy as on the Menu bar.
3) Choose the name of the new file and the folder in which it will be saved.
4) Click the Save button.
Note
If the object inserted is handled by LibreOffice, then the transition to the program to
manipulate the object will be seamless; in other cases the object opens in a new
window and an option in the File menu becomes available to update the object you
inserted.
Chapter 12 Linking Data | 437
To insert an existing object:
1) To create on OLE object from an existing file, select the Create from file option. The
Insert OLE Object dialog changes to that shown in Figure 465.
2) Click Search, select the required file in the file browser, and then click Open.
Note
This facility is not limited to LibreOffice files; you can create OLE objects using
existing files from many other applications.
Figure 465: Insert OLE Object dialog with Create from file option selected
3) To insert the object as a link to the original file, select the Link to file option. Otherwise,
the object will be embedded in your document.
4) If you want the object to appear as a selectable icon, rather than a section of your file,
select the Display as icon option.
5) Click OK. A section of the inserted file is shown in the document. If your source
spreadsheet has multiple sheets, it’s possible to navigate between them in the edit
mode.
Other OLE objects
Under Windows, when you select the Create new option on the Insert OLE Object dialog, there
is an extra entry Further objects in the Object Type list.
1) Double-click on the entry Further objects to open the Insert Object dialog (Figure 466).
2) Select Create New to insert a new object of the type selected in the Object Type list, or
select Create from File to create a new object from an existing file.
438 | Calc Guide 26.2
Figure 466: Inserting an OLE object under Windows
3) If you choose Create from File, the layout of the Insert Object dialog changes to that
shown in Figure 467. Click Browse and choose the file to insert. The inserted file object
is editable by the Windows program that created it.
If instead of inserting an object, you want to insert a link to an object, select the Display
As Icon option.
4) Click OK.
Figure 467: Insert OLE object from a file under Windows
Non-linked OLE object
If the OLE object is not linked, it can be edited in the new document. For instance, if you insert a
spreadsheet into a Writer document, you can essentially treat it as a Writer table (with a little
more power). To edit it, double-click on it.
Linked OLE object
If the spreadsheet OLE object is linked, and you change it in Writer, it will change in Calc; if you
change it in Calc, it will change in Writer. This can be a very powerful tool if you create reports in
Writer using Calc data, and want to make a quick change without opening Calc.
Chapter 12 Linking Data | 439
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.
Dynamic Data Exchange (DDE)
DDE is an acronym for Dynamic Data Exchange, a mechanism whereby selected data in
document A can be pasted into document B as a linked, ‘live’ copy of the original. It would be
used, for example, in a report written in Writer containing time‑varying data, such as sales
results sourced from a Calc spreadsheet. The DDE link ensures that, as the source spreadsheet
is updated so is the report, thus reducing the scope for error and reducing the work involved in
keeping the Writer document up to date.
DDE is a predecessor of OLE. With DDE, objects are linked through file reference, but not
embedded. You can create DDE links either within Calc cells in a Calc sheet, or in Calc cells in
another LibreOffice doc such as in Writer.
DDE link in Calc
Creating a DDE link in Calc is similar to creating a cell reference. The process is a little different,
but the result is the same. Carry out the following steps to create a DDE link from one Calc
spreadsheet to another:
1) In Calc, open the spreadsheet that contains the original data that you want to link to.
2) Select the cells that you want to make the DDE link to.
3) Copy the cells to the clipboard by selecting Edit > Copy on the Menu bar, or clicking
the Copy icon on the Standard toolbar, or right-clicking the selected area and selecting
Copy in the context menu, or pressing Ctrl+C.
4) Open the second spreadsheet that will contain the linked data.
5) Click in the top left cell of the area in the second spreadsheet where you want the linked
data to appear.
6) On the second spreadsheet, select Edit > Paste Special > Paste Special on the Menu
bar, or right-click the top left cell of the area and select Paste Special > Paste Special
in the context menu, or press Ctrl+Shift+V.
7) Calc displays the Paste Special dialog (Figure 468).
8) Select the As Link option on the Paste Special dialog (highlighted with a red box on
Figure 468) and then click OK.
9) If you now click on one of the linked cells you will see that the Formula bar shows a
reference beginning with the characters {=’. See Figure 469 for an example,
highlighted with a red box.
Save and close both spreadsheets.
If you subsequently edit the original cells in their spreadsheet and save the changes, next time
you open the spreadsheet containing the linked cells, the values in those linked cells will update
to reflect the latest values of the original cells.
440 | Calc Guide 26.2
Figure 468: Paste Special dialog
Figure 469: Example of DDE link to another Calc spreadsheet
Note
When you open a spreadsheet containing linked data, you may get a warning
message indicating that automatic update of external links has been disabled. You
will need to click the associated button to allow updating of the linked cells. You can
avoid this message and interaction by making sure that the spreadsheet containing
the original data is in a trusted file location and that the option is selected to always
update links from trusted locations when opening. Check these settings via Tools >
Options > LibreOffice > Security > Macro Security (Trusted Sources tab) and
Tools > Options > LibreOffice Calc > General (Update links when opening section)
respectively.
Chapter 12 Linking Data | 441
DDE link in Writer
The process for creating a DDE link from Calc to Writer is similar to creating a link within Calc.
You can check more details of this feature in the Writer Guide.
1) In Calc, select the cells to make the DDE link to. Copy them.
2) Go to the place in your Writer document where you want the DDE link. Select Edit >
Paste Special > Paste Special.
3) Writer displays its Paste Special dialog (Figure 470).
4) Select the Dynamic Data Exchange (DDE link) option in the Selection list.
5) Click OK.
6) Now the link has been created in Writer. When the Calc spreadsheet is updated, the
table in Writer is automatically updated.
Figure 470: Paste Special dialog in Writer, with DDE link selected
XML Source
The XML Source feature allows a user to import data from arbitrarily structured XML content into
cells in an existing spreadsheet document. It allows XML content to be imported either partially
or in full, depending on the structure of the XML content and the map definitions that the user
defines. The user can specify multiple non-overlapping sub-structures to be mapped to different
cell positions within the same document, and can select to import either element contents,
attribute values, or both.
Note:
The XML Source feature currently allows you to import XML data as a one-time
event; it will not store the information about the data source once the data is
imported.
Suppose that you have sales data in an XML file, such as the following:
1| <sales>
2| <sale>
3| <date>01/19/08</date>
4| <value>$2,032</value>
5| <category>Golf</category>
6| <region>West</region>
442 | Calc Guide 26.2
7| <employee>Brigitte</employee>
8| </sale>
9| <sale>
10| <date>01/25/08</date>
11| <value>$3,116</value>
12| <category>Sailing</category>
13| <region>East</region>
14| <employee>Hans</employee>
15| </sale>
16| <sale>
17| <date>01/26/08</date>
18| <value>$2,811</value>
19| <category>Tennis</category>
20| <region>South</region>
21| <employee>Fritz</employee>
22| </sale>
23| </sales>
To import this data into your Calc spreadsheet, take the following steps:
1) Select Data > XML Source. Calc displays the XML Source dialog (Figure 471).
Figure 471: XML Source dialog (on initial display)
2) Click the icon in the Source File area at the top of the dialog. Calc displays the Open
dialog, which lets you specify the path to the XML file that you wish to import into your
document.
3) Navigate to the correct folder, select the required file, and click the Open button.
4) Calc reads the content of the specified file and then populates the Map to Document
area on the XML Source dialog to show the structure of the XML, as can be seen in
Figure 472. The Map to Document area is described further below.
5) In the case of our example data, select sale in the Map to Document area. This will
import all <sale> entries within the XML content into the spreadsheet.
6) Click on the cell at the top left of the area where the data is to appear in your
spreadsheet. In the case of our example, click cell A1. A tell back of the cell clicked
appears in the Mapped cell text box.
7) The contents of the XML Source dialog should now look like that shown in Figure 472.
Chapter 12 Linking Data | 443
8) Click the Import button. This action starts the import process based on the link
definitions that the user has provided. Once the import finishes, the dialog will close.
Figure 472: XML Source dialog (populated)
Calc will place the XML content into the specified position in the spreadsheet, as shown in
Figure 473.
Figure 473: Imported XML content
The Map to Document area of the XML Source dialog shows the structure of the source XML
content as a tree. It is initially empty and gets populated when you specify the source file.
Each element in the tree can be one of three types:
• Attribute, represented by the symbol @.
• Single non-recurring element, represented by the symbol </>. A non-recurring element
is an element that can only occur once under the same parent. It is mapped to a single
cell in the document.
• Recurring element, represented by the symbol <//>. A recurring element is an element
that can appear multiple times under the same parent. It serves as an enclosing parent
of a single record entry of multiple record entries. These entries are imported into a
range whose height equals the number of entries plus one additional header row.
The Mapped cell field specifies the position of a cell in the document that an element or an
attribute is linked to. If it is a non-recurring element or an attribute, it simply points to the cell
where the value of the linked element/attribute will get imported. If it is a recurring element, it
points to the top-left cell of the range where the whole record entries plus header will get
imported.
444 | Calc Guide 26.2
Direct import of JSON and XML files
Calc can map generic XML and JSON documents with linkable ranges to sheets. A linkable
range is a section of a document containing tabular records. When a document contains multiple
linkable ranges, each range gets mapped to a single sheet.
JSON (JavaScript Object Notation) is a lightweight, text-based data format used for storing and
exchanging data. It is easy for humans to read and write, and easy for machines to parse and
generate.
Warning
The original data in the source document does not need to follow a specific structure,
as its format is automatically analyzed and mapped to the sheet. However, this
process is performed on a best-effort basis and may not always succeed.
The listing below shows an example of JSON contents and Figure 474 shows the resulting
import. Importing linkable XML files is similar.
1| [
2| {
3| "id": 5001,
4| "name": "Wireless Mouse",
5| "description": "Ergonomic wireless mouse with adjustable DPI settings.",
6| "sku": "WM-ERGO-BLK-01",
7| "price": 25.50,
8| "stock_quantity": 150,
9| "category": "Electronics"
10| },
11| {
12| "id": 5002,
13| "name": "Mechanical Keyboard",
14| "description": "RGB mechanical keyboard with brown switches for tactile
feedback.",
15| "sku": "MK-RGB-BROWN-02",
16| "price": 89.99,
17| "stock_quantity": 75,
18| "category": "Electronics"
19| },
20| {
21| "id": 5003,
22| "name": "Laptop Stand",
23| "description": "Adjustable aluminum laptop stand for improved ergonomics.",
24| "sku": "LS-ALUM-ADJ-03",
25| "price": 35.00,
26| "stock_quantity": 200,
27| "category": "Accessories"
28| }
29| ]
Figure 474: Resulting import of JSON file
Chapter 12 Linking Data | 445
Calc Guide 26.2
Chapter 13
Sharing and Reviewing
Spreadsheets
Introduction
This chapter covers methods for collaboration through sharing and reviewing spreadsheets:
simultaneous editing, recording changes, adding comments, reviewing changes, merging and
comparing documents, saving, and using document versions.
Some menu commands are not available (grayed out) when sharing or change tracking are
active.
Sharing spreadsheets
Sharing a spreadsheet allows several users to open the same file for editing at the same time.
The spreadsheet needs to be on a shared drive, server, website, or similar. Some conditions
must be met on operating systems with user permission management:
• The shared file needs to reside in a location which is accessible by all collaborators.
• The file permissions for both the document and the corresponding lock file need to be
set so that all collaborators can create, delete, and change the files.
Consult your operating system’s documentation for details on setting file permissions. See also
“Opening and saving files on remote servers” in the Getting Started Guide.
Tip
In order to correctly identify the changes, each collaborator should enter their name
in Tools > Options > LibreOffice > User Data on the Menu bar.
Setting up a spreadsheet for sharing
With the spreadsheet open, choose Tools > Share Spreadsheet on the Menu bar to enable or
disable sharing.
Figure 475: Share Document dialog
To enable sharing, select the checkbox at the top of the dialog (Figure 475) and click OK. If the
spreadsheet has been saved previously, a message appears stating that you must save it to
448 | Calc Guide 26.2
activate shared mode; click Yes to continue. If the spreadsheet has not been saved previously,
the Save dialog opens. After saving, the text “(shared)” is shown on the Title bar, after the title.
Tools > Share Spreadsheet on the Menu bar can also be used to switch a spreadsheet from
shared to unshared. However, this means that other users can no longer edit it. Instead, you
may wish to save a copy of the shared spreadsheet using another name or path, thus creating a
copy of the shared spreadsheet, and then switch the copy to unshared.
Opening a shared spreadsheet
When you open a shared spreadsheet, a message appears stating that some features are not
available in this mode, and are grayed. After reading it, click OK to remove the message and
open the document.
Note
Changes to formatting attributes like fonts, colors, and number formats will not be
saved and some functionalities like editing charts and drawing objects are not
available in shared mode. Turn off shared mode to get exclusive access needed for
those changes and functionalities.
The following features are disabled in a shared spreadsheet:
Edit > Track Changes, except for Merge Document
Insert > Media > Audio or Video
Insert > Comment
Insert > Object
Insert > Chart
Insert > Named Range or Expression
Insert > Pivot Table
Insert > Floating Frame
Insert > Fontwork
Insert > Signature Line
Format > Merge Cells
Format > Print Ranges
Sheet > Move or Copy Sheet
Sheet > Delete Sheet
Sheet > Insert Sheet from File
Sheet > Named Ranges and Expressions
Sheet > Rename Sheet
Sheet > Sheet Tab Color
Data > Define Range
Data > Sort
Data > Sort Ascending
Data > Sort Descending
Data > Subtotals
Data > Validity
Data > Multiple Operations
Data > Consolidate
Data > Group and Outline
Data > Pivot Table
Tools > Protect Sheet
Tools > Protect Spreadsheet Structure
Chapter 13 Sharing and Reviewing Spreadsheets | 449
Saving a shared spreadsheet
When you save a shared spreadsheet, and if it has not been modified and saved by another
user since you opened it, it is saved as usual.
If the spreadsheet has been modified and saved by another user since you opened it, one of the
following will occur:
• If the changes do not conflict, the document is saved, the message “Your spreadsheet
has been updated with changes saved by other users” appears, and any cells modified
by the other user are shown with a red border.
Figure 476: Resolve Conflicts dialog
• If the changes conflict, the Resolve Conflicts dialog (Figure 476) 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 spreadsheet and resolve conflicts, they see
a message that the file is locked due to a merge in progress. They can cancel the Save
command and retry saving later.
When you successfully save a shared spreadsheet, the document shows the latest version of all
changes saved by all users.
Reviewing documents
You can use several methods to review, edit, and comment on a spreadsheet. Each reviewer
works on a separate copy of the document.
• You can use change marks to show added and deleted material. Later, you or another
person can review the document and accept or reject each change.
• You can make changes to a copy of the document (stored in a different folder, under a
different name, or both), then use Calc to compare the files and show the changes. See
“Comparing documents” below.
• You can save versions that are stored as part of the original file. See “Saving versions”
below.
Reviewers can leave comments in the document, either attached to specific changes or
standalone.
450 | Calc Guide 26.2
Preparing a document for review (optional)
Before you send a spreadsheet to someone else to review or edit, you may want to set it up so
that the editor or reviewer does not have to remember to turn on the revision marks.
After you have turned on revision marks, you can optionally password protect the spreadsheet
so that any user must enter the correct password in order to accept or reject changes.
1) Open the spreadsheet and select Edit > Track Changes > Record on the Menu bar.
You can also use File > Properties > Security and select Record changes.
2) If you want to protect the spreadsheet, click Edit > Track Changes > Protect on the
Menu bar. On the Protect Records dialog, type a password (twice) and click OK. You
can also use File > Properties > Security and click the Protect button to open the
similar Enter Password dialog. Both dialogs incorporate a password strength meter to
indicate the strength of the entered password. This provides a colored bar to reflect
password strength, with red indicating a weak password and green indicating a strong
password. In addition, the longer the colored bar, the greater the strength of the
password.
Recording changes
To record changes, open the spreadsheet and make sure that the Edit > Track Changes >
Record menu item has a check mark next to it, indicating that change recording is active.
Caution
After making some changes, do not turn off change recording. Turning off change
recording in Calc causes all the recorded changes to be accepted and no longer
shown as changes. A message box will warn if you try to do this.
When changes are made in a cell, a colored border with a dot in the upper left-hand corner
appears around the cell (Figure 477). A deleted column or row is marked by a heavy colored bar.
Figure 477: Edited document with red border on changed cells
To see the changed information, hover the mouse pointer over the changed cell. See Figure 478.
Chapter 13 Sharing and Reviewing Spreadsheets | 451
Figure 478: Showing details of the change
Note
Some changes, for example cell formatting, are not recorded and marked.
Tip
To change the color that indicates a changed cell, select Tools > Options >
LibreOffice Calc > Changes on the Menu bar.
You may want to explain your rationale for the changes. You can do this by adding comments to
the changes you made or by adding general comments to the spreadsheet.
Adding comments to changes
Calc automatically adds to any recorded change a comment that describes what was changed
(for example, Cell B4 changed from ‘9’ to ‘4’). Reviewers and authors can add their own
comments to explain their reasons for the changes or provide any other helpful insights.
To add a comment to a change:
1) Make the change to the spreadsheet.
2) Select the cell with the change.
3) Choose Edit > Track Changes > Comment on the Menu bar. A small dialog opens.
Type your comment and click OK. See Figure 479.
Note
Do not use Insert > Comment on the Menu bar or the context menu for this
purpose. Comments inserted using that method are handled differently (see “Adding
other (general) comments” below) and do not appear in the Manage Changes dialog.
Figure 479: Entering a comment associated with a change
452 | Calc Guide 26.2
After you have added a comment to a changed cell, you can see the change and the comment
by hovering the mouse pointer over the cell, as shown in Figure 480.
Figure 480: Comment added to cell B3
The comment also appears on the Manage Changes dialog when you are accepting and
rejecting changes, as shown in the first line of Figure 484.
Editing comments on changes
1) Select the cell with the change comment that you want to edit.
2) Choose Edit > Track Changes > Comment on the Menu bar. The box shown in Figure
479 opens.
3) Edit the comment and click OK.
The automatically-added comment provided by Calc cannot be edited.
You can move through the comments by using the arrows at the bottom of the dialog.
Adding other (general) comments
Calc provides another type of comment, which authors and reviewers often used to exchange
ideas or ask for suggestions.
To add a general comment:
1) Select the cell that the comment applies to.
2) Select Insert > Comment on the Menu bar, or right-click and select Insert Comment in
the context menu, or press Ctrl+Alt+C. The box shown in Figure 481 appears.
Figure 481: Inserting a comment
3) Type your comment in the box, then click outside the box to close it.
Now the cell to which you added the comment has a colored triangle in the upper right-hand
corner, as shown in Figure 482. It does not have a colored border, unless the cell also has a
change comment.
Figure 482: Colored triangle in cell containing a comment
Chapter 13 Sharing and Reviewing Spreadsheets | 453
Tip
You can change the colors Calc uses for comments by selecting Tools > Options >
LibreOffice > Appearance> Customization and adjusting the colors for Notes
background and Comments in the Spreadsheet section.
To view the comment you just added, hover the mouse pointer over the cell that has a comment.
The comment appears, as shown in Figure 483.
Figure 483: Viewing a comment
Note
If you hover the mouse pointer over a cell that has both a change comment and a
general comment, both comments are shown in the displayed tip.
Editing general comments
You can edit and format the text of a general comment, just as you do for any other text.
1) Right-click on the cell containing the comment marker and choose Edit comment in the
context menu, or left-click on the cell and press Ctrl+Alt+C.
2) Calc shows the cell’s comment. The pointer changes to the usual text-entry pointer, and
the Formatting toolbar changes to show text attributes.
3) When editing is done, click outside the comment to deselect it.
Formatting general 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 in
the context menu. The authorship data shown at the top of the comment in Figure 483
is not displayed when a general comment is shown via this interaction.
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 6, Using Images and Graphics, for more information.
You can also right-click on the comment to see a menu of choices, some of which lead
to dialogs where you can fine-tune the formatting; these dialogs are also discussed in
Chapter 6.
3) When done, click outside the comment to deselect it. To hide the comment again, right-
click on the cell and choose Hide Comment in the context menu.
454 | Calc Guide 26.2
Finding general comments
If the comment markers in the corners of cells are difficult to see, Calc provides two other ways
to find them: by showing all comments and by using the Navigator.
1) To show all general comments, choose View > Comments on the Menu bar. To hide all
comments, choose View > Comments again. The authorship data shown at the top of
the comment in Figure 483 is not visible when all general comments are shown in this
way.
2) If any general comments are in the spreadsheet, the Navigator shows a symbol (usually
a + or an arrow) next to the word Comments. Click on this symbol to display a list of the
comments. Double-click on a comment in the list to jump directly to the cell it is
associated with.
Note
View > Comments and the Navigator show general comments but not the
comments associated with tracked changes.
Accepting or rejecting changes
When you receive a document with changes, you can step through each change and decide
how to proceed. To begin this process:
1) Open the edited document.
2) Select Edit > Track Changes > Manage on the Menu bar. The Manage Changes
dialog shown in Figure 484 appears.
3) You can step through the changes one at a time, choosing to accept or reject each
change as you go through. You can also accept or reject all changes at one time.
The Comment column, by default, contains an explanation of the change that was made. If the
reviewer added a comment to the change, then that comment is displayed, followed by the
default description of the change.
If a change has been superseded by a later change (by either the same person or another
person), the changes are hierarchically arranged with an expansion symbol for opening up the
hierarchy.
As shown in Figure 484, the list of changes is arranged with pending changes on the top and
accepted changes at the bottom.
Chapter 13 Sharing and Reviewing Spreadsheets | 455
Figure 484: Manage Changes dialog – List tab
On the Filter tab of the Manage Changes dialog (Figure 485), you can choose how to filter the
list of changes: by date, author, cell range, or comments containing specific terms. After
selecting the filter criteria, switch back to the List tab to see the results. Filtering the changes
affects only the contents of the List tab on the dialog, you will not see any filtered results in your
spreadsheet.
Figure 485: Manage Changes dialog – Filter tab
Merging documents
The processes discussed to this point are effective when you have one reviewer at a time.
Sometimes, however, multiple reviewers all return edited copies of a spreadsheet. In this case, it
may be faster to review all the changes at once, rather than one review at a time. For this
purpose, you can merge documents in Calc.
456 | Calc Guide 26.2
To merge documents, all the edited documents (but not the original document) need to have
recorded changes in them.
1) Open the original document into which you want to merge all the copies.
2) Select Edit > Track Changes > Merge Document on the Menu bar.
3) A file selection dialog opens. Select a file you want to merge and click Open.
4) After the documents merge, the Manage Changes dialog opens, showing changes by
more than one reviewer. If you want to merge more documents, close the dialog and
then repeat steps 2) and 3).
Now all of the changes are combined into one document, and you can accept or reject the
changes. Changes from different authors appear in cells outlined in different colors.
Comparing documents
Sometimes reviewers may not record the changes they make. Calc can find the changes by
comparing documents.
To compare documents, you need to have both the original document and the one that was
edited.
1) Open the edited document that you want to compare with the original document.
2) Select Edit > Track Changes > Compare Document.
3) A file selection dialog opens. Select the original document and click Open.
4) Calc opens the Manage Changes dialog showing the changes identified.
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 in the original document that is not in the edited document is identified as
deleted.
• All data that is changed is marked as changed.
From this point, you can go through and accept or reject changes.
Saving versions
For auditing and other purposes, you may need to save new versions of a spreadsheet. You can
do this by saving a copy of the spreadsheet (under a different name) after each revision, or by
using Calc’s version feature.
Caution
If you select File > Save As on the Menu bar, or press Ctrl+Shift+S, for a
document with different versions stored in it, the old versions are not saved in the
new file.
To use version management in Calc:
1) Choose File > Versions on the Menu bar. A version management dialog (Figure 486)
opens, showing a list of the existing versions saved in this file.
Chapter 13 Sharing and Reviewing Spreadsheets | 457
Figure 486: Version management dialog
2) Click the Save New Version button to save a new version. The Insert Version
Comment dialog (Figure 487) opens where you can enter comments about this version.
3) After you enter your comment and click OK, the new version is included in the Existing
Versions list (Figure 488).
4) Save the file. Both versions are now included in the same file.
Figure 487: Insert Version Comment dialog
From this point you can:
• View an old version – Select the version and click Open. A read-only copy of a previous
version opens.
• Compare all versions – Clicking Compare performs an action similar to merging
documents. A Manage Changes dialog opens, showing all of the changes through the
different versions.
• Review the version comments – Select a version and click Show to display the full
comments made by yourself or other reviewers.
• Delete a version – Select a version and click Delete. Be careful with this option, when
deleting a version, there is no request for confirmation.
458 | Calc Guide 26.2
Figure 488: Updated version list
Chapter 13 Sharing and Reviewing Spreadsheets | 459
Calc Guide 26.2
Chapter 14
Macros
Automating repetitive tasks
Introduction
Chapter Getting Started with Macros of the Getting Started Guide is an introduction to the macro
facilities that are available in LibreOffice. The current chapter provides further introductory
information about the use of macros within a Calc spreadsheet.
A macro is a set of commands or keystrokes that are stored for later use.
An example of a simple macro is one that enters your address into the current cell of an open
spreadsheet. You can use macros to automate both simple and complex tasks, and they enable
you to introduce new features that are not built into Calc.
The simplest way to create a macro is to record a series of actions through Calc’s user interface.
Calc saves recorded macros using the open-source LibreOffice Basic scripting language, which
is a dialect of the well-known BASIC programming language. Such macros can be edited and
enhanced after recording using the built-in LibreOffice Basic Integrated Development
Environment (IDE).
The most powerful macros in Calc are created by writing code using one of the four supported
scripting languages (LibreOffice Basic, Python, JavaScript, and BeanShell). This chapter
provides an overview of Calc’s macro facilities, mostly focused on its default macro scripting
language, LibreOffice Basic. Some examples are included for the Python, JavaScript, and
BeanShell scripting languages but fuller descriptions of the facilities for these languages are
beyond the scope of this document.
On Visual Basic for Applications (VBA) compatibility
The LibreOffice Basic programming language and the VBA programming language – found in
many Microsoft Office documents including Excel spreadsheets – are dialects of the BASIC
language. 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. Some tips for converting
Excel macros written in VBA are detailed at the end of this chapter.
Using the macro recorder
Chapter Getting Started With Macros, of the Getting Started Guide includes examples showing
how to use the macro recorder and understand the generated LibreOffice Basic scripts.
Note
Use Tools > Options > LibreOffice > Advanced on the Menu bar and select the
Enable macro recording (maybe limited) option to enable the macro recorder.
The following steps give a further example, specific to a Calc spreadsheet, without the more
detailed explanations of the Getting Started Guide. A macro is created and saved which
performs a paste special with multiply operation across a range of spreadsheet cells.
1) Use File > New > Spreadsheet on the Menu bar to create a new spreadsheet.
2) Enter the numbers shown in Figure 489 into cells A1:C3 of Sheet1 in the new
spreadsheet.
462 | Calc Guide 26.2
Figure 489: Enter numbers into cells A1:C3
3) Select cell A3, which contains the number 3, and use Edit > Copy on the Menu bar to
copy the value to the clipboard.
4) Select all cells in the range A1:C3.
5) Use Tools > Macros > Record Macro on the Menu bar to start the macro recorder.
Calc displays the Record Macro dialog, which includes a Stop Recording button
(Figure 490).
Figure 490: Record Macro dialog with Stop Recording button
6) Use Edit > Paste Special > Paste Special on the Menu bar to open the Paste Special
dialog (Figure 491).
Figure 491: Paste Special dialog
7) Select the All option in the Paste area and Multiply in the Operations area (both
options are highlighted with a red box in Figure 491), and click OK. The values in cells
A1:C3 are now multiplied by 3 (Figure 492).
Chapter 14 Macros | 463
Figure 492: Cells A1:C3 multiplied by 3
8) Click the Stop Recording button to stop the macro recorder. Calc displays a variant of
the Basic Macros dialog (Figure 493).
Note
The Save Macro In area of the Basic Macros dialog shows the existing LibreOffice
Basic macros, hierarchically structured into library containers, libraries, modules, and
macros as described in the Getting Started Guide. Figure 493 shows the My Macros
library container, the LibreOffice Macros library container, the library container for the
open [Link] file, and the library container for the untitled file created at step 1).
Use the expand/collapse icons to the left of each library container name to view the
libraries, modules, and macros within that container.
Figure 493: Parts of the Basic Macros dialog
(21) My Macros (25) Current document
(22) LibreOffice Macros (26) Create new library
(23) Expand/collapse icon (27) Create new module in library
(24) Open documents (28) Macros in selected module
9) Select the entry for the current document in the Save Macro In area. As the current
document in this example has not been saved, it is referred to by its default name
Untitled 1.
10) Documents that have been saved include a macro library named Standard. This library
is not created until the document is saved, or the library is needed, so at this point in the
example procedure your new document does not contain a library. You can create a
new library to contain the macro you have just created, but this is not necessary.
11) Click the New Module button. Calc displays the New Module dialog (Figure 494). Type
a name for the new module or leave the name as the default Module1.
464 | Calc Guide 26.2
Figure 494: New Module dialog
Note
The libraries, modules, and macro names must follow some strict rules. Following
the main rules, the names must:- Comprise lower case letters (a..z), upper case
letters (A..Z), digits (0..9), and underscore characters (_)
- Begin with a letter or an underscore
- Not contain any other spaces, punctuation symbols, or special characters (including
accents)
12) Click the OK button to create a new module. As no macro libraries exist in our current
document, Calc automatically creates and uses a Standard library.
13) On the Basic Macros dialog, select the entry for the newly created module in the Save
Macro In area, type the text PasteMultiply in the Macro Name box, and click the
Save button (Figure 495).
Figure 495: Select the module and name the macro
The macro is saved with the name PasteMultiply in the newly created module within the
Standard library of the Untitled 1 document. Listing 1 shows the contents of the macro.
Listing 1. Paste special with multiply macro
1|Sub PasteMultiply
2| ' --------------------------------------------------------------
3| ' define variables
4| dim document as object
5| dim dispatcher as object
6| ' --------------------------------------------------------------
7| ' get access to the document
8| document = [Link]
9| dispatcher = createUnoService("[Link]")
10|
11| ' --------------------------------------------------------------
12| dim args1(5) as new [Link]
13| args1(0).Name = "Flags"
Chapter 14 Macros | 465
14| args1(0).Value = "A"
15| args1(1).Name = "FormulaCommand"
16| args1(1).Value = 3
17| args1(2).Name = "SkipEmptyCells"
18| args1(2).Value = false
19| args1(3).Name = "Transpose"
20| args1(3).Value = false
21| args1(4).Name = "AsLink"
22| args1(4).Value = false
23| args1(5).Name = "MoveMode"
24| args1(5).Value = 4
25|
26| [Link](document, ".uno:InsertContents", "", 0, args1())
27|
28|End Sub
Note
The component model used in LibreOffice is Universal Network Objects (UNO) and
the macro recorder uses the UNO dispatcher for most commands. However, there
are two problems associated with this technical approach. One is that the dispatches
are not fully documented and may be subject to change. Another is that the recorder
ignores some values from dialogs that are opened while recording a macro – it is
possible, therefore, that you will record a complicated macro that will not actually
execute everything as expected. For more information, search for “macro recording –
limitations” in the Help index.
Write your own functions
Create a function macro
You can write a macro and then call it as you would call a Calc function. Use the following steps
to create a simple function macro:
1) Use File > New > Spreadsheet on the Menu bar to create a new spreadsheet, save it
with the name [Link], and leave it open in Calc.
2) Access Tools > Macros > Organize Macros > Basic on the Menu bar to open the
Basic Macros dialog (Figure 496). Note that the layout of the Basic Macros dialog in this
circumstance is different from the version that Calc displays when the user clicks the
Stop Recording button on the Record Macro dialog (Figure 493).
Figure 496: Basic Macros dialog
466 | Calc Guide 26.2
3) The Macro From area lists the available macro library containers, including those
relating to any LibreOffice documents that are currently open. My Macros contains
macros that you write or add to LibreOffice and are available to more than one
document. LibreOffice Macros contains macros that were included with your LibreOffice
installation and should not be changed.
4) Click Organizer to open the Basic Macro Organizer dialog (Figure 497).
Click on the Libraries tab and, in the Location area, select the entry for the name of the
current document. The Library area updates to show the name of the empty Standard
library.
Figure 497: Basic Macro Organizer
5) Click New to open the New Library dialog to create a new library for this document
(Figure 498).
Figure 498: New Library dialog
6) Enter a descriptive library name (such as AuthorsCalcMacros) and click OK to
create the library. The Library area of the Basic Macro Organizer dialog updates to
include the name of the newly created library (Figure 499). A library name can comprise
up to 30 characters. Note that in some cases, the dialog may show only a portion of the
name.
Chapter 14 Macros | 467
Figure 499: The new library is shown in the Library area
7) Select the AuthorsCalcMacros entry in the Library area and click Edit to edit the library.
Calc automatically creates a module named Module1 and a macro named Main. Calc
displays the LibreOffice Basic Integrated Development Environment (IDE), shown in
Figure 500.
Figure 500 shows the default configuration for the LibreOffice Basic IDE. This comprises:
• A menu bar.
• Two toolbars (Macro and Standard). The Macro toolbar provides various icons for
editing and testing programs.
• The Object Catalog, enabling the selection of the required library container, library,
module, and macro.
• The Editor Window, in which you can edit the LibreOffice Basic program code. The
column on the left side is used to set breakpoints in the program code.
• The Watch Window (located at the left, below the Object Catalog and Editor Window)
displays the contents of variables or arrays during a single step process.
468 | Calc Guide 26.2
Figure 500: LibreOffice Basic Integrated Development Environment
The Calls Window (located to the right, below the Object Catalog and Editor Window) provides
information about the call stack of procedures and functions when a program runs.
• A tab control area.
• A status bar.
The LibreOffice Basic IDE provides powerful facilities for the development and debugging of
LibreOffice Basic macros. A fuller description of this facility is beyond the scope of this
document, but more information can be found in the Help system.
8) In the Editor Window, modify the code so that it is the same as that shown in Listing 2.
The important addition is the creation of the Volume function, which returns the product
of 3 cells.
Tip
The Option Explicit statement forces all variables to be declared before they are
used. If Option Explicit is omitted, variables are automatically defined at first use
as type Variant.
9) Within the LibreOffice Basic IDE select File > Save on the Menu bar, or click the Save
icon on the Standard toolbar, or press Ctrl+S, to save the modified Module1.
Listing 2. Function that returns the volume of a cube.
1|' ***** BASIC *****
2|Option Explicit
3|Sub Main
4|
5|End Sub
6|
Chapter 14 Macros | 469
1| Function Volume (Height As Double, Width As Double, Depth As Double) As Double
2| Volume = Height * Width * Depth
3| End Function
Using a macro as a function
Using your newly created [Link] spreadsheet, select a cell and enter the
formula =Volume(A1, B1, C1) (Figure 501). Calc finds the macro, calls it, and displays the
result (15.625) in that cell.
Figure 501: Use the Volume macro as a Calc function
Tip
Function names are not case-sensitive. In Figure 501, the function name was
entered as Volume but Calc displays it as VOLUME in the Formula bar.
Macro security warnings
You should now save the Calc document, close it, and open it again. Depending on your settings
in the Macro Security dialog accessed using Tools > Options > LibreOffice > Security >
Macro Security on the Menu bar, Calc may display the warning shown in Figure 502.
Figure 502: Warning that a document contains macros
In the case of the warning shown in Figure 502, you must set the macro security level in Tools >
Options > LibreOffice > Security > Macro Security to a level that let you execute the macro.
When the document loads with macros disabled, Calc will not be able to find any macro
functions and will indicate an error in any affected cell by displaying the text #VALUE? in that cell.
Loaded / unloaded libraries
When it opens a spreadsheet, Calc does not open all macro libraries that it can find in the
available library containers because this would be a waste of resources. Instead, Calc
automatically loads just the Standard library within the My Macros library container and the
document’s own Standard library.
When you re-open your [Link] spreadsheet, Calc does not contain a function
named Volume(), so it checks all visible, loaded macro libraries for the function. Loaded libraries
in LibreOffice Macros, My Macros, and the document are checked for an appropriately named
function. In our initial implementation, the Volume() function is stored in the AuthorsCalcMacros
library, which is not automatically loaded when the document is opened. Hence, the Volume()
function is not found, and an error condition appears in the cell where it is called (Figure 503).
470 | Calc Guide 26.2
Figure 503: The macro function is not available
Use Tools > Macros > Organize Macros > Basic on the Menu bar to open the Basic Macros
dialog (Figure 504). The icon for a loaded library (for example, Standard) has a different
appearance to the icon for a library that is not loaded (for example, AuthorsCalcMacros).
Click the expand icon next to AuthorsCalcMacros to load the library. The icon changes
appearance to indicate that the library is now loaded. Click Close to close the Basic Macros
dialog.
Figure 504: Different symbols for loaded and unloaded libraries
Unfortunately, the cell containing =Volume() in our initial implementation is still in error. Calc
does not recalculate cells in error unless you edit them or somehow change them. The usual
solution is to store macros used as functions in the Standard library. If the macro is large or if
there are many macros, a stub with the desired name is stored in the Standard library. The stub
macro loads the library containing the implementation and then calls the implementation. The
following steps illustrate this method.
1) Use Tools > Macros > Organize Macros > Basic on the Menu bar to open the Basic
Macros dialog. Select the Volume macro and click Edit to open the macro for editing
(Figure 505).
Figure 505: Select a macro and click Edit
Chapter 14 Macros | 471
2) Calc displays the LibreOffice Basic IDE (Figure 500), with the input cursor in the Editor
Window at the line Function Volume (). Change the name of Volume to
Volume_Implementation so that the function’s code matches Listing 3.
Listing 3. Change the name of Volume to Volume_Implementation
1| Function Volume_Implementation (Height As Double, Width As Double, Depth As
Double) As Double
2| Volume_Implementation = Height * Width * Depth
3| End Function
3) Click the Select Macro button in the Standard toolbar of the LibreOffice Basic IDE to
open the Basic Macros dialog (Figure 505).
4) Select the Standard library in the [Link] document and click the New
button to create a new module. Enter a meaningful name such as CalcFunctions
and click OK. Calc automatically creates a macro named Main and opens the module
for editing.
5) Create a macro in the CalcFunctions module of the Standard library that loads the
AuthorsCalcMacros library if it is not already loaded, and then calls the implementation
function. See Listing 4.
Listing 4. Create a new Volume function to call the Volume_Implementation function.
1|Function Volume(Height As Double, Width As Double, Depth As Double) As Double
2| If NOT [Link]("AuthorsCalcMacros") Then
3| [Link]("AuthorsCalcMacros")
4| End If
5| Volume = Volume_Implementation(Height, Width, Depth)
6|End Function
6) Save, close, and reopen the Calc document. This time, if macros are enabled, the
Volume() function works as expected.
Arguments are passed as values
Arguments passed to a macro from Calc are always values. In other words, values are copied to
the macro, and it is not possible to know what cells, if any, are used. For example, =Volume(A1,
B1, C1) passes the value of cells A1, B1, C1, and Volume has no way of knowing that cell A1
(or B1 or C1) was used.
If you must know which cells are referenced rather than the values in the cells, pass the range
as a string, parse the string, and obtain the values in the referenced cells. See ”Accessing cells
directly” below.
Writing macros that act like built-in functions
Although Calc finds and calls macros as normal functions, they do not really behave as built-in
functions. For example, macros do not appear in the function lists. It is possible to write functions
that behave as regular functions by writing an Add-In. However, this is an advanced topic that is
for experienced programmers and is beyond the scope of this guide. Some information, along
with links to more detailed reading, is available in the Help.
Deleting LibreOffice Basic macros
Use the following steps to delete an unwanted macro:
1) Use Tools > Macros > Organize Macros > Basic on the Menu bar to open the Basic
Macros dialog (Figure 505).
2) Select the macro to be deleted and click the Delete button.
472 | Calc Guide 26.2
3) Calc displays a confirmation dialog. Click Yes to continue.
4) Click the Close button to remove the Basic Macros dialog from the screen.
Use the following steps to delete an unwanted module:
1) Use Tools > Macros > Organize Macros > Basic on the Menu bar to open the Basic
Macros dialog (Figure 505).
2) Click the Organizer button to open the Basic Macro Organizer dialog (Figure 506).
3) Make sure that the Modules tab is selected.
4) Select the module to be deleted in the Module area.
5) Click the Delete button.
6) Calc displays a confirmation dialog. Click Yes to continue.
7) Click the Close button to remove the Basic Macro Organizer dialog from the screen.
8) Click the Close button to close the Basic Macros dialog.
Figure 506: Basic Macro Organizer dialog, Modules tab
Accessing cells directly
You can access the LibreOffice internal objects directly to manipulate a Calc document. For
example, the macro in Listing 5 adds the values in cell A2 from every sheet in the current
document. ThisComponent is automatically set to reference the current document when the
macro starts. A Calc document contains sheets and the macro accesses these via a call to
[Link](). Use getCellByPosition(col, row) to return a cell at a
specific row and column.
Listing 5. SumCellsAllSheets adds the values in cell A2 of every sheet.
1|Function SumCellsAllSheets()
2| Dim TheSum As Double
3| Dim i As integer
4| Dim oSheets
5| Dim oSheet
6| Dim oCell
7|
Chapter 14 Macros | 473
8| TheSum = 0
9| oSheets = [Link]()
10| For i = 0 To [Link]() - 1
11| oSheet = [Link](i)
12| oCell = [Link](0, 1) ' GetCell A2
13| TheSum = TheSum + [Link]()
14| Next
15| SumCellsAllSheets = TheSum
16|End Function
Tip
A cell object supports the methods getValue(), getString(), and getFormula()
to get the numerical value, the string value, or the formula used in a cell. Use the
corresponding set functions to set appropriate values.
Use [Link]("A2") to return a range of cells by name. If a single cell is
referenced, then a cell object is returned. If a cell range is given, then an entire range of cells is
returned (see Listing 6). Notice that a cell range returns data as an array of arrays, which is
more cumbersome than treating it as an array with two dimensions.
Listing 6. SumCellsAllSheets adds the values in cells A2:C5 of every sheet.
1|Function SumCellsAllSheets()
2| Dim TheSum As Double
3| Dim iRow As Integer, iCol As Integer, i As Integer
4| Dim oSheets, oSheet, oCells
5| Dim oRow(), oRows()
6|
7| TheSum = 0
8| oSheets = [Link]()
9| For i = 0 To [Link]() - 1
10| oSheet = [Link](i)
11| oCells = [Link]("A2:C5")
12|
13| ' The getDataArray() method returns strings and numbers
14| ' but is not used in this function.
15|
16| ' The getData() method returns only numbers and is applicable
17| ' to this function.
18|
19| oRows() = [Link]()
20| For iRow = LBound(oRows()) To UBound(oRows())
21| oRow() = oRows(iRow)
22| For iCol = LBound(oRow()) To UBound(oRow())
23| TheSum = TheSum + oRow(iCol)
24| Next
25| Next
26| Next
27| SumCellsAllSheets = TheSum
28|End Function
Tip
When a macro is called as a Calc function, the macro cannot modify any value in the
sheet from which the macro was called, except the value of the cell that contains the
function.
474 | Calc Guide 26.2
Overview of BeanShell, JavaScript, and Python
macros
Introduction
Many programmers may not be familiar with LibreOffice Basic and so Calc supports macros
written in three other languages that may be more familiar. These are BeanShell, JavaScript,
and Python.
The primary macro scripting language for Calc is LibreOffice Basic and the standard LibreOffice
installation provides a powerful integrated development environment (IDE) together with more
options for this language.
Macros are organized in the same way for all four scripting languages. The LibreOffice Macros
container holds all the macros that are supplied in the LibreOffice installation. The My Macros
library container holds your macros that are available to any of your LibreOffice documents.
Each document can also contain your macros that are not available to any other document.
When you use the macro recording facility, Calc creates the macro in LibreOffice Basic. To use
the other available scripting languages you must write the code yourself.
When you select to run a macro using Tools > Macros > Run Macro on the Menu bar, Calc
displays the Macro Selector dialog. This dialog enables the selection and running of any
available macro, coded in any of the available languages (Figure 507).
When you select to edit a macro using Tools > Macros > Edit Macros on the Menu bar, Calc
displays the LibreOffice Basic IDE. This dialog enables selection and editing of any available
LibreOffice Basic macro, but not macros in other languages.
The component model used in LibreOffice is known as Universal Network Objects or UNO.
LibreOffice macros in any scripting language use a UNO runtime application programming
interface (API). The XSCRIPTCONTEXT interface is provided to macro scripts in all four languages
and provides a means of access to the various interfaces which they might need to perform
some action on a document.
Figure 507: Macro Selector dialog
BeanShell macros
BeanShell is a Java-like scripting language that was first released in 1999.
Chapter 14 Macros | 475
When you select Tools > Macros > Organize Macros > BeanShell on the Menu bar, Calc
displays the BeanShell Macros dialog (Figure 508).
Figure 508: BeanShell Macros dialog
Click the Edit button on the BeanShell Macros dialog to access the BeanShell Debug Window
(Figure 509).
Figure 509: BeanShell Debug Window
Listing 7 is an example of a BeanShell macro that inserts the text “Hello World from BeanShell”
in cell A1 of the active Calc spreadsheet.
Listing 7. Sample BeanShell macro.
1| import [Link];
2| import [Link];
3| import [Link];
4| model = [Link]();
5| controller = [Link]();
476 | Calc Guide 26.2
6| view = [Link]([Link], controller);
7| sheet = [Link]();
8| cell = [Link](0, 0);
9| cellText = [Link]([Link], cell);
10| textCursor = [Link]();
11| [Link](textCursor, "Hello World from BeanShell", true);
12| return 0;
JavaScript macros
JavaScript is a high-level scripting language that was first released in 1995.
When you select Tools > Macros > Organize Macros > JavaScript on the Menu bar, Calc
displays the JavaScript Macros dialog (Figure 510).
Figure 510: JavaScript Macros dialog
Note
You cannot edit JavaScript macros inside LibreOffice. You must edit the macro on an
external editor.
Listing 8 is an example of a JavaScript macro that inserts the text “Hello World from JavaScript”
in cell A1 of the first sheet in a Calc spreadsheet.
Listing 8. Sample JavaScript macro.
1| importClass([Link]);
2| importClass([Link]);
3| importClass([Link]);
4| importClass([Link]);
5| importClass([Link]);
6| documentRef = [Link]();
7| spreadsheetInterface = [Link](XSpreadsheetDocument,
documentRef);
8| allSheets = [Link](XIndexAccess,
[Link]());
9| theSheet = [Link](0);
10| Cells = [Link](XCellRange,theSheet);
11| cellA1 = [Link](0,0);
12| theCell = [Link](XCell,cellA1);
13| [Link]("Hello World from JavaScript");
Chapter 14 Macros | 477
Python macros
Python is a high-level, general-purpose programming language that was first released in 1991.
In recent years it has grown in popularity and is commonly used by data scientists
When you select Tools > Macros > Organize Macros > Python on the Menu bar, Calc displays
the Python Macros dialog (Figure 511).
Figure 511: Python Macros dialog
Facilities to edit and debug Python scripts are not currently integrated into the standard
LibreOffice user interface. However, you can edit Python scripts with your preferred text editor or
an external IDE. The Alternative Python Script Organizer (APSO) extension eases the editing of
Python scripts, in particular when embedded in a document. Using APSO you can configure your
preferred source code editor, start the integrated Python shell and debug Python scripts.
For more information search for “Python macros” in the LibreOffice Help system and visit the
Designing & Developing Python Applications section of The Document Foundation’s wiki
([Link]
Listing 9 is an example of a Python macro that sets cell A1 of the first sheet in a Calc
spreadsheet to the text “Hello World from Python”.
Listing 9. Sample Python macro
1|import uno
2|
3|def HelloWorld():
4| doc = [Link]()
5| cell = [Link][0]['A1']
6| [Link]('Hello World from Python')
7| return
ScriptForge library
Macro programmers frequently need to perform tasks such as creating and opening files,
accessing form controls, reading data from databases embedded in LibreOffice Base
documents, and so forth. The objective of the ScriptForge library is to simplify the creation of
macros by making it easier to execute such commands without having to learn the required
478 | Calc Guide 26.2
LibreOffice APIs (Application Programming Interfaces) and commands, which may be difficult for
casual programmers.
The ScriptForge library supports both LibreOffice Basic and Python. It is organized into a set of
services, each of which provides methods and properties related to a specific topic. For
example, the Dialog service provides access to dialogs available in script modules and the
Database service allows execution of SQL commands in Base documents.
Chapter Getting Started with Macros, of the Getting Started Guide contains additional
introductory material about the ScriptForge library and includes a simple example. More detailed
information and many examples can be found in the LibreOffice Help system, by searching for
the term “ScriptForge” in the index.
Built-in object inspector
LibreOffice has an extensive API (Application Programming Interface) that can be used by macro
programmers to automate almost any aspect of its applications. However, one of the main
challenges for programmers is to discover UNO (Universal Network Objects) object types as well
as their supported services, methods, and properties.
The built-in object inspector can be used to help macro developers inspect objects and discover
how they can be accessed and used. To access this tool, go to Tools > Development Tools on
the Menu bar and an object inspector window (Figure 512) will be opened. By default, this
window is docked at the bottom of the user interface.
The left portion of the window consists of the Document Object Model (DOM) navigator, which
allows the user to navigate through all the objects in the document. When an object is selected,
the following information about the object is shown on tabs within the right portion of the window:
• The names of all implemented interfaces.
• The names of all services supported by the object.
• The names and types of all properties available in the object.
• The names, arguments and return types of all methods that can be called by the object.
Instead of inspecting objects using the DOM navigator, it is possible to directly inspect the
currently selected object in the document by toggling the Current Selection button.
Figure 512: Object inspector window
“Getting Started with Macros” in the Getting Started Guide contains additional information about
the built-in object inspector. More detailed information and examples can be found in the
LibreOffice Help system, by searching for the term “development tools” in the help index.
Chapter 14 Macros | 479
Working with VBA macros
For the Excel/VBA programmer, LibreOffice Basic is a programming language very similar to
VBA. The primary reason that VBA does not work in Calc, even though Calc can read the Excel
workbook, is that Calc uses a different mechanism to access the workbook (called spreadsheet
in Calc) components, such as cells on the worksheet (called sheet in Calc). Specifically, the
objects, attributes, and methods use different names and the corresponding behavior is
sometimes slightly different.
To convert VBA code, you must first load the VBA code in LibreOffice.
Loading VBA code
On the VBA Properties page (Tools > Options > Load/Save > VBA Properties), you can
choose whether to keep any macros in Microsoft Office documents that are opened in
LibreOffice.
Figure 513: Choosing Load/Save VBA Properties
If you choose Load Basic code, you can edit the macros in LibreOffice. The changed code is
saved in an ODF document but is not retained if you save it into a Microsoft Office format.
If you choose Save original Basic code, the macros will not work in LibreOffice but are retained
unchanged if you save the file into Microsoft Office format.
If you are importing a Microsoft Word or 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 Basic IDE you will notice that it is all commented), with this option the code is
ready to be executed.
Save original Basic code takes precedence over Load Basic code. If both options are
selected, and you edit the disabled code in LibreOffice, the original VBA code will be saved
when saving in a Microsoft Office format.
To remove any possible macro viruses from the Microsoft Office document, deselect Save
original Basic code. The document will be saved without the VBA code.
Option VBASupport statement
The Option VBASupport statement specifies that LibreOffice Basic will support some VBA
statements, functions, and objects. The statement must be added before the executable
program code in a module.
480 | Calc Guide 26.2
Note
The support for VBA is not complete but covers a large portion of the common usage
patterns.
When VBASupport is enabled, LibreOffice Basic function arguments and return values are the
same as their VBA counterparts. When the support is disabled, LibreOffice Basic functions may
accept arguments and return values different from their VBA counterparts.
Listing 10. Option VBASupport usage.
1|Option VBASupport 1
2|Sub Example
3| Dim sVar As Single
4| sVar = Worksheets("Sheet1").Range("A1")
5| Print sVar
6|End Sub
Without the Option VBASupport statement, the code in Listing 10 must be converted to the
LibreOffice Basic of Listing 11.
Listing 11. Converted VBA code.
1|Sub Example
2| Dim sVar As Single
3| Dim oSheet as Object
4| Dim oCell as Object
5| ' Worksheets(“Sheet1”).
6| oSheet = [Link]().getByIndex(0)
7| ' Range("A1")
8| oCell = [Link](0, 0)
9| sVar = [Link]()
10| Print sVar
11|End Sub
Option VBASupport may affect or assist in the following situations:
• Allow special characters as identifiers. All characters that are defined as letters in the
Latin-1 (ISO 8859-1) character set, are accepted as part of identifiers. For example,
variables with accented characters in their names.
• Create VBA constants including non-printable characters (vbCrLf, vbNewLine,...).
• Support Private/Public keywords for procedures.
• Compulsory Set statement for objects.
• Default values for optional parameters in procedures.
• Named arguments when multiple optional parameters exist.
• Preload of LibreOffice Basic libraries.
VBA UserForms (LibreOffice Basic Dialogs)
UserForms (Dialogs) appear frequently in macros that demand your interaction and parameter
selections. The code snippet below is a recipe for such conversions, which are not handled
automatically by VBA options.
Listing 12. VBA display of a UserForm [Dialog] called “MyForm”,
1|Sub MyProc
2| [Link]
3|End Sub
Chapter 14 Macros | 481
Listing 13. LibreOffice Basic display of a UserForm [Dialog] called “MyForm”
' oDlg should be visible at the module level
1|Dim oDlg As Object
2|Sub MyProc
3| [Link]("Standard")
4| oDlg = CreateUnoDialog([Link])
5| [Link]()
6|End Sub
Note
The oDlg variable is visible at the module level to all other procedures that are
accessing controls on the dialog. This means all the procedures manipulating or
accessing controls on this dialog panel are housed in a single module.
Conclusion
This chapter provides an overview of how to create libraries and modules, using the macro
recorder, using macros as Calc functions, writing your own macros without the macro recorder,
and converting VBA to LibreOffice Basic. 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.
If you are already familiar with the BASIC language (or with one programming language), the
LibreOffice Extensions website ([Link] has a set of LibreOffice Basic
quick reference cards. These can be located quickly by selecting the Documentation and Macro
tag filters.
Additional detail about Calc’s macro facilities can be obtained from the LibreOffice Help system
(search for “macros” in the index for general information, or search for “VBA Support” to find
some specific VBA Support information), The Document Foundation’s wiki pages
([Link] and other Internet sources (for example the
[Link] Q&A site).
482 | Calc Guide 26.2
Calc Guide 26.2
Chapter 15
Calc as a Database
Introduction
In many everyday scenarios, Calc spreadsheets can be used to aggregate sets of data and to
perform analyses on them. As the data in a spreadsheet is laid out in a table view, plainly visible
and easily edited or extended, some users may not need the comprehensive relational database
facilities provided by the Base component of LibreOffice. For such users, Calc has sufficient
functionality to act as a simple yet capable database-like platform. This chapter presents an
overview of these capabilities.
For those users who initially choose to manage their data in a Calc spreadsheet and
subsequently decide that they need to use a more comprehensive database system, migrating
Calc data to Base is straightforward. In the other direction, for Base users who wish to take
advantage of some of Calc’s features to analyse or visualize their data, Base can be used for
creating linked data ranges in Calc files, for pivot table analysis, or as the basis for charts. See
the Base Guide for more information.
Earlier versions of this chapter contained several examples with LibreOffice Basic macros.
These are now available on The Document Foundation’s wiki at
[Link] Much of the macro information on those pages
is drawn or adapted from Andrew Pitonyak’s book, [Link] Macros Explained (OOME)
and LibreOffice’s API reference at [Link]
A database primer
In a typical database, related data is organized into tables, which are arranged in a grid-like
series of rows and columns similar to a spreadsheet. Each row of a table represents a data
record, while each column represents a field within each record. Each cell in a field contains an
individual data item or attribute, such as a name, while each record consists of related attributes
that correspond to a single entity, like a person. A database table tends to have a fixed number
of fields, but can have an indefinite number of records.
While a table may have hundreds or thousands of rows, individual records can be easily found,
retrieved, and updated using information requests, called queries, that search for records that
meet a specified set of criteria. It is this ease of access that makes a database table more useful
than simply filing away information in an unordered spreadsheet.
To illustrate this concept of a database table, consider the example of a class grading sheet
(Figure 514). In this sheet, each row represents individual students taking the class, while each
column contains their names and grades. With this table, you can quickly look up individual
students’ grades simply by searching for their names, and you can determine which students are
passing the class by filtering out records with failing average scores.
Figure 514: Grading sheet example
Many modern database management systems are based on the relational database model, in
which the data and relationships are represented by a series of inter-related tables. The Base
484 | Calc Guide 26.2
component of LibreOffice is a fully featured relational database management system. Calc does
not support the relational database model.
Calc as a database-like program
A Calc sheet is similar to a flat, non-relational database table, and it is possible for a database
table to be contained in a Calc sheet. The data can be deeply analyzed using a wide range of
tools and functions. It can be sorted, filtered, pivoted, and presented visually in 2-D/3-D charts
and graphics. Calc is not a replacement for a fully featured database application but it can be
useful for managing data in many small-scale personal or professional contexts.
Associating a range with a name
In order to set up a database table in a Calc sheet, you first need to set up an area for it to
occupy. This is necessary since some of Calc’s database-like features depend on accessing or
modifying a table’s location. Such an area is represented by a range, which is a contiguous
group of one or more cells. To make the range for a table easy to access, you can assign a
meaningful name to it. Doing this has four particular benefits:
• Giving a range a name makes it easier to identify, especially if you are working with
multiple ranges in a document.
• A named range can be referenced by its name rather than just by its address. For
example, if you have a range named Scores, you can simply reference it in a cell with a
formula like =SUM(Scores).
• References by name to a named range are automatically updated every time the
range’s address is changed. This avoids the need to change individual references
every time a range’s location is modified.
• All named ranges can be quickly viewed and accessed through the Navigator,
which is opened by selecting View > Navigator on the Menu bar, pressing the F5 key,
or clicking the Navigator icon on the Sidebar tab panel.
Two types of named range exist in Calc: database ranges, which store settings for database-like
operations, and standard named ranges, which do not.
Named ranges
Technically a named range is a named formula expression and its content is always set as a
string. A commonly used type of expression is an absolute cell range like
“$Sheet1.$A$1:$E$15”. However, other expression types are possible. For example, the
expression “$Sheet1.$A$1:$A$4~$Sheet1.$B$1:$B$4” encompasses two separate cell
ranges (the tilde character is a reference concatenation operator). Alternatively a formula
expression such as “PI()*B1*B1” might be defined to calculate the area of a circle, given the
radius. In the remainder of this section we will be concerned only with named ranges defined as
a single matrix-like cell range.
A quick way of creating a new named range is to select the relevant cells in your sheet and then
simply start typing a name in the Name Box, located at the left of the Formula bar. Notice the
“Define Name for Range” tooltip that appears as you type and press the Enter key when you
have finished typing.
Named ranges are also created using the Define Name dialog (Figure 515), which is opened
either by selecting Sheet > Named Ranges and Expressions > Define on the Menu bar or by
clicking the Add button on the Manage Names dialog (Figure 516).
Chapter 15 Calc as a Database | 485
Figure 515: Define Name dialog
To create a named range, select a range of cells from a sheet, then open the Define Name
dialog. Next, give the range a meaningful name, and click on Add to add it to the current
document’s list of named ranges. You can then access and modify these ranges using the
Manage Names dialog (Figure 516), which is opened by selecting Sheet > Named Ranges and
Expressions > Manage on the Menu bar, or pressing Ctrl+F3, or selecting Manage Names in
the Name Box located at the left of the Formula bar.
Figure 516: Manage Names dialog
To reduce the typing required when referencing a named range, a Paste Names dialog (Figure
517) can be accessed by selecting Insert > Named Range or Expression or Sheet > Named
Ranges and Expressions > Insert on the Menu bar. Select the entry for the relevant named
486 | Calc Guide 26.2
range and click the Paste button to insert the selected named range at the current cursor
position.
Figure 517: Paste Names dialog
For more detail about how to create and manage ranges, see Chapter 8, Printing, Exporting,
Emailing, and Signing, and Chapter 9, Using Formulas and Functions.
Creating named ranges using row or column headers
With the Create Names tool, which is accessed by selecting Sheet > Named Ranges and
Expressions > Create on the Menu bar (Figure 518), you can create multiple named ranges
simultaneously from the headers of a table. These headers can be drawn from the table’s
borders – top and bottom rows, and left and right columns – and each row or column that
corresponds to a header is used to create the named ranges themselves. For example, if you
choose to create ranges from headers contained in the top row of a table, each range will be
generated from the individual columns that correspond to each header label.
Note
Header cells are not included in the named ranges generated using the Create
Names tool. This is because the labels in each of these cells are used to name the
ranges.
Figure 518: Create Names dialog
To use the Create Names tool:
1) In a sheet, select the table from which to create the named ranges. Be sure to include
the header rows or columns as part of your selection.
2) Open the Create Names dialog by selecting Sheet > Named Ranges and
Expressions > Create on the Menu bar.
3) Calc automatically identifies which rows or columns contain headers, and will mark the
checkboxes – Top row, Left column, Bottom row, Right column – that apply.
Chapter 15 Calc as a Database | 487
However, if you wish to change this selection, you can manually select or deselect any
of the boxes at this point.
4) Click OK to close the dialog and create the new named ranges.
Tip
Avoid giving multiple rows or columns the same label, as the ranges generated from
them will likewise share the same name, and can end up being overwritten by Calc.
Database ranges
Although it can be used like a regular named range, a database range is intended to be used
like a database table, with each row representing a record and each cell a field within a record.
Specifically, a database range differs from a named range in the following ways:
• A database range cannot be a formula expression, only a single rectangular cell range.
This range can be formatted as a table, with the first row reserved for headings and the
last row for subtotals. Cell formatting can also be preserved for each field in the table.
• Database ranges cannot be referenced relative to a base address within a sheet, which
is possible with a named range.
• Database ranges store sorting, filtering, subtotaling, and data import settings in data
structures called descriptors, which can be retrieved and accessed using macros. All
descriptors of a database range are updated when a database operation is carried out
on the cell range of the database range.
• Unlike a named range, a database range can be connected to an external data source,
from where you can fetch data into the spreadsheet document.
Database ranges can be created, modified, and deleted using the Define Database Range
dialog (Figure 519).
Figure 519: Define Database Range dialog
488 | Calc Guide 26.2
To create a database range:
1) If you want Calc to automatically determine the full extent of your database table, then
select a single cell within its cell area. If you want to explicitly define the extent of the
database table, then select all relevant cells.
2) Open the Define Database Range dialog by selecting Data > Define Range on the
Menu bar.
3) Type a name for the range in the Name field. Only use letters, numbers, and
underscores; spaces, hyphens, and other characters are not allowed.
4) Click on the expand symbol (usually a plus or a triangle) next to the Options label to
expand this section and view and select the following options:
– Contains column labels – Denotes whether the top row is reserved for field
headings.
– Contains totals row – Denotes whether the bottom row is reserved for totals.
– Insert or delete cells – If active, this option will insert new rows and columns into the
database range when new records are added to its source. Only relevant if an
external database source is linked to the range. To manually update the database
range, use Data > Refresh Range on the Menu bar.
– Keep formatting – Applies the existing cell formats of the first data row to the whole
database range.
– Don’t save imported data – If selected, this option only saves a reference to the
source database; the contents of the range’s cells are not preserved.
– Source – Displays information about the current database source, if one exists. For
example, “Bibliography/biblio”.
– Operations – Denotes what operations (if any) have been applied to the database
range. For example, “Sort”, “Filter”, or “Subtotals”.
5) Click Add to add a range to the database range list under the Name field.
6) Click OK to close the dialog and save the database range.
To modify an existing database range:
1) Open the Define Database Range dialog by selecting Data > Define Range on the
Menu bar.
2) Select a range from the range list under the Name field or type its name into the Name
field. The Add button will change to Modify at this point.
3) Make any modifications in the Range field and the Options section.
4) Click Modify to update the database range.
5) Click OK to close the dialog and save the modified database range.
To delete an existing database range:
1) Open the Define Database Range dialog by selecting Data > Define Range on the
Menu bar.
2) Select the range to be deleted from the list in the upper section of the dialog.
3) Click Delete and then click the Yes button on the confirmation dialog that appears.
4) Click OK to close the Define Database Range dialog.
To select an existing database range from the current document, open the Select Database
Range dialog by choosing Data > Select Range on the Menu bar (Figure 520). Next, select a
Chapter 15 Calc as a Database | 489
range in the Ranges list and click OK. Another way to select an existing database range is using
the Navigator deck on the Sidebar. Calc will automatically highlight the range’s position in the
sheet in which it is located.
Figure 520: Select Database Range dialog
Using the Data Provider Tool to Load Data in
Spreadsheets
The Data Provider tool enables users to import data from various sources and manipulate it
within LibreOffice Calc. During the import process, the tool allows for data transformations to be
applied before loading it into the spreadsheet. These transformations include operations on
columns and rows, as well as numerical, date, and text modifications, along with content
replacement and sorting.
The Data Provider tool operates on predefined database ranges. Before you can retrieve data,
you need to establish a range (Data > Define Range; please refer to the section on Database
ranges above). When creating a database range, be sure to size it appropriately for the volume
of data you anticipate loading.
Before finalizing the import, a preview window offers a glimpse of the resulting data set, ensuring
you can review the changes before they are applied.
The input data must be available in one of the following formats:
• CSV (Comma Separated Value)
• HTML
• XML (Extensible Markup Language)
The Data Provider dialog window can be opened in three ways:
• From the menu bar, choose Data > Data Provider.
• From the Data tab on the tabbed interface, choose Data Provider.
• From toolbars, choose Data Provider.
Data Provider Input Parameters
The following parameters must be set using the Data Provider dialog (Figure 521):
Database Range
Select the database range to receive data from the provider using the dropdown list.
You must have database ranges defined previously.
490 | Calc Guide 26.2
Figure 521: Data provider dialog
Data Format
Choose the format of the imported data from the dropdown list
URL
Enter the data provider’s URL. For local files, provide the file path and name. For web
services, enter the URL.
Identifier
Specify the XPath for XML or HTML data. For example, to get the fifth table of an HTML
or XML document, the identifier must be //table[5]. The identifier //table is equivalent
of //table[1].
Transformations
Select one of the transformations in the dropdown list and then click on the Add button.
The transformation is placed in the box just below. Many transformations require further
parameters and you must supply them. If a transformation is not needed, remove it by
clicking on the Delete button. Table 23 below list all available transformations.
Note
You cannot reorder the transformation list. You must plan in advance the correct
sequence of transformations.
Available Data Transformations
The set of transformation is extensive, and many transformations have secondary operations.
Table 23: Available data provider transformations
Transformation Description
Delete Column Removes columns based on specified indexes (separated by semicolons).
Removes rows containing the specified lookup value in the given column
Delete Rows
index.
Swap Rows Swaps the positions of two rows.
Split Columns Splits a column into two based on a specified separator character or string.
Chapter 15 Calc as a Database | 491
Transformation Description
Merge Columns Combines multiple columns, inserting a separator between values.
Modifies text in selected columns:
To Lower: Converts text to lowercase.
Text
To Upper: Converts text to uppercase.
Transformations
Capitalize: Capitalizes the first letter of each word.
Trim: Removes excess spaces, leaving only single spaces between words.
Sort Columns Sorts rows in ascending or descending order based on a column index.
Adds aggregate results at the bottom of a column:
Aggregate Sum: Total of column values.
Functions Average: Mean of column values.
Max / Min: Highest or lowest value in the column.
Performs numeric calculations on selected columns:
Sign: Returns +1 for positive, -1 for negative, and 0 for zero values
Round, Round Up / Round Down: Rounds numbers to a specified
precision.
Numeric
Absolute Value: Converts negative numbers to positive.
Functions
Log (base e or 10): Computes the logarithm.
Cube / Square / Square Root: Computes respective mathematical values.
Exponent: Returns ex.
Is Even / Is Odd: Identifies even or odd numbers (returns 0 for decimals).
Replace Null Replaces missing or null values with specified text.
Extracts or modifies date/time values based on locale settings:
Date and Time Year / Month / Day: Extracts date components.
Transformations Start / End of Year, Month, Quarter: Returns respective boundary dates.
Hour / Minute / Second: Extracts time components.
Find / Replace Finds and replaces values in the specified column index.
Once all parameters and transformations are set and previewed, click OK to load the data.
Refreshing data provided.
If the data provided comes from a web service or the input data has changed, you can refresh
the data using the Refresh Data Provider Tool.
Fetching data from data sources
To fetch data from a data source to create a new database range, carry out the following steps:
1) Open the Data Sources Explorer by selecting View > Data Sources on the Menu bar or
pressing Ctrl+Shift+F4.
2) In the left pane of the Data Sources Explorer, click the expand symbol at the left of the
data source name of interest. This action opens the tree to display the tables or queries
associated with the data source.
3) Click on the required table or query to display its constituent data in the right pane of the
Data Sources Explorer.
4) Click on the blank rectangular area in the top left corner of the right pane of the Data
Sources Explorer to select all the data in the displayed table or query.
492 | Calc Guide 26.2
5) Drag and drop the data to the cell that is to be in the top left corner of the data in your
spreadsheet. Search for “drag and drop – data source view” in the Help system for
more information about dragging and dropping data from the Data Sources Explorer.
6) Calc automatically creates a new database range with default parameters,
encompassing the cell range of the imported data and with a default name of the form
Import1, Import2, etc.
7) If required, access the Define Database Range dialog (Figure 519) to update settings of
the new database range.
Select Data > Refresh Range on the Menu bar to refresh the contents of a database range
once the data in the associated data source is updated. The data in the sheet is updated to
match the data in the external database. Registering and linking to external database sources
are explained in more detail in Chapter 12, Linking Data.
Referencing in a Calc Database Table
LibreOffice can make formulas in Calc database tables easier to read and maintain, by
referencing a cell rectangle or the entire database range without using direct references like
$B$1:$D$23. To use database tables references you need to know:
• The name of the database range;
• Its field names, usually given by the first row of the database range;
• Specific reference keywords;
For example: myData[[#Totals];[Sales]]
This concept is similar to “structured references" for a "table" in Microsoft Excel. An Excel "table"
is loaded as a database-range in Calc.
Note
When saving as an .xlsx file in Excel, “structured references” are retained. However,
in Calc, the ODF standard does not yet have the means to save “structured
references”. When saving as an .ods file, a “structured reference” is converted into a
direct reference using the values present at the time of saving.
Setting up a table
Spreadsheet “tables” are defined by database ranges (Data > Define Range). See Database
ranges above. In addition to the name of the database, the following is mandatory for using
“structured references”:
• Tables must be vertically oriented.
• Tables must have column labels, if interoperability with Excel is required.
• The column label names must follow the named range rules. See Named ranges above.
The table below contains values used in examples later on in this document.
A B C D
1 Name Region Sales Seniority
2 Smith West 21 5
3 Jones East 23 11
4 Johnson East 9 7
Chapter 15 Calc as a Database | 493
A B C D
5 Taylor West 34 11
6 Brown East 23 15
7 Walker East 12 4
8 Edwards East 15 12
9 Thomas West 17 10
10 Wilson West 31 3
11 Totals 2 185 8.67
The cell range A1:D11 was defined as database range "myData". The options Contains column
labels and Contains totals row were checked when defining the database range (Figure 519).
Reserved reference keywords
[#Headers]
The keyword [#Headers] references the row of field names (column labels). It is the
first row of the database range.
Example: The expression myData[#Headers] references the cells A1:D1.
If the database range has no labels, a #REF! error is generated.
[#Data]
The keyword [#Data] references the data records of the database range, excluding the
columns header row and the totals row.
Example: The expression myData[#Data] references the cell rectangle A2:D10.
The short form myData[] can be used as well.
[#Totals]
The keyword [#Totals] references the row of totals. It is the last row of the database
range.
Example: The expression myData[#Totals] references the cells A11:D11.
If the database range has no totals, a #REF! error is generated.
[#All]
The keyword [#All] references the entire database range including column headers
and totals.
Example: The expression myData[#All] references the cells A1:D11.
[#This Row]
This keyword describes an implicit intersection. See Implicit intersection of array
formulas in Chapter 9 – Using Formulas and Functions for more information and
examples.
Example: If the expression myData[#This Row] is used in a formula in cell F2, it
references A2:D2. If the same expression is used in a formula in cell F5, it references
A5:D5.
494 | Calc Guide 26.2
Note
The intersection is only possible with rows of the database range. A similar This
Column does not exist. If a database row does not exist in the row where the formula
is placed, a #VALUE! error is generated.
Tip
When switching from Excel to Calc, Excel does not allow the keyword [#This Row]
for the entire table range. If applied to non-data record rows, such as header or totals
rows, an error is produced.
In the user interface, Excel uses the short form myData[@]. This implicit intersection operator @
is not currently available in Calc.
Referencing data in tables
A “structured reference” to cells in a database range has the form name of database range […]
where the part inside the square brackets can be one of the keywords described in the previous
section, a field name in square brackets, or a combination of the two.
In case a single keyword or a single field name is used, single brackets are used instead of
double brackets. For example: myData[#Headers] instead of myData[[#Headers]] or
myData[Region] instead of myData[[Region]].
Field name in square brackets
To address the array of all values in the records that belong to the same field, use the form
[field name]. The referenced cell range does not include label and totals. For example, the
expression myData[[Region]] or its simplified form myData[Region] references the cells
B2:B10. If the database range has no label row, generic labels like Column1, Column2 can be
used.
Note
In Excel, if the formula cell belongs to the table, then the name of the table may be
omitted. For example, the formula =SUM(myData[Sales]) in cell C11 could be
written as =SUM([Sales]). Omission of the table name is not yet possible in Calc.
Combinations
To reference a combination of the labels row and data records, use the format [#Headers];
[#Data] or [#Headers],[#Data], where the separator is the same separator as for function
parameters. So whether to use a semicolon or a comma depends on the setting defined in Tools
> Options > Calc > Formula.
To reference a combination of data records and totals row, use [#Data];[#Totals]. For
example, myData[[#Data];[#Totals]] references the cells A2:D11.
A combination like [#Headers];[#Totals] is not possible as that would result in two disjoint
cell rectangles.
To address several adjacent columns, use the range operator “:”. For example, the formula
myData[[Name]:[Sales]] addresses the cells A2:C10.
The use of non-adjacent columns is not possible since it would reference two separate cell
rectangles.
Chapter 15 Calc as a Database | 495
The reference via field name and the use of a reference keyword can be combined, first the
keyword, then function separator and last the field name in brackets. For example,
myData[[#Totals];[Sales]] references the cell C11.
Using structured references
The use of structured references is only allowed if the database range has a vertical orientation.
Using a structured reference on a horizontally oriented database range will produce invalid
results without producing an error message.
A direct use such as =myData[#Headers] is possible. The generated array Names Region
Sales Seniority spills over 4 columns.
Note
Instead of using the formula =myData. which will copy the entire database range in
LibreOffice and then produce an error when opened in Excel, use the formula
=myData[#All].
The output array or value of a structured reference can be used as input to other functions. For
example, the cells in row 11 have these formulas:
B11 =COUNTA(UNIQUE(myData[Region]))
C11 =SUM(myData[Sales])
D11 =AVERAGE(myData[Seniority])
If a formula uses a structured reference and it references an array of more than one cell, then
the formula has to be handled as array formula that has enclosing curly brackets in the input line
like {=myData[#Headers]}.
Sorting a block of cells
Sorting is the process of rearranging data in a range or a sheet according to a specified sort
order.
A block of cells is a rectangular range of cells surrounded by empty cells.
LibreOffice Calc automatically identifies a block of cells for sorting. Place the cursor within the
block, and the sorting will take place accordingly.
If all the cells in the first row of a block are text cells, this row is assumed to be the header. The
sorting will then be performed from the second row to the last row of the block, except if all the
block cells are text cells.
However, if any cell in the first row contains a numerical value, or all the block cells are text cells,
the first row will not be considered a header, and sorting will be applied to the entire block.
The sorting is applied to the selected column or the first column of the block.
If the selected column is inside the block, LibreOffice Calc prompts to extend the sorting to the
adjacent columns.
The simplest way to sort a database table based on the contents of a single column is to use the
Sort Ascending and Sort Descending tools, as described in Chapter 2 - Entering and Editing
Data - Sorting data.
496 | Calc Guide 26.2
Filtering
A filter is a tool that hides or displays records within a sheet based on a set of filtering criteria.
Similar to sorting, filters are useful for narrowing down long lists of data in order to find particular
data items. In Calc, three types of filter exist:
• AutoFilters
• Standard filters
• Advanced filters
If you want to remove any filtering applied to your database table, simply select Data > More
Filters > Reset Filter on the Menu bar.
Filters are also described in Chapter 2, Entering and Editing Data.
AutoFilter
AutoFilters are the most straightforward of the three filter types. They work by providing access
to a combo box through a down-arrow button located at the top of one or more data columns. To
add AutoFilters to all columns of a database table, click on a cell anywhere within the table area
and then select Data > AutoFilter on the Menu bar, click the AutoFilter icon on the Standard
toolbar, or press Ctrl+Shift+L. It is possible to add AutoFilters to individual columns by
selecting those columns before choosing Data > AutoFilter, clicking the AutoFilter icon, or
pressing Ctrl+Shift+L, but this is not normally necessary for a database table. To access the
AutoFilter combo box for a column, click on the down-arrow button in the header cell of that
column.
To clear the AutoFilter and display all data in the range, position the cursor in the filtered column
and select Clear Autofilter in the context menu (Figure 522).
Figure 522: Clear filtered data
To remove AutoFilters from all columns of a database table, click on a cell anywhere within the
table area and select Data > AutoFilter on the Menu bar, select Data > More Filters > Hide
AutoFilter on the Menu bar, click the AutoFilter icon on the Standard toolbar, or press
Ctrl+Shift+L. The down-arrow buttons at the tops of columns will disappear.
Chapter 15 Calc as a Database | 497
Tip
Selecting Data > AutoFilter, clicking the AutoFilter icon, and pressing
Ctrl+Shift+L toggle AutoFilters on/off.
Each AutoFilter combo box (Figure 523) provides the following options:
Figure 523: Autofilter combo box
• A basic sort can be applied using the Sort Ascending and Sort Descending options.
• Use the Sort by Color menu to sort entries by background or font color, based on any
such color that appears in the column of interest.
• Use the Filter by Color menu to filter entries by background or font color for any such
color that appears in the column of interest.
• The Filter by Conditions menu provides Empty, Not Empty, Top 10, and Bottom 10
filter options. In addition, the menu contains a menu item to access the Standard Filter
dialog (Figure 524).
• Check the All box to display or hide all values in the current column.
• Show only the current item and Hide only the current item shortcut buttons are
provided, located adjacent to the All box. In the context of these buttons, the term
“current” refers to the item highlighted in the set of check boxes below the buttons (for
example the “1” in Figure 523).
• If any filter has been applied to a column, use the Clear Filter option to remove all
filters defined for that column.
• The AutoFilter combo box includes check boxes for each unique value in the current
column. If a checkbox is not ticked, rows of the database table that contain that value in
this column are not displayed. Change the filtering status of a particular value by
marking or removing the mark from the relevant checkbox.
For more information on how to use the AutoFilter combo box and its options, see Chapter 2,
Entering and Editing Data.
Standard filters
Standard filters are more complex than AutoFilters, and allow for up to eight filter conditions.
Powerful filters can be set up using regular expressions. Also, unlike AutoFilters, standard filters
498 | Calc Guide 26.2
use a dialog (Figure 524), which is accessed by selecting Data > More Filters > Standard Filter
on the Menu bar or the Standard Filter option on an AutoFilter combo box.
For more information on how to use this dialog and its options, see Chapter 2, Entering and
Editing Data.
Figure 524: Standard Filter dialog
Advanced filters
The criteria for an advanced filter are stored in a sheet rather than entered into a dialog. As a
result, you must first set up a cell range that contains the criteria before you use the Advanced
Filter dialog (Figure 525).
Figure 525: Advanced Filter dialog
To set up a criteria range:
1) Copy the column headings of the range to be filtered to an empty space in a sheet. It
does not need to be the same sheet as the one with the source range.
2) Enter filter criteria underneath the column headings in the criteria range. Each individual
criterion in the same row is connected with AND, while the criteria groups from each row
are connected with OR. Empty cells are ignored. Up to eight criteria rows may be
defined for a filter.
Chapter 15 Calc as a Database | 499
Tip
Although it is possible for the criteria area to contain only the headings for columns
with defined filter criteria, for simplicity you may choose to copy all of your database
table’s headings to the criteria area.
After creating a criteria range, set up an advanced filter as follows:
1) Select the cell range that you wish to filter. For a database table you can simply click a
cell within the table area and Calc will automatically select the whole table as it opens
the dialog at step 2).
2) Go to Data > More Filters > Advanced Filter on the Menu bar to open the Advanced
Filter dialog (Figure 525).
3) In the Read Filter Criteria From field, enter the address for the criteria range, either by
selecting a named range from the drop-down box, typing in a reference, or selecting
cells from a sheet. Remember to use the Shrink / Expand button if you need to
temporarily minimize the dialog while selecting cells.
4) Click OK to apply the filter and close the dialog.
Note
For an individual named range, it is possible to tick a Filter checkbox on the Define
Name and Manage Names dialogs (Figures 515 and 516 respectively). Only named
ranges marked for filtering in this way can be selected in the drop-down box in the
Read Filter Criteria From area of the Advanced Filter dialog. Database ranges cannot
be selected in the drop-down box.
Advanced filter options are the same as standard filter options, and are described in further
detail in Chapter 2, Entering and Editing Data.
Figure 526 demonstrates an example criteria range for the grading sheet example in Figure 514.
Figure 526: Advanced filter criteria range (in Sheet 2)
In this range, there are two criteria groups: the first displays the records of students who scored
above a 75% in every homework, and the second displays records of any student named
“Ferdinand”. Figure 527 displays the result of this filter operation using these criteria.
Figure 527: Grading sheet example filtered using an advanced filter
500 | Calc Guide 26.2
Useful database-like functions
Database category functions
The twelve functions in the Database category are intended to help you analyze a simple
database that occupies a rectangular spreadsheet area comprising columns and rows, with the
data organized as one row for each record. The header cell of each column displays the name of
the column and that name usually reflects the contents of each cell in that column.
The functions in the Database category take three arguments as follows:
1) Database. The cell range of the database.
2) DatabaseField. The column containing the data to be used in the function’s
calculations.
3) SearchCriteria. The cell range of a separate area of the spreadsheet containing search
criteria.
These arguments are described more fully below.
All functions have the same simple concept of operation. The first logical step is to use the
specified SearchCriteria to identify the subset of records in the Database that are to be used
during subsequent calculations. The second step is to extract the data values and perform the
calculations associated with the specific function (average, sum, product, and so on). The values
processed are those in the DatabaseField column of the selected records.
Database function arguments
The following argument definitions apply for all functions in the Database category:
Database argument
Database specifies the range of cells occupied by the database table. The first row of
the range contains the field names, and subsequent rows are records with
corresponding field values.
One way of defining the range of cells is to enter the cell reference for the upper left-
hand cell, followed by a colon (:), and then the lower right-hand cell reference. An
example might be A1:E10.
The Database argument may also be specified by passing the name of a named range
or database range. Using a meaningful name to define the cell range can enhance
formula readability and document maintenance. If the name does not match the name
of a defined range, Calc reports a #NAME? error.
Other errors that might be reported as a result of an invalid Database argument are
#VALUE! and Err:504 (error in parameter list).
DatabaseField argument
DatabaseField specifies the column which the function will use for its calculations after
the search criteria have been applied and the data rows have been selected. It is not
related to the search criteria.
Specify the DatabaseField argument in any of the following ways:
– By entering a reference to a header cell within the Database area. Alternatively, if
the cell has been given a meaningful name as a named range or database range,
enter that name. If the name does not match the name of a defined range, Calc
reports a #NAME? error. If the name is valid but does not correspond to one cell
only, Calc reports Err:504 (error in parameter list).
Chapter 15 Calc as a Database | 501
– By entering a number to specify the column within the Database area, starting with
1. For example, if a Database occupied the cell range D6:H123, then enter 3 to
indicate the header cell at F6. Calc expects an integer value that lies between 1 and
the number of columns defined within Database and ignores any digits after a
decimal point. If the value is less than 1, Calc reports Err:504 (error in parameter
list). If the value is greater than the number of columns in Database, Calc reports a
#VALUE! error.
– By entering the literal column header name from the first row of the Database
range, placing quotation marks around the header name; for example, “Distance to
School”. If the string does not match one of the Database area’s column headings,
Calc reports Err:504 (error in parameter list). You can also provide a reference to an
arbitrary cell (not within the Database and SearchCriteria areas) that contains the
required string.
The DatabaseField argument is optional for the DCOUNT and DCOUNTA functions but
it is required for the other ten Database functions.
SearchCriteria argument
SearchCriteria specifies the range of cells containing search criteria. Like Database,
its first row is also field names, and subsequent rows are conditions for related fields.
The Database and SearchCriteria areas need not be adjacent, or even on the same
sheet.
One way of defining the range of cells is to enter the cell reference for the upper left-
hand cell, followed by a colon (:), and then the lower right-hand cell reference; for
example, A13:B14. The cell range may also be specified by passing the name of a
defined named range or database range. If the name does not match the name of a
defined range, Calc reports a #NAME? error.
Err:504 (error in parameter list) may also be reported as a result of an invalid
SearchCriteria argument.
The contents of the SearchCriteria area are described in more detail in the next
section.
Defining search criteria
The number of columns occupied by the SearchCriteria area need not be the same as the width
of the Database area. All headings that appear in the first row of SearchCriteria must be
identical to headings in the first row of Database. However, not all headings in Database need
appear in the first row of SearchCriteria, while a heading in Database can appear multiple
times in the first row of SearchCriteria.
Search criteria are entered into the cells of the second and subsequent rows of the
SearchCriteria area, below the row containing headings. Blank cells within the SearchCriteria
area are ignored.
Create criteria in the cells of the SearchCriteria area using the comparison operators <, <=, =,
<>, >=, and >. = is assumed if a cell is not empty but does not start with a comparison operator.
If you write several criteria in one row, they are connected by AND. If you write several criteria in
different rows, they are connected by OR.
Criteria can be created using wildcards, providing that wildcards have been enabled via the
Enable wildcards in formulas option on the Tools > Options > LibreOffice Calc > Calculate
dialog. When interoperability with Microsoft Excel is important for your spreadsheet, this option
should be enabled.
502 | Calc Guide 26.2
Even more powerful criteria can be created using regular expressions, providing that regular
expressions have been enabled via the Enable regular expressions in formulas option on the
Tools > Options > LibreOffice Calc > Calculate dialog.
Tip
When using functions where a search criterion string can be a regular expression,
the first attempt is to convert the criterion string to numbers. For example, ".0" will
convert to 0.0 and so on. If successful, the match will not be a regular expression
match but a numeric match. However, switching to a locale where the decimal
separator is not the dot makes the regular expression conversion work. To force the
evaluation of the regular expression instead of a numeric expression, use some
expression that can not be misread as numeric, such as ".[0]" or ".\0" or "(?i).0".
Another setting that affects how the search criteria are handled is the Search criteria = and <>
must apply to whole cells option on the Tools > Options > LibreOffice Calc > Calculate
dialog. This option controls whether the search criteria you set for the Database functions must
match the whole cell exactly. When interoperability with Microsoft Excel is important for your
spreadsheet, this option should be enabled.
Example of Database function use
Figure 528 provides a simple example demonstrating how to use one of the functions in the
Database category. The formula in the selected cell E15 can be seen in the Formula bar and
comprises a call to the DCOUNT function. The arguments of this function call are as follows:
• Database argument. The database table used for this example extends over the cell
range A1:E10.
• DatabaseField argument. As the DCOUNT function counts the records that match the
criteria without further calculation, it is not necessary to provide a value for this
argument, although the relevant argument separators (commas in this case) must be
provided.
• SearchCriteria argument. The search criteria area used in this example extends over
the cell range A12:E13. The condition in cell D13 (“>600”) will cause DCOUNT to count
all records which have a value greater than 600 meters in the Distance (meters)
column. In many cases it may be convenient to replicate the column headings of the
database table within the search criteria area as shown in Figure 528. However, this is
not essential and the formula =DCOUNT(A1:E10,,D12:D13) would give exactly the
same value of 5.
Chapter 15 Calc as a Database | 503
Figure 528: Example usage of a Database function
Many more examples can be found by searching for “database functions” in the Help system, or
by visiting the relevant page for each function within the Calc Functions Wiki at
[Link]
List of Database functions
Note
Calc will treat dates and logical values (such as TRUE or FALSE) as numeric when
calculating with these functions.
DAVERAGE
For all rows (database records) that match the specified search criteria, DAVERAGE
calculates the average of the numeric values in the cells (fields) of the specified column.
Non-numeric values in those cells are ignored.
Returns a #DIV/0! error if no records match the specified search criteria, or if there are
no numeric values in the cells of the specified column for the matching records.
Syntax: DAVERAGE(Database; DatabaseField; SearchCriteria)
DCOUNT
For all rows (database records) that match the specified search criteria, DCOUNT
counts the number of cells (fields) of the specified column that contain numeric values.
However, if no column is specified, DCOUNT returns the count of all records that match
the specified search criteria irrespective of their contents.
Syntax: DCOUNT(Database; [DatabaseField]; SearchCriteria)
DCOUNTA
For all rows (database records) that match the specified search criteria, DCOUNTA
counts the number of cells (fields) of the specified column that are not blank. Blank cells
of the specified column are not counted. However, if no column is specified, DCOUNTA
returns the count of all records that match the specified search criteria irrespective of
their contents.
Syntax: DCOUNTA(Database; [DatabaseField]; SearchCriteria)
504 | Calc Guide 26.2
DGET
For the single row (database record) that matches the specified search criteria, DGET
returns the contents of the cell (field) of the specified column.
Calc reports Err:502 (invalid argument) if multiple matches are found, or a #VALUE!
error (wrong data type) if no matches are found. A #VALUE! error is also reported if a
single match is found but the relevant cell is empty.
Syntax: DGET(Database; DatabaseField; SearchCriteria)
DMAX
For all rows (database records) that match the specified search criteria, DMAX
calculates the maximum value across the cells (fields) of the specified column that
contain numeric values. Blank cells or cells containing non-numeric characters are not
included.
Returns 0 if no matches are found, or if there are no non-zero numeric values in the
cells of the specified column for the matching records.
Syntax: DMAX(Database; DatabaseField; SearchCriteria)
DMIN
For all rows (database records) that match the specified search criteria, DMIN
calculates the minimum value across the cells (fields) of the specified column that
contain numeric values. Blank cells or cells containing non-numeric characters are not
included.
Returns 0 if no matches are found, or if there are no non-zero numeric values in the
cells of the specified column for the matching records.
Syntax: DMIN(Database; DatabaseField; SearchCriteria)
DPRODUCT
For all rows (database records) that match the specified search criteria, DPRODUCT
calculates the product of all numeric values in the cells (fields) of the specified column.
Blank cells or cells containing non-numeric characters are not included.
Returns 0 if no matches are found, or if there are no numeric values in the cells of the
specified column for the matching records.
Syntax: DPRODUCT(Database; DatabaseField; SearchCriteria)
DSTDEV
For all rows (database records) that match the specified search criteria, DSTDEV
calculates the sample standard deviation based on the numeric values in the cells
(fields) of the specified column. Non-numeric values are ignored.
Returns a #NUM! error if exactly one record matches the specified search criteria, or if
there is only one numeric value in the cells of the specified column for the matching
records.
Returns 0 if no matches are found, or if there are no numeric values in the cells of the
specified column for the matching records.
Syntax: DSTDEV(Database; DatabaseField; SearchCriteria)
DSTDEVP
For all rows (database records) that match the specified search criteria, DSTDEVP
calculates the population standard deviation based on the numeric values in the cells
(fields) of the specified column. Non-numeric values are ignored.
Chapter 15 Calc as a Database | 505
Returns a #NUM! error if no records match the specified search criteria, or if there are
no numeric values in the cells of the specified column for the matching records.
Syntax: DSTDEVP(Database; DatabaseField; SearchCriteria)
DSUM
For all rows (database records) that match the specified search criteria, DSUM
calculates the sum of all numeric values in the cells (fields) of the specified column.
Blank cells or cells containing non-numeric characters are not included.
Returns 0 if no matches are found, or if there are no numeric values in the cells of the
specified column for the matching records.
Syntax: DSUM(Database; DatabaseField; SearchCriteria)
DVAR
For all rows (database records) that match the specified search criteria, DVAR
calculates the sample variance based on the numeric values in the cells (fields) of the
specified column. Non-numeric values are ignored.
Returns a #NUM! error if exactly one record matches the specified search criteria, or if
there is only one numeric value in the cells of the specified column for the matching
records.
Returns 0 if no matches are found, or if there are no numeric values in the cells of the
specified column for the matching records.
Syntax: DVAR(Database; DatabaseField; SearchCriteria)
DVARP
For all rows (database records) that match the specified search criteria, DVARP
calculates the population variation based on the numeric values in the cells (fields) of
the specified column. Non-numeric values are ignored.
Returns a #NUM! error if no records match the specified search criteria, or if there are
no numeric values in the cells of the specified column for the matching records.
Syntax: DVARP(Database; DatabaseField; SearchCriteria)
Other database-like functions
Calc includes over 500 functions to help you analyze and reference data. Some of these
functions are intended for use with tabular data (such as HLOOKUP and VLOOKUP), while
others can be used in any context. This section provides a list of some of the functions that may
be useful if you intend to utilize tables in Calc for your database. Many will be familiar as typical
spreadsheet functions used in other contexts, while some may be less frequently used but are
particularly helpful with database tables.
Further reference material for all Calc’s functions can be found in the Help system and in the
Calc Functions area of the The Document Foundation’s wiki, at
[Link]
Table 24: Some useful database-like functions
Function Category Description
Returns an overall result calculated by applying a selected
aggregation function to the specified data. Nineteen
selectable aggregation functions are available, including
AGGREGATE Mathematical
average, count, large, maximum, median, minimum,
mode, percentile, product, quartile, small, standard
deviation, sum, and variance.
506 | Calc Guide 26.2
Function Category Description
Returns the arithmetic mean of the specified data, ignoring
AVERAGE Statistical
empty cells and cells that contain text.
Returns the arithmetic mean of the specified data, ignoring
AVERAGEA Statistical empty cells but assigning the value 0 to any cell that
contains text.
Returns the arithmetic mean of all cells in a range that
AVERAGEIF Statistical
satisfy a given criterion.
Returns the arithmetic mean of all cells in a range that
AVERAGEIFS Statistical
satisfy multiple criteria in multiple ranges.
Returns one value from the specified data, selected
CHOOSE Spreadsheet
according to the index passed as an argument.
Returns a count of the numeric values in the specified
COUNT Statistical
data, ignoring empty cells and cells that contain text.
Returns a count of the numeric and text values in the
COUNTA Statistical
specified data, ignoring empty cells.
COUNTBLANK Statistical Returns the number of empty cells in the specified data.
Returns the number of cells in a range that satisfy a given
COUNTIF Statistical
criterion.
Returns the number of cells that satisfy multiple criteria in
COUNTIFS Statistical
multiple ranges.
Filters a data range or array based on specified
FILTER Spreadsheet
conditions.
Searches for a specified value in the first row of a table
(often a column heading) and returns a value retrieved
HLOOKUP Spreadsheet
from the same column but a different row. HLOOKUP
stands for horizontal lookup.
Returns the contents of one cell in a table. The position of
that cell is specified by row and column offsets. Can also
INDEX Spreadsheet
be used in an array formula context to retrieve data from
multiple cells.
Returns a valid reference constructed from a supplied
string representation of the reference. This function is
INDIRECT Spreadsheet
powerful because it enables a user to create dynamic
references.
Searches for a specified value in a single row or column
and returns a value from the same position in a second
LOOKUP Spreadsheet
row or column. It is not necessary for the search and result
areas to be adjacent.
Returns the relative position of a search item in a single
MATCH Spreadsheet
row or column range.
Returns the maximum value in the specified data, ignoring
MAX Statistical
empty cells and cells that contain text.
Returns the maximum value in the specified data, ignoring
MAXA Statistical empty cells but assigning the value 0 to any cell that
contains text.
Returns the maximum value of all cells in a range that
MAXIFS Statistical
satisfy multiple criteria in multiple ranges.
Chapter 15 Calc as a Database | 507
Function Category Description
Returns the median value of the specified data. The
median of a finite list of numbers is the "middle" number,
MEDIAN Statistical
when those numbers are listed in order from smallest to
greatest.
Returns the minimum value in the specified data, ignoring
MIN Statistical
empty cells and cells that contain text.
Returns the minimum value in the specified data, ignoring
MINA Statistical empty cells but assigning the value 0 to any cell that
contains text.
Returns the minimum value of all cells in a range that
MINIFS Statistical
satisfy multiple criteria in multiple ranges.
Returns the mode value of the specified data. The mode is
MODE the most common value in a list of values. If there are
Statistical
[Link] several values with the same frequency, the smallest value
is returned.
Returns a vertical array of the mode values of the
specified data. The mode is the most common value in a
[Link] Statistical list of values. The function returns more than one value
when there are multiple modes sharing the same
frequency of occurrence.
Returns a modified reference to a single cell or a range of
OFFSET Spreadsheet cells, offset by a certain number of rows and columns from
a given reference point.
Returns the product of the numeric values in the specified
PRODUCT Mathematical
data, ignoring empty cells and cells that contain text.
SORT Spreadsheet Sorts the contents of a range or array.
Sorts the contents of a range or array based on the values
SORTBY Spreadsheet
in a corresponding range or array.
STDEV Returns the sample standard deviation of the specified
Statistical
STDEV.S data, ignoring empty cells and cells that contain text.
Returns the sample standard deviation of the specified
STDEVA Statistical data, ignoring empty cells but assigning the value 0 to any
cell that contains text.
STDEVP Returns the population standard deviation of the specified
Statistical
STDEV.P data, ignoring empty cells and cells that contain text.
Returns the population standard deviation of the specified
STDEVPA Statistical data, ignoring empty cells but assigning the value 0 to any
cell that contains text.
Returns an overall result calculated by applying a selected
total function to the specified data. Eleven selectable total
functions are available, including average, count,
SUBTOTAL Mathematical
maximum, minimum, product, standard deviation, sum,
and variance. Use this function with AutoFilter to take only
the filtered records into account.
Returns the sum of the specified data, ignoring empty cells
SUM Mathematical
and cells that contain text.
Returns the sum of all cells in a range that satisfy a given
SUMIF Mathematical
criterion.
Returns the sum of all cells in a range that satisfy multiple
SUMIFS Mathematical
criteria in multiple ranges.
508 | Calc Guide 26.2
Function Category Description
VAR Returns the sample variation of the specified data,
Statistical
VAR.S ignoring empty cells and cells that contain text.
Returns the sample variation of the specified data,
VARA Statistical ignoring empty cells but assigning the value 0 to any cell
that contains text.
VARP Returns the population variation of the specified data,
Statistical
VAR.P ignoring empty cells and cells that contain text.
Returns the population variation of the specified data,
VARPA Statistical ignoring empty cells but assigning the value 0 to any cell
that contains text.
Searches for a specified value in the first column of a table
(often a row heading) and returns a value retrieved from
VLOOKUP Spreadsheet
the same row but a different column. VLOOKUP stands for
vertical lookup.
Searches for a value in an array and returns a reference to
XLOOKUP Spreadsheet
a cell or range of cells.
Searches for a value in a one-dimensional array and
XMATCH Spreadsheet
returns the relative position of the item.
Chapter 15 Calc as a Database | 509
Calc Guide 26.2
Chapter 16
Setting up and
Customizing
Introduction
This chapter presents some, but not all, of the setup options found under Tools > Options on
the Menu bar (LibreOffice > Preferences on macOS). Information about options not covered in
this chapter are covered in the Help and in the Getting Started Guide.
This chapter does explain how to customize menus, toolbars, and keyboard shortcuts.
Application extensions available from the LibreOffice website and other providers can simplify
the customization process.
Utilizing the Type to search function under Tools > Options on the Menu bar is useful for finding
a particular option to customize. When typing in this field, Calc automatically hides the options in
the tree that do not match the entered keywords.
LibreOffice options
The settings described in this section apply to all components of LibreOffice and are of particular
interest to users of Calc. To access the options:
1) Choose Tools > Options to open the Options dialog. The dynamic list on the left-hand
side only displays options applicable to open applications. The illustrations in this
chapter show the list as it appears when Calc is open.
2) Click the expansion symbol (+ or triangle) next to LibreOffice to reveal the list of
subsections.
Figure 529: LibreOffice options
Note
The Reset button, located in the lower right of the full Options dialog, has the same
effect on all pages of the dialog. It resets the options to the values that were in place
when you opened the dialog.
512 | Calc Guide 26.2
User data
User data entries are used by templates and wizards in LibreOffice. For example, Calc uses the
first and last name entries to populate the Created and Modified fields in the document
properties, in the footer of a printed spreadsheet, or as the username associated with
comments.
ODF Cryptography
Set the preferred public key for OpenPGP encryption and digital signature. These
preferred keys will be pre-selected in key selection dialog every time you sign or encrypt
a document, so you don't have to select it yourself when signing with one specific key
frequently.
Signing key
Select your OpenPGP key from the drop‑down list for signing ODF documents.
OpenPGP encryption key
Select your OpenPGP key from the drop-down list for encrypting ODF documents.
When encrypting documents, always encrypt to self
Mark this checkbox to also encrypt the file with your public key, so you can open the
document with your private key.
Warning
Keep this option selected!
Otherwise, you will not be able to decrypt documents you've encrypted for other
people.
General
Set preferences for Help, Open/Save, File Associations, and more. You can also disable the tip
of the day popups here.
View
View settings affect how the document window looks and behaves. Users can change the size
and style of toolbar and sidebar icons, among other settings.
Print
The print options may be set 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 using the Print dialog. Calc‑specific print options are described in Print options, below.
See Chapter 8, Printing, Exporting, Emailing, and Signing, for more about these options.
Paths
The path options can be used to change the location of files associated with, or used by,
LibreOffice. Some items have two or more paths listed: one to a shared folder (which might be
on a network) and one to a user-specific folder (normally on the user’s personal computer).
You could, for example, change the default path to a shared server instead of your PC.
Chapter 16 Setting up and Customizing | 513
Security
The security options can be adjusted to change the behavior of the application when a potential
security issue is present, such as hidden information or macros. The controls for the security
options shown in Figure 530 are described in detail below.
Figure 530: 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
LibreOffice remove some information automatically. Note that, unless removed, much of
this information is retained in a file, whether the file is in LibreOffice’s default
OpenDocument Format (ODF), or has been saved to other formats, including PDF.
Click the Options button to open a separate dialog with specific choices (see
Figure 531).
Passwords for Web Connections
You can enter a master password to enable easy access to websites that require a user
name and password. If you select the Persistently save passwords for web connections
option, the Set Master Password dialog opens. LibreOffice will securely store all
passwords that you use to access files from web servers. You can retrieve the
passwords from the list after you enter the master password.
Macro Security
Click the Macro Security button to open the Macro Security dialog, where you can
adjust the security level for executing macros and specify trusted sources.
Certificate Path
Users can digitally sign documents using LibreOffice. A digital signature requires a
personal signing certificate. Most operating systems can generate a self-signed
certificate. However, a personal certificate issued by an outside agency (after verifying
an individual’s identity) has a higher degree of trust associated with it than a self-signed
certificate. LibreOffice does not provide a secure method of storing these certificates,
514 | Calc Guide 26.2
but it can access certificates that have been saved using other programs. Click the
Certificate button, and select the preferred certificate store to use.
Note
The Certificate Path option appears only on Linux and macOS systems.
On Windows, LibreOffice uses the default Windows location for storing and retrieving
certificates.
TSAs –Time Stamping Authorities
Allows you to select a Time Stamping Authority (TSA) URL for PDF documents created
by LibreOffice. Adding a trusted timestamp to an electronic signature on a PDF provides
a digital seal of data integrity and a trusted date and time of when the file was signed.
Recipients of PDF documents with a trusted timestamp can verify when the document
was digitally or electronically signed, as well as verify that the document was not altered
after the date the timestamp vouches for.
GPG Certificate Manager
Select your preferred GPG certificate manager. LibreOffice tries to locate installed
certificate managers automatically. Press the Browse button to locate the certificate
manager executable in your system.
Security Options and Warnings
While most of the options available on the Security Options and Warnings dialog (Figure 531)
are straightforward, those listed below benefit from additional explanation.
Figure 531: Security Options and Warnings dialog
Security warnings
Warnings take the form of a suitable icon and text displayed in an infobar located above
the grid of cells.
Remove personal information on saving
Select this option to always remove user data from the file properties when saving the
file. Control the granularity of the user data removed using the four check boxes located
below this option. To manually remove personal information from specific documents,
Chapter 16 Setting up and Customizing | 515
deselect this option and then use the Reset Properties button under File > Properties
> General on the Menu bar.
Ctrl-click required to open hyperlinks
The default behavior in most components of LibreOffice is to Ctrl+click on a hyperlink
to open the linked document, but you can choose to open hyperlinks using a single
click.
Appearance
On the LibreOffice – Appearance page (Figure 532), you can specify colors independent of the
desktop environment theme. This setting applies to all LibreOffice modules.
Figure 532: Application appearance page
LibreOffice Themes
Select the theme scheme you want from the dropdown list. More themes are available
as extensions when you press the Add more themes button. The Automatic scheme
refers to the default colors of the operating system.
– Enable application theming: mark this checkbox to enable an extension theme.
– Use white document background: overrides the theme document background
color and set it to white for better readability.
– Use bitmap for application background: select a bitmap from the dropdown list to
set as application background.
Customization
You can define colors to all the user interface elements listed in the Items drop-down
list. The Application background element can also display one of the images available in
the Images drop-down list, either Stretched or Tiled.
Note
When removing a theme from the list, LibreOffice resets to the Automatic scheme.
516 | Calc Guide 26.2
Icons
Select an icon set from the available list. Add more icon sets using the Extensions
button. Adjust the icon size for the various user interface elements listed.
Dialogs
Choose the position of the dialog tabs.
Advanced options
Three items of interest on this page, besides the Java Options, are found under Optional
Features:
Enable experimental features (may be unstable)
Selecting this option enables features that are not yet complete or contain known bugs.
The list of these features varies from version to version.
Enable macro recording (may be limited)
This option enables macro recording, with some limitations. For more about macro
recording, see the Getting Started Guide, and Chapter 14, Macros, in this book.
Open Expert Configuration
The expert configuration dialog contains advanced settings for LibreOffice. Avoid
changing any of these configurations without good knowledge fo the consequences,
which may not be visible immediately and can turn the user profile unusable and subject
to a factory reset or to a call to the Help desk.
Options for loading and saving documents
You can set the Load/Save options to suit the way you work. This chapter describes only a few
of the options, those most relevant to working with Calc. See the Getting Started Guide for a
description of the other options.
If the Options dialog is not already open, click Tools > Options on the Menu bar. Click the
expansion symbol (+ or triangle) to the left of Load/Save on to display the list of load/save
options pages.
General
Many of the choices on the Load/Save – General page (Figure 533) are familiar to users of other
office suites. Those of most interest to Calc users are in the Default File Format and ODF
Settings section.
Default File Format and ODF Settings
ODF format version: LibreOffice by default saves documents in OpenDocument
Format (ODF) version 1.4 Extended. You will rarely need to change this for compatibility
when exchanging files with other people.
Document type: If you routinely share documents with users of Microsoft Excel, you
might want to change the Always save as option to one of the Excel formats, including
XLSX. However, you can choose an Excel format when you save any individual file.
We recommend that you always save a working copy in ODS format and only create an
Excel version if necessary for sharing. Also, note that recent versions of Microsoft Excel
can open ODS files, so this may no longer be needed.
Chapter 16 Setting up and Customizing | 517
Note
The Save AutoRecovery information every and Always create backup copy options
are enabled by default. Optionally you can save the document instead. By default,
backup copies accumulate in the folder specified in Tools > Options > LibreOffice >
Paths. This can be changed by selecting the Place backup in same folder as
document option.
Figure 533: Choosing Load and Save general options
VBA Properties
On the Load/Save – VBA Properties page (Figure 534), you can choose whether to keep any
VBA (Visual Basic for Applications) macros in Microsoft Office documents that are opened in
LibreOffice.
Figure 534: Choosing Load/Save VBA Properties
If you choose Load Basic code, you can edit the macros in LibreOffice. The changed code is
saved in an ODF document but is not retained if you save into a Microsoft Office format.
518 | Calc Guide 26.2
If you choose Save original Basic code, the macros will not work in LibreOffice but are retained
unchanged if you save the file into Microsoft Office format.
If you are importing a Microsoft Word or Excel file containing VBA code, you can select the
option Executable code. Code is preserved but rendered inactive by default (if you inspect it with
the LibreOffice Basic IDE you will see that it is all commented), but when Executable code is
selected, the code is ready to be executed.
Save original Basic code takes precedence over Load Basic code. If both options are selected,
and you edit the disabled code in LibreOffice, the original Microsoft Basic code will be saved
when saving in a Microsoft Office format.
To remove any possible macro viruses from the Microsoft Office document, deselect
Save original Basic code. The document will be saved without the Microsoft Basic code.
Microsoft Office
On the Load/Save – Microsoft Office page (Figure 535), you can choose what to do when
importing or exporting Microsoft Office OLE objects (linked or embedded objects or documents
such as spreadsheets or equations): convert them into or from the corresponding LibreOffice
OLE object or load and save them in their original format.
Select the [L] options to convert Microsoft OLE objects into the corresponding LibreOffice OLE
objects when a Microsoft document is loaded into LibreOffice.
Select the [S] options to convert LibreOffice OLE objects into the corresponding Microsoft OLE
objects when a document is saved in a Microsoft format.
Figure 535: Choosing Load/Save Microsoft Office options
The Character Highlighting options enable you to select between the two text highlighting
(character background) attributes that Microsoft Office provides, Highlighting or Shading.
Shading is the initial default.
The Create MSO lock file option improves interoperability with Microsoft Office for shared
spreadsheets. When enabled, Calc writes two lock files when opening a Microsoft Office format
file, one LibreOffice lock file and one Microsoft Office lock file. This enables users of both suites
to be made aware that the file is in use. The option is initially disabled by default.
HTML Compatibility
Choices made on the Load/Save – HTML Compatibility page (Figure 536) affect how LibreOffice
imports or exports HTML pages. See the Getting Started Guide, and the HTML documents
importing/exporting Help page, for more information.
Chapter 16 Setting up and Customizing | 519
The main items of interest for Calc users are in the Export section.
LibreOffice Basic
Select this option to include LibreOffice Basic macros (scripts) when exporting to HTML
format. If you do not activate this option before you create the LibreOffice Basic macro;
the script will not be inserted. LibreOffice Basic macros must be located in the header of
the HTML document. Once you have created the macro in the LibreOffice Basic IDE, it
appears in the source text of the HTML document in the header.
If you want the macro to run automatically when the HTML document is opened, choose
Tools > Customize > Events. See Chapter 14, Macros, for more information.
Display warning
When the LibreOffice 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 LibreOffice Basic macros will be lost.
Print layout
Select this option to export the print layout of the current document as well. The HTML
filter supports CSS2 (Cascading Style Sheets Level 2) for printing documents. These
capabilities are only effective if print layout export is activated.
Copy local images to Internet
Select this option to automatically upload the embedded pictures to an Internet server
when uploading using FTP.
Figure 536: Choosing HTML compatibility options
Calc specific options
Calc must be open in order for the LibreOffice Calc options to be displayed in the Options dialog.
Click the expansion symbol (+ or triangle) by LibreOffice Calc. A list of subsections drops down
(Figure 537).
520 | Calc Guide 26.2
General
The choices on the LibreOffice Calc – General page (Figure 538) affect the units used for rulers
and other measurements, the default tab stop positions, the updating of links and fields, and
various input settings.
Metrics section
Choose the unit of measurement used in spreadsheets and the default tab stops
distance.
Figure 537: Calc options
Update links when opening section
Choose whether to update links when opening a document: Always, On request, or
Never. Spreadsheets that include many or large charts or graphics may load slowly if
this option is set to Always.
Figure 538: Selecting general options for Calc
Chapter 16 Setting up and Customizing | 521
Input Settings section
Press Enter to move selection
Specifies that pressing Enter moves the cursor to another cell. You can also choose
the direction the cursor moves: Up, Down, Left, or Right. If this option is not selected,
pressing Enter places the data into the cell but does not move the cursor.
Press Enter to switch to edit mode
Specifies that pressing Enter puts the selected cell into edit mode. To end edit mode
and move the cursor in the desired direction, press Enter again.
Press Enter to paste and clear clipboard
When the content of a cell is copied to the clipboard, you can paste the information in
another cell by pressing the Enter key. After pasting occurs, the clipboard is cleared.
Here you can enable/disable this feature.
Expand formatting
Specifies whether to automatically apply the formatting attributes of the selected cell to
empty adjacent cells. If, for example, a selected cell has the bold attribute, this attribute
also applies to empty adjacent cells. However, cells that already have a special format
are not modified by this function. To see the affected range, press Ctrl+*
(multiplication sign on the number pad). The format will also apply to all new values
inserted within this range. This feature works only while you are inserting data in
adjacent cells with the previous formatting style; if you insert some data in a non-
adjacent cell, Expand formatting will no longer work. In order to get it to work again, you
will need to format a cell again (it could be the same one if you like) and insert data into
its adjacent cells.
Expand references when new columns/rows are inserted
Specifies whether to expand references when inserting columns or rows adjacent to the
reference range. This is only possible if the reference range, where the column or row is
inserted, originally spanned at least two cells in the desired direction.
Example: If the range A1:B1 is referenced in a formula and you insert a new column
after column B, the reference is expanded to A1:C1. If the range A1:B1 is referenced
and a new row is inserted under row 1, the reference is not expanded, since there is
only a single cell in the vertical direction.
If you insert rows or columns in the middle of a reference area, the reference is always
expanded.
Update references when sorting range of cells
When selected, references to cells are updated when a range of cells is sorted. If not
selected, the references are unchanged.
Highlight selection in column/row headers
Specifies whether to highlight column and row headers in the selected columns or rows.
Show overwrite warning when pasting data
Pasting contents of the clipboard into a cell will replace the contents of that cell with
what is in the clipboard. Select this option to be alerted to a possible loss of data when
pasting.
Position cell reference with selection
With this option set, expanding a selection (with Ctrl+Shift+Down/Up) jumps to the
end of the range in the column that was added as last to the initial selection. When the
option is not set, expanding a selection (with Ctrl+Shift+Down/Up) jumps to the end
522 | Calc Guide 26.2
of the range in the column where selecting the cell range was started. The same applies
when extending a selection on rows, with Ctrl+Shift+Left/Right.
Warn when saving only the active sheet
When saving a spreadsheet in CSV file format, only the active sheet will be saved.
To prevent any loss of content from other sheets, Calc displays a warning (Figure 539).
Figure 539: Saving active sheet warning
Defaults
On the LibreOffice Calc – Defaults page you can enter the number of sheets to be opened by
default when you start a new spreadsheet, and either accept the default sheet prefix or type a
new one. After a spreadsheet is created, you can add new sheets and change the label of any
tab; see Chapter 1, Introduction, for more information.
Calc default sizes of spreadsheet are up to 10,000 sheets and each sheet can have a maximum
of 1,048,576 rows and 16,384 columns. To allow Calc to read files with up to 16 million rows and
16,384 columns, check the Enable very large spreadsheets box.
Note
As expected, handling very large spreadsheets can slow down your system.
View
The options on the LibreOffice Calc – View page (Figure 541) affect the way the document
window looks and behaves when viewed onscreen.
Display section
Select various options for the display.
Formulas
Display the content of a cell either as a formula or as the result of that formula.
Zero values
Display a zero in a cell when the cell has a value of zero, or display as a blank cell.
Note
A blank cell is not the same as an empty cell. In the case of zero display value
setting, a cell can display as blank when its value is zero but is not empty.
Comment indicator
Select this option to show a small symbol in the top right corner of a cell that contains a
comment.
Chapter 16 Setting up and Customizing | 523
Figure 540: Comment indicator
To always display a comment, right-click on the cell and select Show comment in the
context menu.
Comment authorship
If this box is checked, the author of the comment and the date and time at which the
comment was made will appear in the comment window, when you mouse over a
comment.
The comment author name appears as it appears in the First Name and Last Name
fields in the User Data dialog. If those fields are blank, the author name appears as
"Unknown Author". Updating the user data only affects comments made after the
update.
Figure 541: Selecting view options for Calc
Formula indicator and hint
Select this option to place a blue triangle in the bottom-left corner of each cell that
contains a formula. When hovering the pointer over the blue triangle, the formula is
shown in a tool tip.
524 | Calc Guide 26.2
Figure 542: Formula indicator
Value highlighting
Select this option to highlight all values, or results of formulas, in the sheet. Text is
highlighted in black; numbers, dates and logical values in blue, since they are all
handled as numbers by Calc; formulas are displayed in green. When this option is
active, any colors assigned in the document are not displayed.
Column/Row highlighting
Select this option to highlight the entire row and column of the active cell using a
transparent color.
Figure 543: Columns and row
highlighting
Highlight cell in edit mode
Highlight the background of the cell in its edit mode.
Figure 544: Highlight cell
in edit mode
Anchor
If an inserted object, such as a picture, is anchored to a cell, an image of an anchor will
appear in the cell to which the object is anchored.
Show references in color
Select this option to provide a visual aid to assist the editing of a formula. Each
reference is highlighted in color in the formula. The referenced cell range is enclosed by
a colored border as soon as the cell containing the reference is selected for editing.
Figure 545: Formula references – visual aids
Chapter 16 Setting up and Customizing | 525
Window section
The following elements of the spreadsheet window can be made visible or invisible:
column and row headers, horizontal and vertical scroll bars, sheet tabs, and, if an
outline has been defined, outline symbols.
If the Sheet tabs option is not selected, you can only switch between the sheets by
using the Navigator.
The Summary on search option controls the display of the Search Results dialog,
which is described in detail in Chapter 2, Entering and Editing Data.
Visual Aids section
Grid lines
Grid lines are the borders around the cells of a spreadsheet when viewed onscreen.
The options are: Show, Show on colored cells, or Hide. If grid lines are hidden, tables
will be displayed on a solid background with no grid around cells. The color choice
overrides the selection made in Tools > Options > LibreOffice > Appearance >
Customization > Spreadsheets > Grid lines.
Note
To print grid lines, choose Format > Page Style > Sheet > Print > Grid.
Pointer
When the mouse pointer hovers over the grid of cells on a Calc spreadsheet, the default
pointer (“System”) is normally shown, typically as an arrow pointer. However, an
alternative pointer (“Themed”) is available to allow you to switch to using the pointer
shape defined in the icon theme (typically a “fat” cross, Figure 546).
Figure 546: Typical System (left) and Themed (right) cursors
Page breaks
Specifies whether to display the page breaks within a defined print area.
Helplines while moving
Specifies whether to view helplines when moving drawings, frames, graphics, and other
objects. These lines help you align objects.
In Figure 547, the graph with the dark background represents the image in its original
location. The lighter area represents the position of the image as it is being moved.
Helplines are the horizontal and vertical dotted lines at the corners of the lighter object.
526 | Calc Guide 26.2
Figure 547: Helplines visible when moving a graphic
Objects section
Choose whether to show or hide graphics, charts, and drawing objects.
Zoom section
Select the Synchronize sheets option to apply any selected zoom (magnification) factor
to all sheets in the spreadsheet. If this option is not selected, separate zoom factors can
be applied to individual sheets.
Calculate
Use the LibreOffice Calc – Calculate page (Figure 548) to define the calculation settings for
spreadsheets.
Formulas Wildcards section
Enable wildcards in formulas
Specifies that wildcards are enabled when searching and also for character string
comparisons. Select this option for spreadsheets that need to be interoperable with
Microsoft Excel.
Enable regular expressions in formulas
Specifies that regular expressions instead of simple wildcards are enabled when
searching and also for character string comparisons. Do not enable regular expressions
in formulas for spreadsheets that need to be interoperable with Microsoft Excel.
Chapter 16 Setting up and Customizing | 527
Figure 548: Calc calculation options
No wildcards or regular expressions in formulas
Specifies that only literal strings are used when searching and also for character string
comparisons. Do not disable wildcards in formulas for spreadsheets that need to be
interoperable with Microsoft Excel.
The options listed above are mutually exclusive. For more information about them, see
Chapter 9, Using Formulas and Functions.
Date section
Select the start date for the internal conversion from days to numbers.
1899-12-30 (default) – Sets December 30, 1899 as day zero.
1900-01-01 (StarCalc 1.0) – Sets January 1, 1900 as day zero. Use this setting for
StarCalc 1.0 spreadsheets containing date entries.
1904-01-01 – Sets January 1, 1904 as day zero. Use this setting for spreadsheets that
are imported from foreign formats.
General Calculations section
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. For example: type Test in cell A1; and test in B1. Then type
the formula =A1=B1 in cell C1. If the Case sensitive option is checked, FALSE will
appear in the cell; if the analysis was case-insensitive, TRUE will appear in the cell. This
option is not applied to the EXACT text function, which is always case-sensitive.
Precision as shown
Specifies whether to make calculations using the rounded values displayed in the sheet.
Charts are shown with the displayed values. If the Precision as shown option is not
marked, the displayed numbers are rounded, but they are calculated internally using the
non‑rounded number.
Search criteria = and <> must apply to whole cells
The default search method in Calc is to search for any instance of the target regardless
of the position of the target within a word. For example, when searching for day, Calc
will match Friday, Sunday, and days. Select this option to search an exact occurrence of
528 | Calc Guide 26.2
the target. Wildcard symbols can be used to expand the search to match the default
condition.
Automatically find column and row labels
Calc will name the range of data, under a column heading or to the right of a row
heading, using the text in those headings.
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).
Limit decimals for general number format
Limits the number of decimals to be displayed for numbers with the general number
format. This overrides the setting applied in the General option of the Format section
inside the Number Category in Format > Cells > Numbers. This setting refers to how
numbers are displayed. When decimal places are limited, calculations are not affected
because of rounding.
Iterative References section
Iterative references are formulas that are continuously repeated until the problem is
solved. In this section you can choose the number of approximation steps carried out
during iterative calculations and the degree of precision of the answer.
Iterations
Select this option to enable iterations. If this option is not selected, an iterative reference
causes an error message.
Steps
Sets the maximum number of iteration steps.
Minimum change
Specifies the difference between two consecutive iteration step results. If the result of
the iteration is lower than the minimum change value, then the iteration will stop.
CPU Threading Settings section
Enable multithreaded calculation
Controls the use of multi-threading / parallelism, which can be used to speed up
LibreOffice Calc calculations on computers with multiple processing cores.
See Chapter 9, Using Formulas and Functions for more information.
Caution
When calculations involve a range that includes an empty cell, take note of the
setting for Zero values in the LibreOffice Calc > View options. If this option is not
selected, a value of zero will display as an empty cell. Empty cells and the value zero
are treated differently by many functions. For example, COUNT will not include an
empty cell as an item to be counted. The average of eight cells, one of which
contains the value zero, is not the same as the average of eight cells, one of which is
empty (an empty cell is not included in determining the average).
Formula
Use the LibreOffice Calc – Formula page (Figure 549) to specify the following formula options.
Chapter 16 Setting up and Customizing | 529
Formula Options
Formula syntax
Syntax is the format in which formulas are written. Choose the syntax most appropriate
for your work. If you regularly open or save to Microsoft Excel formats, you may wish to
use one of the Excel syntaxes.
To illustrate the differences between syntaxes, assume a spreadsheet contains two
sheets.
The cell C4 can be referenced in three ways:
Calc A1 =$Sheet2.C4 – the default syntax for Calc.
Excel A1 =Sheet2!C4 – the default of Microsoft Excel.
Excel R1C1 =Sheet2!R[3]C[2] – the relative row and column addressing used
in Excel.
Figure 549: Formula options
Use English function names
The default names for functions in Calc are those for the user's locale. For English
users, the localized names are the same as the English names. When the language set
by locale is not English, you may wish to express functions in English; if so, select this
option to change formula input and display, Function Wizard, and formula tips.
Separators
Separators are used in functions to distinguish points in the range used in the function:
the symbols used between elements. Enter the separator character to be used for
functions, row arrays, and column arrays. For example, a comma can be used as a
separator in functions and instead of writing =SUM(A1;B1;C1) the function would be
expressed as =SUM(A1,B1,C1).
530 | Calc Guide 26.2
Detailed Calculation Settings
Most users will not need to change the default setting. For custom settings, select
Custom and click Details to choose reference syntax and whether to treat empty strings
as zero.
Recalculation on File Load
Recalculating formulas can take significant time while loading very large files.
Excel 2007 and newer.
Loading a large spreadsheet file can take a long time. If you do not need to update your
large spreadsheet data immediately, you can postpone the recalculation to a better
time. Calc allows you to defer recalculation of Excel 2007 (and more recent)
spreadsheets to speed up loading time.
ODF spreadsheet (not saved by LibreOffice)
Recent versions of Calc cache spreadsheet formula results in its ODF file. This feature
helps Calc to recalculate a large ODF spreadsheet saved by Calc faster. For ODF
spreadsheets saved by other programs, where such cached formula results may not
exist, recalculation can be deferred to speed up file loading as with Excel 2007 files.
For each of these two options, the following choices are possible: Never recalculate (no
formulas will be recalculated on loading the file), Always recalculate (all formulas will be
recalculated on file load), and Prompt user (prompt user for action).
ODF spreadsheets saved in Calc will honor Never recalculate and Always recalculate
options.
Optional Row height
For large spreadsheets documents, optimal row height calculation depends on the cell
contents formatting and also on the result of the conditional formatted formulas. This
setting helps to shorten load times by controlling the optimal row height calculation.
Sort lists
View, define, delete, and edit sort lists on the LibreOffice Calc – Sort Lists page. Sort lists are
utilized for various purposes beyond just sorting, such as populating a series of cells during data
entry. These lists are organized in a specific sequence, but not necessarily in alphabetical or
numerical order; for instance, the days of the week. Besides the provided lists, you have the
option to create and modify your own lists, as detailed in Chapter 2, Entering and Editing Data.
Figure 550: Defining sort lists in Calc
Chapter 16 Setting up and Customizing | 531
Changes
On the LibreOffice Calc – Changes page, you can assign specific colors for insertions, deletions,
and other changes, or you can let Calc assign colors based on the author of the change. In the
latter case, one color will apply to all changes made by that author. The selections made here
are applied when change recording is enabled by Edit > Track Changes > Record on the
Menu bar.
Figure 551: Calc options for highlighting changes
Compatibility
Key Bindings
The LibreOffice Calc – Compatibility page provides a quick way to switch between
LibreOffice’s default key bindings and [Link]’s legacy default key bindings
for Calc. Most of the defaults are identical, but there are some differences.
The actions associated with the two key binding choices are shown in the table below.
Key Binding Default [Link] legacy
Backspace Opens Delete Contents dialog Immediately deletes contents
Delete Immediately deletes contents Opens Delete Contents dialog
Control+D Fills cell content down within Opens the Selection List
(Command+D on macOS) selection dialog
Alt+DownArrow
Select header of range;
(Option+DownArrow on Increases row height
no action in empty cell
macOS)
Hyperlinks
Calc can insert multiple hyperlinks in a cell as text fields, but multiple hyperlinks in a cell
cannot be saved to Excel file formats. This option prevents inserting multiple hyperlinks
in a cell when Excel files are edited, in order to be interoperable with Excel.
532 | Calc Guide 26.2
Grid options
The LibreOffice Calc – Grid page defines the grid settings for spreadsheets. Using a grid helps
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, press the Ctrl key to deactivate the snap grid for as long as needed.
Grid section
Snap to grid activates the snap function.
Visible grid displays grid points on the screen. These points are not printed.
Resolution and Subdivision sections
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.
Figure 552: Calc grid options
Print options
Use the LibreOffice Calc – Print page to choose defaults for printing spreadsheets. You can
override these for individual print jobs.
Figure 553: Calc Print options
Default colors for charts
Use Tools > Options > Charts > Default Colors to change the default colors used for charts or
to add new data series to the list provided.
To add new colors to the choices, see Adding custom colors, below.
To change the default color for a data series, select it in the left-hand column and then click on
the required color in the color table.
Chapter 16 Setting up and Customizing | 533
To add another data series, click Add, then select the new series and click on the required color.
Click Default to restore the color settings that were defined when the program was installed.
Figure 554: Defining chart colors
Customizing the user interface
You can customize menus, toolbars, keyboard shortcuts, and the tabbed interface; add new
menus and toolbars; and assign macros to events.
Tip
Changes to menus and toolbars can be saved in a template. First, save them in a
document; then, save that document as a template, as described in Chapter 4, Using
Styles and Templates.
Menu content
You can add and rearrange menus on the Menu bar or context (right-click) menus; add,
rearrange, and remove commands on menus; and make other changes.
To customize menus, choose Tools > Customize on the Menu bar. On the Customize dialog,
go to the Menus tab (Figure 555) or the Context Menus tab. The following examples focus on
the Menus tab but the Context Menus tab is similar in appearance and behavior.
534 | Calc Guide 26.2
Figure 555: The Menus tab of the Customize dialog
Modifying an existing menu
To modify an existing menu:
1) In the Scope drop-down list in the upper right of the Customize dialog, choose whether
to save this changed menu for Calc or for a selected document.
2) In the Target drop-down list, select the menu that you want to customize. The list
includes all the sub‑menus as well as the main menus. The commands on the selected
menu are shown in the Assigned Commands list below.
3) To add a command to the selected menu, click on a command in the Available
Commands list and then click the right arrow. You can narrow the search by using the
Search box on the top left or selecting the Category in the drop-down list. Use the up
and down arrows on the far right-hand side to move the command into the place where
you want it in the Assigned Commands list.
4) To remove a command from the selected menu, click on it in the Assigned Commands
list and then click the left arrow.
5) To insert a separator or sub‑menu, use the commands in the Insert drop-down under
Customize at the bottom right.
Figure 556: Customize dialog, Menus tab, Insert drop-down
6) To rename a menu item, select it in the Assigned Commands list and choose Rename
in the Modify drop-down below.
Chapter 16 Setting up and Customizing | 535
Figure 557: Customize dialog, Menus tab, Modify drop-down
7) Use the Reset button to reset Calc’s menu configuration to the default settings.
8) When you have finished making all your changes, click OK to save them.
Creating a new menu
To add a menu:
1) On the Menus tab of the Customize dialog, click the button next to the Target field
(Figure 558) and select Add in the drop-down list to display the New Menu dialog
(Figure 559).
Figure 558: Location of command to add a new menu
2) In the New Menu dialog, type a name for the new menu in the Menu name box.
3) Use the up and down arrow buttons to move the new menu into the required position on
the Menu bar. Click OK to save and return to the Customize dialog.
The new menu appears on the list of menus in the Customize dialog. It will appear on the Menu
bar itself after you save your customization.
After creating a new menu, you need to add some commands to it.
536 | Calc Guide 26.2
Figure 559: Adding a new menu
Creating an accelerator
You can allocate a letter in a custom menu’s name to be used as a keyboard shortcut. (That
letter will become underlined.) When you press Alt+that letter, that menu or command will
be invoked. Existing sub‑menus can also be edited to change the letter which is used to select
them using the keyboard when the menu is open.
To create an accelerator:
1) On the Customize dialog, select a menu item in the Assigned Commands list.
2) Click the Modify button and select Rename.
3) Add a tilde (~) in front of the letter to use as an accelerator.
4) Click OK to save the change.
For example. if you enter ~Art, the A in the menu item Art is now underlined. Press Alt+A and
the Art menu opens.
Caution
When assigning an accelerator, be careful not to use a letter that is already assigned
to a menu or command associated with a menu item. The same letter-key
combinations can be used for commands associated with different menu items but
not for those associated with the same menu or menu item.
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 the Getting Started Guide. This section
describes how to create new toolbars and add or delete icons (commands) on a toolbar.
To get to the toolbar customization dialog (Figure 560), do any of the following:
• On the toolbar, right-click in the toolbar and choose Customize Toolbar.
Chapter 16 Setting up and Customizing | 537
• Choose View > Toolbars > Customize on the Menu bar and go to the Toolbars tab.
• Choose Tools > Customize on the Menu bar and go to the Toolbars tab.
Figure 560: The Toolbars tab of the Customize dialog
To customize a toolbar:
1) In the Scope drop-down list on the upper right of the Customize dialog, choose whether
to save this changed toolbar for Calc or for a selected document.
2) In the Target drop-down list, select the toolbar that you want to customize. The current
toolbar content is displayed in the Assigned Commands list.
3) Select the command to be added in the Available Commands list. You can narrow your
search by using the Search box on the top left or choosing a category in the drop-down
list just below.
4) Click on the large right arrow to add the command to the Assigned Commands list for
the toolbar. Use the up and down arrows in the far right to position the command in the
toolbar.
5) To remove a command from a toolbar, select it in the Assigned Commands list and click
the large left arrow.
6) To show or hide a command assigned to a toolbar, mark or clear the checkbox next to
its icon in the Assigned Commands list.
7) To insert a separator, use the command in the Insert drop-down under Customize at the
bottom right.
8) To rename a toolbar item, select it in the Assigned Commands list and choose Rename
in the Modify drop-down.
9) Use the Reset button to reset Calc’s toolbar configuration to the default settings.
10) When you have finished making all your changes, click OK to save them.
538 | Calc Guide 26.2
Creating a new toolbar
To create a new toolbar:
1) Choose Tools > Customize on the Menu bar.
2) On the Toolbars tab of the Customize dialog, click the button next to the Target field and
select Add in the drop-down list, to display the Name dialog.
3) On the Name dialog, type the new toolbar's name and choose in the Save In drop-down
list where to save this new toolbar – for Calc or for the open document.
The new toolbar now appears on the list of toolbars in the Customize dialog.
To add commands to the new toolbar, follow the instructions earlier for modifying a toolbar.
Choosing icons for toolbar commands
Toolbar buttons can be displayed with Icon only, Text only, or Icon and text. This selection is
made through the menu that drops down from the button to the right of the Target field. However,
not all of the commands have associated icons.
To choose an icon for a command, select the command and click Modify > Change Icon. On
the Change Icon dialog (Figure 561), scroll through the available icons, select one, and click OK
to assign it to the command.
Figure 561: Change Icon dialog
To use a custom icon, create it in a graphics program and import it into LibreOffice by clicking the
Import button on the Change Icon dialog. For best quality, custom icons should be
24 x 24 pixels in size; other sizes will be scaled automatically.
Select Modify > Reset Icon to revert to the option’s default icon.
Tabbed interface
By default, Calc’s commands are grouped in cascading menus and in toolbars filled with icons.
In addition, LibreOffice provides other user interface variants, displaying contextual groups of
commands and contents. You can find more information about these variants and how to switch
between them in Chapter 17, User Interface Variants.
Three of LibreOffice’s user interface variants utilize a notebook bar: The Tabbed, Tabbed
Compact, and Groupedbar Compact options. In these variants, the area at the top of the
workspace is divided into tabs, where each tab displays a set of icons grouped by context.
The context can change depending on the object selected in the document, for example a table
or an image.
Chapter 16 Setting up and Customizing | 539
Use the checkboxes on the Notebookbar tab of the Customize dialog (Figure 562) to show and
hide the individual options on the various tabs that are provided in the most recently selected of
the three tabbed user interfaces (with Tabbed being the initial default).
Figure 562: The Notebookbar tab of the Customize dialog
Use the Reset button to reset the displayed configuration to the default settings.
Keyboard shortcuts
In addition to the built-in keyboard shortcuts (see Appendix A), you can create your own custom
shortcuts. You can assign shortcuts to standard LibreOffice functions or your custom macros,
and save them for use across the entire LibreOffice suite or exclusively for Calc.
Caution
Avoid reassigning your operating system’s predefined shortcut keys.
Note
Shortcut keys that are grayed out in the listing on the Customize dialog, such as F1
and F10, are not available for reassignment.
To adapt shortcut keys to your needs, use the Customize dialog, as described below.
1) Select Tools > Customize on the Menu bar and select the Keyboard tab. (Figure 563).
540 | Calc Guide 26.2
Figure 563: Customizing a keyboard shortcut
2) To have the shortcut key assignment available only with Calc, select Calc in the upper
right corner of the page; otherwise select LibreOffice to make it available to every
component.
3) Next select the required function in the Category and Function lists.
4) Now select the desired shortcut keys in the Shortcut Keys list and click the Assign
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.
Saving changes to a file
Changes to the shortcut key assignments can be saved in a keyboard configuration file for use
at a later time, thus permitting you to create and apply different configurations as the need
arises, or to create a standard keyboard configuration file to be distributed among many users.
To save keyboard shortcuts to a file:
1) After making your keyboard shortcut assignments, click the Save button on the right of
the Customize dialog (Figure 563).
Chapter 16 Setting up and Customizing | 541
2) In the Save Keyboard Configuration dialog, enter a name for the keyboard configuration
file in the File name box, or select an existing file (the file extension is .cfg for
Configuration).
3) Click Save. A confirmation dialog appears if you are about to overwrite an existing file,
otherwise there will be no feedback and the file will be saved.
Loading a saved keyboard configuration
To load a saved keyboard configuration file and replace your existing configuration, click the
Load button on the right of the Customize dialog, and then select the configuration file from the
Load Keyboard Configuration dialog.
Resetting the shortcut keys
To reset all of the keyboard shortcuts to their default values, click the Reset button on the right of
the Customize dialog (adjacent to the Load and Save buttons). Use this feature with care as no
confirmation dialog will be displayed; the defaults will be set without any further notice or user
input.
Running macros from key combinations
You can also define shortcut key combinations that will run macros. These shortcut keys are
strictly user-defined; none are built in. For more information on macros, see Chapter 14, Macros.
Assigning macros to events
In LibreOffice, when something happens, we say that an event occurred. For example, a
document was opened, a key was pressed, or the mouse moved. You can associate a macro
with an event, so the macro is run when the event occurs. A common use is to assign the “open
document” event to run a macro that performs certain setup tasks for the document.
To associate a macro with an event, use the Events tab of the Customize dialog. For more
information, see the Getting Started Guide.
Adding functionality with extensions
An extension is a package that can be installed into LibreOffice to add new functionality.
Although individual extensions can be found in different places, the official LibreOffice extension
repository is at [Link] These extensions are free of charge.
Extensions from other sources may be free or may be available for a fee. Check the description
to see what licenses and fees apply to the extensions that interest you.
Installing extensions
To install an extension that is listed in the repository, follow these steps:
1) In LibreOffice, select Tools > Extensions on the Menu bar, or press Ctrl+Alt+E. In
the Extension Manager dialog, click the Get more extensions online link.
2) A browser window will open. Find the extension you want and download it to your
computer.
3) After the extension is downloaded and saved, return to the Extensions dialog and click
Add. Find and select the extension you want to install and click Open. The extension
starts to install. You may be asked to accept a license agreement.
4) When the installation is complete, the extension is listed in the Extensions dialog.
542 | Calc Guide 26.2
To install an extension that is not listed in the repository, download the extension, then continue
with step 3) above.
Updating extensions
Click the Check for Updates button on the Extensions dialog to check for updates to installed
extensions.
Note
Not all extensions include update methods that interact with LibreOffice.
Removing and disabling extensions
To uninstall an extension that you have installed, select the extension in the main window of the
Extensions dialog and click the Remove button. To disable an extension without uninstalling it,
select the extension in the main window of the Extensions dialog and click the Disable button,
which will then change to Enable.
Tip
Extensions can be installed from some other places in Calc, such as the Gallery on
the Sidebar, the Templates dialog, the Languages and Locales > Writing Aids page
of the Tools > Options dialog and the Icon Style section in the View page of the
Tools > Options dialog. In each of these places you will find a small button leading
to a filtered view of the items in the Extensions dialog.
Note
In some cases, the Remove and Disable buttons may be unavailable, for example
when you have selected one of the extensions that was bundled with your
LibreOffice installation.
Figure 564: The Extensions dialog
Chapter 16 Setting up and Customizing | 543
Adding custom colors
The method for defining a custom color is as follows:
1) Insert any drawing object, such as a square, into any document.
2) Right-click on the object and choose Area in the context menu.
3) Click on the Color button on the Area tab (Figure 565). In the Palette drop-down in the
Colors area, choose which palette you wish to add the new color to. Under New, define
the new color using RGB or Hex notation, or click the Pick button to select the color on
the Pick a Color dialog (Figure 566).
4) Click Add in the lower left corner, enter a name for the new color in the pop-up dialog,
and click OK to save.
5) Delete the drawing object from the document, if it is not needed.
Figure 565: Defining a new color
544 | Calc Guide 26.2
Figure 566: Defining a color by picking it from a color chart
Setting up document themes
Document themes collect various format selections into a set that can be applied and changed
rapidly. Theme colors are implemented in the current release. Font and format settings are
planned for later releases.
Calc supplies several sets of theme colors. To define your own set:
1) Choose Format > Theme on the Menu bar. In the Theme dialog (Figure 567), select a
theme to use as a starting point and click Add.
2) In the Theme Color Edit dialog (Figure 568), name the new theme and select colors
from any available palette.
3) Click OK to save the new theme, which will now appear in the Theme dialog.
See Chapter 4, Using Styles and Templates, for instructions on using document themes.
Note
User-defined theme color sets are saved only in the document; to use them in other
documents, you need to make a template.
Themes enhance compatibility with Microsoft Word. However, they are not yet part of
the ODF (OpenDocument Format), so you need to save to ODF 1.3 Extended or
later to use them.
Chapter 16 Setting up and Customizing | 545
Figure 567: Theme dialog
Figure 568: Theme Color Edit dialog
546 | Calc Guide 26.2
Calc Guide 26.2
Chapter 17
User Interface Variants
Introduction
By default, LibreOffice’s commands are grouped in cascading menus and in toolbars filled with
icons. This is the classic user interface described in Chapter 1, Introduction, and assumed in the
task descriptions contained in many other chapters throughout this guide.
The classic interface is highly flexible, allowing users to show, hide, or reposition many interface
components; customize the commands assigned to toolbars, menus, and context menus; create
new menus and toolbars; redefine keyboard shortcuts; and more.
A further level of flexibility is provided through six alternative user interface variants which can be
selected to match an individual user’s work flows and preferences. The seven variants are:
Standard Toolbar
Standard user interface with menus, toolbars, and collapsed Sidebar. Intended for users
who are familiar with the classic LibreOffice interface.
Tabbed
The Tabbed user interface is the most similar to the ribbons used in Microsoft Office. It
organizes functions in tabs and makes the Menu bar obsolete.
Single Toolbar
Similar to the Standard Toolbar user interface but with a single-line toolbar, intended for
use on smaller screens.
Sidebar
Similar to the Standard Toolbar user interface but with an expanded Sidebar. Expert
users who want to quickly change many different properties are advised to use this
variant.
Tabbed Compact
The Tabbed Compact user interface is intended for those with are familiar with the
Microsoft Office user interface, and occupies less space for smaller screens.
Groupedbar Compact
The Groupedbar Compact user interface provides access to functions in groups, with
icons for the most-frequently used features, and drop-down menus for others. This
variant favors vertical space.
Contextual Single
The Contextual Single interface shows functions in a single-line toolbar with context-
dependent content.
Four of these options (Standard Toolbar, Single Toolbar, Sidebar, and Contextual Single) can be
considered as alternative configurations of the components used in the classic interface.
However the other three options (Tabbed, Tabbed Compact, and Groupedbar Compact) are
based on using the notebook bar. The notebook bar organizes controls and icons differently,
displaying contextual groups of commands and contents for quicker use and improved user
experience.
It should be noted that the brief description of each variant above refers to the default setup for
that variant. There are many ways to adjust the configuration of any variant, and even create a
user interface that utilizes different aspects of multiple variants.
548 | Calc Guide 26.2
Selecting the user interface
Calc users may switch from the default user interface (Standard Toolbar) at any time as follows:
1) Choose View > User Interface on the Menu bar.
2) On the Select Your Preferred User Interface dialog (Figure 569), choose one of the
variants on the left. An example of the variant is shown in the Preview box on the right,
along with a short description.
3) Choose the relevant button to apply your selection to all components of LibreOffice, or
only to Calc. The Calc window changes to match your selection.
4) Click Close to close the dialog.
Figure 569: Select Your Preferred User Interface dialog
If experimental features have been activated (Tools > Options > LibreOffice > Advanced >
Enable experimental features (may be unstable)), then several more choices appear on the
left-hand side.
Standard interfaces
The Standard Toolbar, Single Toolbar, and Sidebar interfaces are closely related. The following
notes describe the initial default configuration for these options.
Standard Toolbar
This is the classic user interface, selected by default when LibreOffice is installed. It
provides two visible toolbars (Standard and Formatting) and the Sidebar is open,
showing its five tabs on the tab panel.
Single Toolbar
Provides one visible toolbar (Standard (Single Mode)) containing frequently used
features. The Sidebar shows only its Show/Hide button.
Sidebar
Provides one visible toolbar (Standard). The Sidebar is fully opened.
The visibility of elements on each of these three variants can be modified using the View menu
on the Menu bar. The configuration of menus, toolbars, and keyboard shortcuts can be modified
through the tabs on the Tools > Customize dialog. Because these variants are not based on the
Chapter 17 User Interface Variants | 549
notebook bar, there are no configuration options available in the Notebookbar tab of the Tools >
Customize dialog.
Contextual Single
The initial configuration for the Contextual Single interface variant is for the Menu bar to be
visible but for no toolbars to be displayed. Toolbars are automatically shown and hidden,
dependent on the user’s current context. For example, if an image is selected then the Image
toolbar is displayed, or if a drawing object is selected then the Drawing Object Properties toolbar
is displayed.
Figure 570 shows an example of the default Contextual Single interface when an image is
selected, with the context-sensitive Image toolbar shown and hidden automatically.
Figure 570: Contextual Single interface
The “x” symbol at the right end of the Menu bar is an icon for the Close Document command.
When switching to this user interface variant, Calc automatically opens the Sidebar if it is not
already open.
The visibility of elements on this variant can be modified using the View menu on the Menu bar.
The configuration of menus, toolbars, and keyboard shortcuts can be modified through the tabs
on the Tools > Customize dialog. Because this variant is not based on the notebook bar, there
are no configuration options available in the Notebookbar tab of the Tools > Customize dialog.
Tabbed interface
Introduction
The Tabbed interface (Figure 571) provides a familiar interface for users coming from proprietary
office suites such as Microsoft Office. It includes a Menu bar, an Icon bar, a Tab bar, icons for the
active tab, one or more tab-specific menus, and a Quick menu. On Windows and Linux, the
Menu bar can be hidden or displayed by clicking on the Menu Bar icon in the Icon bar (Figure
572).
Figure 571: Tabbed interface with Menu bar hidden
(29) Icon bar (30) Active tab (31) Tab bar (32) Icons on active tab (33) Tab menus (34) Quick menu
In Calc, this user interface variant includes nine fixed tabs that are always visible, and six
additional tabs that are sometimes displayed. Each tab displays a set of icons grouped by
context. The context can change depending on the location of the cursor or the item selected.
Each tab also includes one or more tab-specific drop-down menus at the right-hand end. The
Quick menu is the same for all tabs.
550 | Calc Guide 26.2
The Tabbed interface can be customized using the Notebookbar tab of the Tools > Customize
dialog to show and hide the individual icons on the various tabs. See Chapter 16, Setting up and
Customizing, for more information. In addition, the size of icons used can be adjusted through
Tools > Options > LibreOffice > View > Icon Size > Notebookbar.
If the icons on a tab do not fit into the width of the Calc window, two right-pointing angle brackets
(>>) appear at the right end of the row. Press the >> button to view additional options that are
not currently visible (see, for example, Figure 575).
Icon bar
The Icon bar (Figure 572) is located at the top left of the tabs.
Figure 572: Icon bar
(1) Menubar − Show / hide the Menu bar.
(2) Open (Ctrl+O) − Open a file browser, where you can select the file to be opened.
(3) Save (Ctrl+S) − Save the open file.
(4) Undo (Ctrl+Z) − Undo the last action performed.
(5) Redo (Ctrl+Y) − Redo the last undone action.
(6) Print (Ctrl+P) − Open the Print dialog.
Quick menu
To the right of the tabs is a Quick menu (Figure 573) containing some commonly used
commands and links. Some of the Quick menu items have submenus, indicated by arrows on
the right.
LibreOffice provides flexibility to customize icon styles and themes. If the Quick Menu icons
appear differently than those referenced in this document, you can adjust the settings by
navigating to Tools > Options > LibreOffice > View, and selecting the desired Icon Theme
Figure 573: Quick menu
Fixed tabs
The fixed tabs in Calc are File, Home, Insert, Layout, Data, Review, View, Extension, and Tools.
The nine fixed tabs are shown individually in the following subsections.
Chapter 17 User Interface Variants | 551
Each fixed tab has an associated menu, accessed through a button located at the right end of
the tab. This button is labeled with the same name as the tab. Some options available in the tab
menu may replicate options that are available on the tab; others may be extra options.
The appearance of a tab depends on both the configuration of your computer system and the
setup of your Calc installation. The following points should be noted about the illustrations that
follow:
• To increase readability of this chapter, the screen shots of tabs have been taken using a
relatively small Calc window. This means that the >> icon appears on most of the tabs,
indicating that some options are not visible.
• Left and right ends of the tabs are shown separately, making the illustrations large
enough to see the commands more easily.
• For each tab that shows a >> icon, a separate figure is included to show the additional
options that appear when the >> icon is pressed.
• A further figure is included to show the content of the menus at the right end of the tab.
File tab
Figure 574 shows the File tab and Figure 575 shows the additional options that are presented
when the >> icon is pressed.
Figure 574: File tab
Figure 575: File tab - additional options
The File tab has two menus, File and Help, and these are shown in Figure 576. Close and
LibreOffice Help icons are located adjacent to the File and Help menu buttons.
552 | Calc Guide 26.2
Figure 576: File tab menus
Home tab
Figure 577 shows the Home tab and Figure 578 shows the additional options that are presented
when the >> icon is pressed.
Figure 577: Home tab
Figure 578: Home tab - additional options
The Home tab has one menu, Home, as shown in Figure 579. Find and Replace (Ctrl+H), Sort
Ascending and AutoFilter (Ctrl+Shift+L) icons are located adjacent to the Home menu button.
Chapter 17 User Interface Variants | 553
Figure 579: Home tab menu
Insert tab
Figure 580 shows the Insert tab and Figure 581 shows the additional options that are presented
when the >> icon is pressed.
Figure 580: Insert tab
Figure 581: Insert tab - additional options
The Insert tab has one menu, Insert, as shown in Figure 582. Insert or Edit Pivot Table, Show
Draw Functions, and Function List icons are located adjacent to the Insert menu button.
554 | Calc Guide 26.2
Figure 582: Insert tab menu
Layout tab
Figure 583 shows the Layout tab and Figure 584 shows the additional options that are presented
when the >> icon is pressed.
Figure 583: Layout tab
Figure 584: Layout tab - additional options
The Layout tab has one menu, Layout, as shown in Figure 585. A Format Page icon is located
adjacent to the Layout menu button.
Chapter 17 User Interface Variants | 555
Figure 585: Layout tab menu
Data tab
Figure 586 shows the Data tab and Figure 587 shows the additional options that are presented
when the >> icon is pressed.
Figure 586: Data tab
Figure 587: Data tab - additional options
The Data tab has one menu, Data, as shown in (Figure 588). Find and Replace (Ctrl+H), Sort
Ascending, and AutoFilter (Ctrl+Shift+L) icons are located adjacent to the Data menu button.
Figure 588: Data tab menu
556 | Calc Guide 26.2
Review tab
Figure 589 shows the Review tab and Figure 590 shows the additional options that are
presented when the >> icon is pressed.
Figure 589: Review tab
Figure 590: Review tab - additional options
The Review tab has one menu, Review, as shown in Figure 591. A Manage Track Changes
icon is located adjacent to the Review menu button.
Figure 591: Review tab menu
View tab
Figure 592 shows the View tab and Figure 593 shows the additional options that are presented
when the >> icon is pressed.
Figure 592: View tab
Chapter 17 User Interface Variants | 557
Figure 593: View tab - additional options
The View tab has one menu, View, as shown in Figure 594. A Zoom icon is located adjacent to
the View menu button.
Figure 594: View tab menu
Extension tab
The Extension tab includes commands from installed extensions (if they are configured to
appear) and features the Extension menu, which provides access to the Extension Manager
(Ctrl+Alt+E) option (Figure 595).
Figure 595: Extension tab menu
Tools tab
Figure 596 shows the Tools tab and Figure 597 shows the additional options that are presented
when the >> icon is pressed.
Figure 596: Tools tab
558 | Calc Guide 26.2
Figure 597: Tools tab - additional options
The Tools tab has one menu, Tools, as shown in Figure 598. An Options icon is located
adjacent to the Tools menu button.
Figure 598: Tools tab menu
Additional tabs
When an item is selected, additional tabs appear between the View and Extension tabs. In Calc,
these tabs include Draw, Form, Image, Media, Object, and Print.
Draw tab
Figure 599 shows the Draw tab and Figure 600 shows the additional options that are presented
when the >> icon is pressed. The Draw tab is displayed when a drawing object is selected.
Figure 599: Draw tab
Figure 600: Draw tab - additional options
Chapter 17 User Interface Variants | 559
The Draw tab has one menu, Draw, as shown in Figure 601. Area, Line, and Position and Size
icons are located adjacent to the Draw menu button.
Figure 601: Draw tab menu
Form tab
Figure 602 shows the Form tab, which is displayed when a form component is selected in design
mode.
Figure 602: Form tab
The Form tab has one menu, Form, as shown in Figure 603. A Form Properties icon is located
adjacent to the Form menu button.
Figure 603: Form tab menu
Image tab
Figure 604 shows the Image tab and Figure 605 shows the additional options that are presented
when the >> icon is pressed. The Image tab is displayed when an image is selected.
560 | Calc Guide 26.2
Figure 604: Image tab
Figure 605: Image tab - additional options
The Image tab has one menu, Image, as shown in Figure 606. Save, Area, Line, and Position
and Size icons are located adjacent to the Image menu button.
Figure 606: Image tab menu
Media tab
Figure 607 shows the Media tab, which is displayed a media object is selected.
Figure 607: Media tab
The Media tab has one menu, Media, as shown in Figure 608. Area, Line, and Position and
Size icons are located adjacent to the Media menu button.
Chapter 17 User Interface Variants | 561
Figure 608: Media tab menu
Object tab
Figure 609 shows the Object tab, which is displayed when an object (for example, an OLE
object) is selected.
Figure 609: Object tab
The Object tab has one menu, Object, as shown in Figure 610. Area, Line, and Position and
Size icons are located adjacent to the Object menu button.
Figure 610: Object tab menu
Print tab
Figure 611 shows the Print tab, which is displayed when a print preview is selected.
Figure 611: Print tab
The Print tab has one menu, Print, as shown in Figure 612. A Full Screen icon is located
adjacent to the Print menu button.
562 | Calc Guide 26.2
Figure 612: Print tab menu
Tabbed Compact interface
As its name suggests, the Tabbed Compact interface is a more compact version of the Tabbed
interface described in the previous section. The Tabbed Compact interface provides the same
nine fixed tabs (File, Home, Insert, Layout, Data, Review, View, Extension, and Tools) and six
additional tabs (Draw, Form, Image, Media, Object, and Print). However, in this case the
commands on each tab are displayed in a single row, using less vertical screen space.
Figure 613 shows an example of the Tabbed Compact interface for the File tab. Similar to the
behavior of the Tabbed interface, pressing the >> button provides access to additional options,
as shown in Figure 614 for this tab.
Figure 613: Tabbed Compact interface, File tab
Figure 614: Tabbed Compact interface, File tab, additional options
The content of individual tabs and tab menus is similar to the corresponding components of the
Tabbed interface and is not described further in this guide.
The Tabbed Compact interface can be customized using the Notebookbar tab of the Tools >
Customize dialog to show and hide the individual icons on the various tabs. See Chapter 16,
Setting up and Customizing, for more information. In addition, the size of icons used can be
adjusted through Tools > Options > LibreOffice > View > Icon Size > Notebookbar.
Groupedbar Compact interface
The Groupedbar Compact interface is an alternative user interface that does not use toolbars or
tabs to organize commands. Instead, commands are arranged into context-sensitive groups,
visually separated by vertical lines. Each group contains icons, menus, and other controls as
appropriate. Figure 615 shows the default configuration of the Groupedbar Compact commands
(displayed, for example, when an empty cell is selected).
Chapter 17 User Interface Variants | 563
Figure 615: Groupedbar Compact interface
Similar to the behavior of the Tabbed interface, if the groups do not all fit into the width of the
Calc window, two right-pointing angle brackets (>>) appear toward the right (see Figure 615).
Press the >> button to access the additional groups that are not currently visible−see, for
example, Figure 616 which shows the hidden groups corresponding to Figure 615.
Figure 616: Groupedbar Compact - additional groups
As is evident from Figures 615 and 616, many groups provide several icons located above a
menu button. Press the menu button to access a menu of commands relating to the group, as
shown in Figure 617 for example.
Figure 617: Groupedbar Compact interface - Edit group and menu
The groups displayed in the Groupedbar Compact interface vary depending on context. For
example, if an image is currently selected then the groups shown in Figure 618 are displayed.
564 | Calc Guide 26.2
Figure 618: Groupedbar Compact interface with image selected
At the right end of the Groupedbar Compact interface is a small area containing Find and
Replace (Ctrl+H), LibreOffice Help, and Close icons, above a button labeled Menu. The
content of this menu is not context-sensitive and always contains the commands shown in
Figure 619.
Figure 619: Groupedbar Compact menu
The Groupedbar Compact interface can be customized using the Notebookbar tab of the Tools
> Customize dialog to show and hide the individual icons on the various groups. See Chapter
16, Setting up and Customizing, for more information. In addition, the size of icons used can be
adjusted through Tools > Options > LibreOffice > View > Icon Size > Notebookbar.
Chapter 17 User Interface Variants | 565
Calc Guide 26.2
Appendix A
Keyboard Shortcuts
Introduction
Calc can be operated entirely through keyboard shortcuts, eliminating the need for a mouse or
touch pad. This appendix provides a complete reference list of built-in shortcuts, allowing easy
browsing to identify those that enhance daily workflow.
Upon installation, LibreOffice includes a default set of Calc keyboard shortcuts, described in this
chapter under the assumption that no customization has been applied. Shortcuts for common
actions can be identified by observing key sequences displayed in menu options and toolbar tool
tips. A more extensive list is available in the Keyboard tab of the Customize dialog (Tools >
Customize).
Additional details about specific key combinations appear throughout this guide and in the Help
system.
Shortcuts may be defined or changed using Tools > Customize > Keyboard on the Menu bar.
See Chapter 16, Setting up and Customizing, for further instructions. Some shortcuts cannot be
re-assigned; these are identified in the “Keyboard shortcuts that cannot be modified” section.
Caution
Be careful when reassigning predefined shortcuts. Although you can reset shortcut
keys back to LibreOffice defaults, changing common hotkeys, such as F1 for Help,
can cause confusion and frustration, especially if other users share your computer.
Note
Different operating systems may allocate particular keys to operating system
functions and, in such cases, those keys may not perform the Calc functions
described in this appendix.
For example, the F1 function key may be used to put your Windows computer into a
sleep / hibernation mode and so cannot be used to access the Calc Help system.
For some macOS versions, the Cmd+F5 key sequence is used by macOS to display
its VoiceOver dialog and so cannot be used to control the display of the sidebar.
Similarly the Shift+F11 key sequence may be used by macOS to show its desktop
and so cannot be used to access the Save as Template dialog in Calc.
Check your computer system’s documentation to determine which key presses are
used by the operating system and hence cannot carry out Calc functions.
Combined Shortcut Reference
macOS keyboard symbols
Keys on many macOS keyboards use symbols rather than text labels. Table 25 identifies some
common macOS keyboard symbols with their meanings. In the tables that follow, the key names
are used rather than symbols, since the latter may not appear on all macOS keyboards.
Table 25: Common MacOS keyboard keys
Key name Symbol
Command (shortened to “Cmd” in the tables that follow) ⌘
Control (shorted to “Ctrl” in the tables that follow) ^
Option ⌥
568 | Calc Guide 26.2
Key name Symbol
Shift ⇑
Page Up (shortened to “Pg Up” in the tables that follow) ⇞
Page Down (shortened to “Pg Dn” in the tables that follow) ⇟
Home ↖
End ↘
Delete ⌫
Forward Delete (shortened to “Fwd Del” in the tables that follow) ⌦
Application Shortcuts
Table 26: LibreOffice Calc shortcuts
Shortcut name Keys Description and notes
Help F1 LibreOffice Help
Context Help Shift+F1 Display context-sensitive help.
Navigator F5 View > Navigator.
Ctrl+F5 (Win/Linux)
Sidebar View > Sidebar.
Cmd+F5 (macOS)
F7 (Win/Linux)
Spelling Tools > Spelling; Standard toolbar icon.
Shift+Cmd+; (macOS)
Ctrl+F7 (Win/Linux)
Thesaurus Tools > Thesaurus.
Cmd+F7 (macOS)
Tools > Language > Hangul/Hanja
Ctrl+Shift+F7 (Win/Linux)
Hangul/Hanja Conversion (availability depends on Language
Shift+Cmd+F7 (macOS)
Settings).
Auto Spell Shift+F7 Tools > Automatic Spell Checking.
Recalculate F9 Data > Calculate > Recalculate.
Ctrl+Shift+F9 (Win/Linux)
Hard Recalc Data > Calculate > Recalculate Hard.
Shift+Cmd+F9 (macOS)
File > Templates > Save as Template (via
Save Template Shift+F11
Save icon menu).
Group F12 Data > Group and Outline > Group.
Ctrl+F12 (Win/Linux)
Ungroup Data > Group and Outline > Ungroup.
Cmd+F12 (macOS)
Ctrl+Shift+S (Win/Linux)
Save As File > Save As; via Save icon menu.
Shift+Cmd+S (macOS)
Hide App Cmd+H (macOS) LibreOffice > Hide LibreOffice.
Ctrl+W (Win/Linux)
Close Window Window > Close Window.
Cmd+W (macOS)
Alt+F12 (Win/Linux) Tools > Options.
Preferences
Cmd+, (macOS) LibreOffice > Preferences.
Search
Shift+Esc (Win/Linux) Help > Search Commands.
Commands
Repeat Find Cmd+G (macOS) Repeat search forwards.
Appendix A Keyboard Shortcuts | 569
Formatting
Table 27: Keys for formatting data
Shortcut name Keys Description and notes
F11 (Win/Linux)
Styles View > Styles; Styles > Manage Styles.
Cmd+T (macOS)
Ctrl+1 (Win/Linux)
Format Cells Format > Cells.
Cmd+1 (macOS)
Ctrl+Shift+1 (Win/Linux) Format > Number Format > Number (main
Number Format
Cmd+Shift+1 (macOS) keyboard 1). Toolbar icon available.
Format > Number Format > Scientific (main
Scientific Ctrl+Shift+2
keyboard 2).
Format > Number Format > Date (main
Date Ctrl+Shift+3
keyboard 3). Toolbar icon available.
Format > Number Format > Currency (main
Currency Ctrl+Shift+4
keyboard 4); toolbar icon available.
Format > Number Format > Percent (main
Percent Ctrl+Shift+5
keyboard 5); toolbar icon available.
Format > Number Format > General (main
General Ctrl+Shift+6
keyboard 6).
Ctrl+B (Win/Linux) Format > Text > Bold; Formatting toolbar
Bold
Cmd+B (macOS) icon.
Ctrl+Shift+B (Win/Linux)
Subscript Format > Text > Subscript.
Shift+Cmd+B (macOS)
Ctrl+E (Win/Linux)
Align Center Format > Align > Centered; toolbar icon.
Cmd+E (macOS)
Ctrl+I (Win/Linux)
Italic Format > Text > Italic; toolbar icon.
Cmd+I (macOS)
Ctrl+J (Win/Linux)
Align Justify Format > Align > Justified.
Cmd+J (macOS)
Ctrl+E (Win/Linux)
Align Center Format > Align > Centered; toolbar icon.
Cmd+E (macOS)
Ctrl+L (Win/Linux)
Align Left Format > Align > Left; toolbar icon.
Cmd+L (macOS)
Ctrl+R (Win/Linux)
Align Right Format > Align > Right; toolbar icon.
Cmd+R (macOS)
Ctrl+Shift+P (Win/Linux)
Superscript Format > Text > Superscript.
Shift+Cmd+P (macOS)
Ctrl+U (Win/Linux)
Underline Underline icon on Formatting toolbar.
Cmd+U (macOS)
Cursor movement
Table 28: Keys for moving cursor in workspace
Shortcut name Keys Description and notes
Move Up ↑ Move cell focus up.
Jump Up Edge Ctrl+↑ (Win/Linux) Jump to edge of current data range upward.
Cmd+↑ (macOS)
570 | Calc Guide 26.2
Shortcut name Keys Description and notes
Move Right → Move cell focus right.
Jump Right Edge Ctrl+→ (Win/Linux) Jump to edge of current data range to the
Cmd+→ (macOS) right.
Move Down ↓ Move cell focus down.
Jump Down Edge Ctrl+↓ (Win/Linux) Jump to edge of current data range
Cmd+↓ (macOS) downward.
Move Left ← Move cell focus left.
Jump Left Edge Ctrl+← (Win/Linux) Jump to edge of current data range to the
Cmd+← (macOS) left.
Row First Cell Home Move to first cell of current row.
Sheet First Cell Ctrl+Home (Win/Linux) Move to cell A1 in current sheet.
Cmd+Home (macOS)
Row Last Data End Move along row to last column with data.
Sheet Last Data Ctrl+End (Win/Linux) Move to last row/column cell containing data.
Cmd+End (macOS)
Page Up PgUp Move up one screen page.
Prev Sheet Ctrl+PgUp (Win/Linux) Move to previous sheet (expert option allows
Cmd+Pg Up (macOS) wrap from first to last).
Page Left Alt+PgUp (Win/Linux) Move one screen page left.
Option+Pg Dn (macOS)
Page Down PgDown (Win/Linux) Move down one screen page.
Pg Dn (macOS)
Next Sheet Ctrl+PgDown Move to next sheet (expert option allows
(Win/Linux) wrap from last to first).
Cmd+Pg Dn (macOS)
Page Right Alt+PgDown (Win/Linux) Move one screen page right.
Option+Pg Up (macOS)
Refocus Cursor Ctrl+Backspace Refocus view on cursor.
(Win/Linux)
Cmd+Delete (macOS)
Move Next in Range Enter Move to next cell in selection (top→bottom,
then left→right); direction configurable in
Options/Preferences.
Move to Input Ctrl+Shift+F2 Focus Input line (enter formula).
(Win/Linux)
Shift+Cmd+F2 (macOS)
Focus Name Box Ctrl+Shift+F5 / Move cursor to Name Box on Formula bar.
Ctrl+Shift+T (Win/Linux)
Shift+Cmd+F5 /
Shift+Cmd+T (macOS)
Selection
Table 29: Selection keys
Shortcut name Keys Description and notes
Select Up Shift+↑ Extend selection upward.
Appendix A Keyboard Shortcuts | 571
Shortcut name Keys Description and notes
Ctrl+Shift+↑ (Win/Linux)
Select Up Edge Select to edge of data range upward.
Shift+Cmd+↑ (macOS)
Select Right Shift+→ Extend selection rightward.
Ctrl+Shift+→ (Win/Linux)
Select Right Edge Select to edge of data range rightward.
Shift+Cmd+→ (macOS)
Alt+↓ (Win/Linux) Show drop-down of prior text entries in
AutoText List
Option+↓ (macOS) column.
Select Down Shift+↓ Extend selection downward.
Ctrl+Shift+↓ (Win/Linux)
Select Down Edge Select to edge of data range downward.
Shift+Cmd+↓ (macOS)
Select Left Shift+← Extend selection leftward.
Ctrl+Shift+← (Win/Linux)
Select Left Edge Select to edge of data range leftward.
Shift+Cmd+← (macOS)
Select from cursor to first cell of current
Select to Row Start Shift+Home
row.
Ctrl+Shift+Home (Win/Linux)
Select to A1 Select from cursor to A1 in current sheet.
Shift+Cmd+Home (macOS)
Select from cursor to last column with
Select to Row End Shift+End
data.
Ctrl+Shift+End (Win/Linux) Select from cursor to last row/column
Select to Last Data
Shift+Cmd+End (macOS) with data.
Shift+PgUp (Win/Linux)
Select Page Up Select from cursor to row one page up.
Shift+Pg Dn (macOS)
Select from cursor to column one page
Select Page Left Alt+Shift+PgUp (Win/Linux)
left.
Select from cursor to column one page
Select Page Left Option+Shift+Pg Dn (macOS)
left.
Select from cursor to row one page
Select Page Down Shift+PgDown
down.
Alt+Shift+PgDown
Select from cursor to column one page
Select Page Right (Win/Linux)
right.
Option+Shift+Pg Up (macOS)
Ctrl+[ (Win/Linux) Select cells on which current cell is
Select Precedents
Cmd+[ (macOS) dependent.
Ctrl+] (Win/Linux)
Select Dependents Select cells dependent on current cell.
Cmd+] (macOS)
Ctrl+Shift+PgUp (Win/Linux) Edit > Select > Select to Previous
Select Prev Sheet
Shift+Cmd+PgUp (macOS) Sheet.
Ctrl+Shift+PgDown
Select Next Sheet (Win/Linux) Edit > Select > Select to Next Sheet.
Shift+Cmd+PgDn (macOS)
Ctrl + A (Win/Linux)
Edit > Select > Select Data Area
Select Data Area Ctrl+ * (Win/Linux, numpad *)
(cursor must be inside area).
Cmd+ * (macOS)
Select Column Ctrl+Space Edit > Select > Select Column.
Select Row Shift+Space Edit > Select > Select Row.
572 | Calc Guide 26.2
Shortcut name Keys Description and notes
Ctrl+Shift+Space (Win/Linux)
Select All Edit > Select All.
Cmd+A (macOS)
Toggle standard vs extending / adding
Toggle Select Mode F8 / Shift+F8 (macOS)
selection modes.
Select all cells in current sheet. The
Select All Cells Ctrl+A (Win/Linux)
focus must be out of any data area.
Data display
Table 30: Keys for viewing data
Shortcut name Keys Description & notes
Optimize Row Alt+Shift+↑ (Win/Linux) Optimize row height based on current cell.
Option+Shift+↑ (macOS)
Increase Column Alt+→ (Win/Linux) Increase width of current column.
Option+→ (macOS)
Optimize Column Alt+Shift+→ (Win/Linux) Optimize column width based on current
Option+Shift+→ (macOS) cell.
Optimize Row Alt+Shift+↓ (Win/Linux) Optimize row height based on current cell.
Option+Shift+↓ (macOS)
Decrease Column Alt+← (Win/Linux) Decrease width of current column.
Option+← (macOS)
Optimize Column Alt+Shift+← (Win/Linux) Optimize column width based on current
Option+Shift+← (macOS) cell.
Full Screen Ctrl+Shift+J (Win/Linux) View > Full Screen.
Ctrl+Cmd+F (macOS)
Redraw View Ctrl+Shift+R (Win/Linux) Redraws the document view.
Shift+Cmd+R (macOS)
Show Comment Ctrl+F1 (Win/Linux) Display comment attached to current cell.
Cmd+F1 (macOS)
Value Highlight Ctrl+F8 (Win/Linux) View > Value Highlighting.
Cmd+F8 (macOS)
Data Sources Ctrl+Shift+F4 (Win/Linux) View > Data Sources.
Shift+Cmd+F4 (macOS)
Trace Precedents Shift+F9 Tools > Detective > Trace Precedents.
Trace Dependents Shift+F5 Tools > Detective > Trace Dependents.
Show Formula Ctrl+` (Win/Linux) View > Show Formula. ( ` key is left of 1
on many keyboards.)
Editing
Table 31: Keys for data editing
Shortcut name Keys Description & notes
Edit Cell F2 Enter cell edit mode.
Cancel Edit Escape Cancel current cell edit.
Copy to Clipboard Ctrl+Insert (Win/Linux) Copy selection to clipboard (for later
paste).
Appendix A Keyboard Shortcuts | 573
Shortcut name Keys Description & notes
Copy Ctrl+C (Win/Linux) Edit > Copy; Standard toolbar icon.
Cmd+C (macOS)
Paste Clipboard Shift+Insert (Win/Linux) Paste clipboard into selection.
Paste Special Insert (Win/Linux) After selecting, open Paste Special
dialog.
Paste Ctrl+V (Win/Linux) Edit > Paste; toolbar icon.
Cmd+V (macOS)
Paste Special Ctrl+Shift+V (Win/Linux) Edit > Paste Special > Paste Special.
Shift+Cmd+V (macOS)
Paste Unformatted Ctrl+Alt+Shift+V Edit > Paste Special > Paste
(Win/Linux) Unformatted Text.
Option+Shift+Cmd+V
(macOS)
Delete Contents Delete (Win/Linux) Delete cell contents without dialog
Forward Delete (macOS) (keeps formatting).
Cut Ctrl+X (Win/Linux) Edit > Cut; toolbar icon.
Cmd+X (macOS)
Cut Keep Format Ctrl+Shift+X (Win/Linux) Cut contents; keep cell formatting.
Remove & Copy Shift+Delete (Win/Linux) Remove and copy selection to clipboard.
Deselect Shift+Backspace Deselect current selection without
(Win/Linux) deleting.
Undo Last Entry Alt+Backspace (Win/Linux) Reverse last command or last entry
Option+Delete (macOS) typed.
Copy Above Ctrl+' (Win/Linux) Copy cell above into current cell; remain
Cmd+' (macOS) in edit mode (apostrophe key).
Line Break Ctrl+Enter (Win/Linux) Insert manual line break while editing a
Cmd+Enter (macOS) cell.
Create Matrix Ctrl+Shift+Enter Create matrix in current range using
(Win/Linux) formula input.
Shift+Cmd+Enter (macOS)
Edit Matrix F2, followed by Edit matrix formula in current range,
Ctrl+Shift+Enter using formula input.
(Win/Linux)
Shift+Cmd+Enter (macOS)
Fill Range Alt+Enter (Win/Linux) Fill selected range with formula from
Option+Enter (macOS) input line.
Sum Function Alt+= (Win/Linux) Equivalent to Select Function > Sum on
Formula bar.
Formula Object Alt+Shift+E (Win/Linux) Insert > OLE Object > Formula Object.
Option+Cmd+= (macOS)
Redo Ctrl+Y (Win/Linux) Edit > Redo; toolbar icon.
Cmd+Y (macOS)
Repeat Ctrl+Shift+Y (Win/Linux) Edit > Repeat.
Shift+Cmd+Y (macOS)
Undo Ctrl+Z (Win/Linux) Edit > Undo; toolbar icon.
Cmd+Z (macOS)
Cycle Case Shift+F3 Format > Text > Cycle Case.
574 | Calc Guide 26.2
Shortcut name Keys Description & notes
Ref Types F4 Sheet > Cycle Cell Reference Types.
Clear Formatting Ctrl+M (Win/Linux) Format > Clear Direct Formatting;
Cmd+M (macOS) toolbar icon.
Edit Mode Ctrl+Shift+M (Win/Linux) Edit > Edit Mode.
Shift+Cmd+M (macOS)
Undo Reverse Ctrl+Shift+Z (Win/Linux) Reverse last Undo command.
Shift+Cmd+Z (macOS)
Inserting data
Table 32: Keys for inserting contents
Shortcut name Keys Description & notes
Insert Ctrl+Alt+C (Win/Linux) Insert > Comment / Sheet > Cell
Comment Option+Cmd+C (macOS) Comments > Edit Comment; toolbar icon.
Fill Down Ctrl+D (Win/Linux) Sheet > Fill Cells > Fill Down.
Cmd+D (macOS)
Insert Function Ctrl+F2 (Win/Linux) Insert > Function.
Cmd+F2 (macOS)
Insert Cells Ctrl+ + (Win/Linux, numpad +) Sheet > Insert Cells.
Cmd+ + (macOS, numpad +)
Delete Cells Ctrl+ - (Win/Linux, numpad -) Sheet > Delete Cells.
Cmd+ - (macOS, numpad -)
Insert Date Ctrl+; (Win/Linux) Insert > Date.
Cmd+; (macOS)
Insert Time Ctrl+Shift+; (Win/Linux) Insert > Time.
Chart and Outline shortcuts
Table 33: Keys for charts and outlines
Shortcut name Keys Description & notes
Chart Next Element Tab / ⇥ Select next chart element.
Shift+Tab
Chart Prev Element Select previous chart element.
Shift+⇥
Chart First Element Home Select first chart element.
Chart Last Element End Select last chart element.
Chart Cancel Esc Cancel selection.
Move selected chart element; in pie charts,
Chart Move Arrow keys
move segment in arrow direction.
Chart Text Mode F2 (titles) Enter text input mode.
F3 (legends/data
Chart Open Group Open group to edit components.
series)
Ctrl+F3
Chart Exit Group Exit group (Win/Linux/macOS).
Cmd+F3
Enlarge/shrink chart; in pie charts, move
Chart Zoom + / - (numpad)
segment off/into pie.
Appendix A Keyboard Shortcuts | 575
Shortcut name Keys Description & notes
Cycle outline indicators forward (focus outline
Outline Cycle Forward Tab / ⇥
window with F6/Shift+F6).
Shift+Tab
Outline Cycle Back Cycle outline indicators backward.
Shift+⇥
Ctrl+1 – 8 Show all levels up to number; hide higher
Outline Show Levels
Cmd+1 – 8 levels.
Outline Show/Hide
+ / - (numpad) Show (+) or hide (-) focused outline group.
Group
Outline Activate Enter Activate focused indicator button.
Outline Navigate Arrow keys Cycle indicators in arrow direction.
Keyboard shortcuts that cannot be modified
Table 34 identifies the key combinations that are grayed out (not available for modification) in the
Shortcut Keys list on the Tools > Customize > Keyboard dialog with Calc selected.
Table 34: Grayed key combinations in Tools > Customize > Keyboard
Operating system Key combinations grayed in Customize dialog
F1, Cmd+F1, Shift+F1
Shift+F2
Cmd+F4, Option+F4, Cmd+Option+F4
F6, Cmd+F6, Shift+F6, Shift+Cmd+F6
macOS
F10
Shift+Cmd+0, Shift+Cmd+1, Shift+Cmd+2, Shift+Cmd+3,
Shift+Cmd+4, Shift+Cmd+5, Shift+Cmd+6, Shift+Cmd+7,
Shift+Cmd+8, Shift+Cmd+9
Note
Certain keys may be reserved by the operating system and therefore unavailable for
Calc (e.g., F1 for Windows Sleep/Hibernate; macOS Cmd+F5 for VoiceOver; macOS
Shift+F11 for desktop). Refer to the OS documentation when a shortcut does not
trigger Calc behavior.
576 | Calc Guide 26.2
Calc Guide 26.2
Appendix B
Error Codes
Introduction to Calc error codes
Calc provides feedback for errors of miscalculation, incorrect use of functions, invalid cell
references and values, and other user initiated mistakes. The feedback may be displayed within
the cell that contains the error (Figure 620), or on the Status bar (Figure 621), or in both,
depending on the type of error. Generally speaking, if the error occurs in the cell that is selected
(or contains the cursor), the error message is displayed on the Status bar.
As an example, Figure 620 shows the error code returned when a column is too narrow to
display the entire formatted date. The date displayed within the input line, 11/06/2023, would fit
within the cell without a problem, but the format used by the cell produces the date value
Monday, November 6, 2023.
Figure 620: Error codes displayed within cells
When the cell displaying the #REF! error code in Figure 620 is selected, the Status bar displays
the error message as shown in Figure 621. This message is more descriptive than the message
displayed in the cell, but it still may not provide enough information to correctly diagnose the
problem. For fuller explanations, consult the following tables and the Help topic, Error Codes in
LibreOffice Calc.
Figure 621: An error message displayed in the Status bar
This appendix presents error codes in two tables.
1) Table 35 lists error strings which are displayed within the cell that actually contains the
error. Except in the cases of the ###, #FMT, and #N/A errors, they all correspond to a
Calc error code number. Alphanumeric codes such as Err:502 and Err:511 can also
appear in cells; these are not separately identified in the Table 35 but their meanings
are given in Table 36.
2) Table 36 explains all of the error codes, listed by code number, including those error
codes in the first table.
3) Table 37 contains a list of Calc error functions, used to handle errors in calculations.
Tip
You can use the ERRORTYPE() function to find the code number for an error
occurring in a different cell. See Calc Error Functions below.
578 | Calc Guide 26.2
Error codes displayed within cells
Table 35: Error codes in cells
Cell tatus bar
S
Code Explanation of the error
display message
The column is too narrow to display the complete
formatted contents of the cell. This is not really an
error value, so there is no corresponding numerical
error code. The solutions to this problem are to
- ### - increase the width of the column, or select Format >
Cells > Alignment and click either Wrap text
automatically or Shrink to fit cell size in the
Properties area so as to make the text match the
current column width.
This value is outside of the valid limits for this
- #FMT - number format. This is not really an error value, so
there is no corresponding numerical error code.
A result for the formula expression is not available.
Error: Value not The formula cannot find what it has been asked to
- #N/A
available look for. This is not really an error value, so there is
no corresponding numerical error code.
Invalid floating point operation. Calculation result
Error: Invalid outside of the defined value range. A calculation that
503 #NUM!
numeric value results in an overflow of the defined value range – a
value too big or too small.
No valid result is possible. A function cannot supply
a value corresponding to its definition; or a cell
519 #VALUE! rror: No value
E
referenced in the formula contains text instead of an
expected number.
Error: No code No code or no intersection. The intersection of
521 #NULL!
or intersection ranges produced zero cells.
Compiler: a row or column heading could not be
detected. Interpreter: the formula refers to a cell
whose column, row, or table/sheet has been deleted
or which is outside the table/sheet. The formula
Error: Not a
524 #REF! within the cell uses a reference that does not exist.
valid reference
Either a column or a row description name could not
be resolved, or the column, row, or sheet that
contains a referenced cell is missing or it is outside
the sheet.
An identifier could not be evaluated: no valid
rror: Invalid
E reference, no valid function name, no column/row
525 #NAME?
name label, no macro, incorrect decimal separator, add-in
not found.
rror: Division
E The denominator of a division operation ("/") is 0
532 #DIV/0!
by zero (zero). Several functions can also return this error.
Appendix B Error Codes | 579
General error codes
The following table is an overview of the most common error messages for LibreOffice Calc.
Note
Errors described as Internal errors should not be encountered by users under normal
conditions.
Table 36: List of error codes
Code Status bar message Explanation of the error
Error: Invalid Invalid character in formula. Similar to the Invalid Name
501
character error (525) except that it occurs within a formula.
An argument of a function has an invalid value. This
Error: Invalid
502 error also occurs if more than one matching cell is
argument
found by the DGET() function.
Invalid floating point operation. Calculation result
503 Error: Invalid numeric outside of the defined value range. A calculation that
(#NUM!) value results in an overflow of the defined value range – a
value too big or too small.
The type of a parameter of a function is invalid. For
504 Error in parameter list instance, a parameter of a function is text instead of a
number.
507 Error: in bracketing Missing bracket or parenthesis
Missing bracket or parenthesis. For instance, closing
508 Error: in bracketing parenthesis without an opening parenthesis, or a
missing closing parenthesis in the middle of a formula.
Error: Operator
509 An operator is missing.
missing
Two operators, where the second is not a unitary
510 Error: Variable missing
operator, follow each other.
The function requires more variables than those
511 Error: Variable missing
provided.
Formula too long / complex. For example, the total
Error: Formula
512 number of internal tokens (that is, operators, variables,
overflow
brackets) in the formula exceeds 8192.
513 Error: String overflow Character string too long.
Error: Internal Internal capacity exceeded. An internal calculation
514
overflow stack overflow occurred.
Internal syntactical
515 Unknown error.
error
Matrix is expected on the calculation stack, but it is not
Internal syntactical
516 available. The calculation stack should contain a matrix
error
but it is not there.
Unknown operation code. A document containing a
Internal syntactical
517 newer feature is loaded in an older version of Calc that
error
did not support that feature.
Variable not available. A variable was supposed to be
Internal syntactical
518 popped from the calculation stack but it is not
error
available / not there.
580 | Calc Guide 26.2
Code Status bar message Explanation of the error
No valid result is possible. A function cannot supply a
519 value corresponding to its definition; or a cell
Error: No value
(#VALUE!) referenced in the formula contains text instead of an
expected number.
Internal syntactical The compiler has generated a code which it cannot
520
error interpret.
521 Error: No code or No code or no intersection. The intersection of ranges
(#NULL!) intersection produced zero cells.
A formula refers directly or indirectly to itself and the
Error: Circular
522 Iterations option is not activated under Tools >
reference
Options > LibreOffice Calc > Calculate.
The calculation procedure does not converge. A
function missed a targeted value (tends towards a
Error: Calculation
523 given value but does not reach it), or iterative
does not converge
references do not reach the minimum change within the
defined maximum steps (increments) that are set.
Compiler: a row or column heading could not be
detected.
Interpreter: the formula refers to a cell whose column,
row, or table/sheet has been deleted or which is outside
524 Error: Not a valid
the table/sheet. The formula within the cell uses a
(#REF!) reference
reference that does not exist. Either a column or a row
description name could not be resolved, or the column,
row, or sheet that contains a referenced cell is missing
or it is outside the sheet.
An identifier could not be evaluated: no valid reference,
525
Error: Invalid name no valid function name, no column/row label, no macro,
(#NAME?)
incorrect decimal separator, add-in not found.
30
5 Error: Add-in not
Add-in not found.
(#ADDIN?) found
31
5
Error: Macro not found Macro not available / not found.
(#MACRO?)
532 The denominator of a division operation ("/") is 0 (zero).
Error: Division by zero
(#DIV/0!) Several functions can also return this error.
Nested arrays are not
533 Nested arrays are not supported.
supported
Invalid size of array. The maximum limit for sorting has
been exceeded. The limit is twice the maximum
Error: Array or matrix number of rows, so for 1,048,576 rows the limit is
538
size 2,097,152 entries. Also obtained whenever a temporary
matrix could not be allocated due to its size
requirement.
Unsupported inline
539 Bad inline array content, non-value/non-string.
array content
A function that requires (re)loading of external sources
External content
540 is encountered and the user has not confirmed
disabled
reloading of external sources yet.
Appendix B Error Codes | 581
Calc Error Functions
The following table is an overview of the most common error functions of LibreOffice Calc. Error
functions are used to handle error conditions in calculations. For example, if a lookup calculation
returns the #N/A error, you can handle the situation with one of the “NA” error functions.
Table 37: Calc functions for handling errors
Function Description
Tests for error conditions, except the #N/A error value, and
returns TRUE or FALSE.
ISERR()
If an error occurs, the function returns a logical or numerical
value.
ISERROR() Returns TRUE if the cell has an error.
Returns TRUE if a cell contains the #N/A error value.(value not
ISNA() available)
If any other error occurs, the function returns FALSE.
NA() Returns the error value #N/A.
Returns a number representing a specific Error type, or the error
[Link]()
value #N/A, if there is no error.
Returns the number corresponding to an error value occurring in
a different cell. With the aid of this number, you can generate a
ERRORTYPE() custom error message text.
If an error occurs, the function returns a logical or numerical
value.
Returns the value if the cell does not contain an error value, or
IFERROR()
the alternative value if it does.
582 | Calc Guide 26.2
Calc Guide
Wo r k i n g Wi t h S p re a d s h e e t s
About this book:
This book is for beginners to advanced users of Calc, the spreadsheet
component of LibreOffice. It covers the main features of Calc, including:
Entering, editing, and formatting data
Functions and formulas to perform complex calculations on data
Statistic analysis, pivot tables and goal seek for decision making
Database functions to arrange, store, and filter data
A wide range of 2D and 3D charts
Macros
And much more
About the authors:
This book was written by volunteers from the LibreOffice community. Profits
from sales of the printed edition will be used to benefit the community.
A PDF version of this book can be downloaded free from: [Link]
[Link]
About LibreOffice:
LibreOffice is the free, libre, and open source personal productivity suite from
The Document Foundation. It runs on Windows, macOS, and GNU/Linux.
Support and documentation is free from our large, dedicated community of
users, contributors and developers.
You too can get involved with volunteer work in many areas: development,
quality assurance, documentation, translation, user support, and more.
You can download LibreOffice Community from:
[Link]
For commercial/enterprise use:
The LibreOffice Enterprise class of applications may look and behave
differently from the Community edition described in this book. For guides to
Enterprise editions of LibreOffice, please refer to the professional partners
that produced them.