11 LibreOffice Calc #
Learn how to work with the LibreOffice spreadsheet module.
Calc is the LibreOffice spreadsheet module. Spreadsheets consist of several sheets, containing cells which can be filled with elements like text, numbers, or formulas. A formula can manipulate data from other cells to generate a value for the cell in which it is inserted. Calc also allows you to define ranges, filter and sort data, and create charts from data to present it graphically. Using pivot tables, you can combine, analyze, or compare larger amounts of data.
This chapter can only introduce some very basic Calc functionality. For more information and for complete instructions, see the LibreOffice application help and the sources listed in Section 9.11, “More information”.
Calc can process many VBA macros in Excel documents. However, support for VBA macros is not complete. When opening an Excel spreadsheet that makes heavy use of macros, you might discover that some do not work.
11.1 Creating a new document #
There are two ways to create a new Calc document:
From scratch. To create a new empty document, click › › .
From a template. To use a template, click › › and set the to . Choose a template from the list and proceed with . Note that by default, LibreOffice does not ship with predefined templates.
Access the individual sheets by clicking their respective tabs at the bottom of the window.
Enter data in the cells as needed. To adjust the appearance, either use the Section 11.2, “Using formatting and styles in Calc”. Use the menu or the relevant buttons in the toolbar to print and save your document.
toolbar or side bar panel, or use the menu—or define styles as described in11.2 Using formatting and styles in Calc #
Calc comes with a few built-in cell and page styles to improve the appearance of your spreadsheets and reports. Although these built-in styles are adequate for many uses, you will probably find it useful to create styles for your own frequently used formatting preferences.
In the sidebar, click F11.
or pressAt the top of the panel
, click either the icon or the icon.Right-click anywhere in the list of styles in the panel
. Then click .Specify a name for the style and use the various tabs to set the formatting options.
When you are done configuring the style, click
.
In the sidebar, click
.At the top of the panel
, click either the icon or the icon.Right-click the name of the style you want to change, then click
.Change the formatting options.
When you are done configuring the style, click
.
To apply a style to specific cells, select the cells you want to format. Then double-click the style you want to apply in the
window.11.3 Working with sheets #
Sheets are a good method to organize your calculations. For example, if you have a business, accounting might be much clearer if you create a sheet for each month.
To insert a new sheet after the last sheet, click the button
next to the sheet tabs at the bottom of the window.To insert one or more new sheets into your spreadsheet from a file or at a specific position at once, do the following:
Right-click a sheet tab and select
. A dialog opens.Decide whether the new sheet should be positioned before or after the selected sheet.
To create a new sheet, make sure the
radio button is activated. Enter the number of sheets and the sheet name. Skip the rest of this step.Alternatively, to import a sheet from another file, do the following:
Select
and click .Select the file name and confirm with
. All the sheet names are now displayed in the list.Select the sheet names you want to import by holding the Shift key and clicking them.
To add the sheet or sheets, confirm with
.
To rename a sheet, right-click the tab of the sheet and select
. Alternatively, you can also double-click the sheet tab.To delete one or multiple sheets, do the following: Select the sheet you want to delete. To select more than one sheet, hold down Shift while making the selection. Then right-click the tab of the sheet, choose and confirm with .
11.4 Conditional formatting #
Conditional formatting is a useful feature to highlight certain values in
your spreadsheet. For example, define a condition and if the condition is
true
, a style is applied to each cell that fulfills this
condition.
Before you apply conditional formatting, choose
› › . You should see a check mark in front of .Define a style first. This style is applied to each cell when your condition is
true
. Use › or press F11. For more information, see Procedure 11.1, “Creating a style”. Confirm with .Select the cell range where you want to apply your condition.
Select
› › from the menu. A dialog opens.You now see a template for a new condition. Conditions can operate in multiple modes:
The condition tests if a cell matches a certain value. Next to the first drop-down box, select an operator such as
, , or .The condition tests if a certain formula returns
true
.The condition tests if a certain date value is reached.
This mode allows creating data visualizations that depend on the value of a cell, similarly to
. However, with , you can use one condition to apply an entire range of styles.The types of styles that can be used are color scales (cell background color), data bars (bars with changing width in the cell) and icon sets (an icon in the cell).
For example, a color scale allows assigning
0
a black background and100
a green background. All values in between are calculated automatically. For example,50
receives a dark green background.
For this example, keep the default:
.Select an operator and the value of the cell you want to test for.
Choose the style you want to apply when this condition is
true
or click to define a new appearance.If you need additional conditions, click
. Then repeat the previous steps.Confirm with
. Now the style of your cells has changed.
11.5 Grouping and ungrouping cells #
Grouping a cell range allows hiding parts of a spreadsheet. This makes spreadsheets more readable, as you can hide all the parts you are not currently interested in. It is possible to group rows or columns and nest groups in other groups.
To group a range, proceed as follows:
Select a cell range in your spreadsheet.
Select
› › . A dialog appears.Decide if you want to group your selected range by rows or by columns. Confirm with
.
After grouping selected cells, a line indicating the grouped cell range appears in the upper-left margin. Fold or unfold the cell range with the
and icons. The numbers at the top left of the margins display the depth of your groups and can be clicked too.To ungroup a cell range, click into a cell which belongs to a group and select
› › . The line in the margin disappears. The innermost group is always deleted first.11.6 Freezing rows or columns as headers #
If you have a spreadsheet with lots of data, scrolling usually makes the header disappear. LibreOffice can lock rows or columns or both, so they remain fixed as you scroll around.
To freeze a single row or a single column, proceed as follows:
To create a frozen area before a row, click the header of the row (
1
,2
,3
, ...).Alternatively, to create a frozen area above a column, click the header of the column (
A
,B
,C
, ...).Select
› . A dark line appears, indicating the frozen area.
It is also possible to freeze both rows and columns:
Click into the cell to the right of the column and below the row you want frozen. For example, if your header occupies the space from A1 to B3, click cell C4.
Select
› . A dark line appears, indicating which area is frozen.
To unfreeze, select
and uncheck . The check mark before the menu item disappears.