Chapter 3. LibreOffice Calc

Contents

3.1. Creating a New Document
3.2. Using Formatting and Styles in Calc
3.3. Working With Sheets
3.4. Conditional Formatting
3.5. Grouping and Ungrouping Cells
3.6. Freezing Rows or Columns as Headers
3.7. For More Information

Calc is the LibreOffice spreadsheet and data plotting module. Spreadsheets consist of a number of 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 the data or creates charts from the data to present it graphically. By using DataPilots, you can combine, analyze or compare larger amounts of data.

As with the entire OpenOffice.org suite, Calc can be used across a variety of platforms. It provides a number of exchange formats (including export to PDF documents), and can also read and save files in Microsoft Excel's format. Its interoperability is constantly ameliorated.

This chapter can only introduce some very basic Calc functionalities. For more information and for complete instructions, look at the LibreOffice help or at the sources listed in Section 1.10, “For More Information”.

[Note]VBA Macros

Calc can process many VBA macros in Excel documents; however, support for VBA macros is not yet complete. When opening an Excel spreadsheet that makes heavy use of macros, you might discover that some do not work.

3.1. Creating a New Document

There are two ways to create a new Calc document:

  • From Scratch.  To create a document from scratch, click File+New+Spreadsheet and a new empty Calc document is created.

  • Templates.  To use a template, click File+New+Templates and Documents and open Finances. You can see a list of Spreadsheet templates. Select the one that fits your needs and your new document is created based on the style of your selected template.

Access the individual sheets by clicking the respective tabs at the bottom of the window.

Enter data in the cells as desired. To adjust the appearance, either use the Formatting toolbar or the Format menu—or define styles as described in Section 3.2, “Using Formatting and Styles in Calc” . Use the File menu or the relevant buttons in the toolbar to print and save your document.

3.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.

Procedure 3.1. Creating a Style

  1. Click Format+Styles and Formatting.

  2. In the Styles and Formatting window, click either the Cell Styles or the Page Styles icon from the top of the window.

  3. Right-click in the Styles and Formatting window, then click New.

  4. Specify a name for your style and use the various tabs to set the desired formatting options.

  5. Click OK.

Procedure 3.2. Modifying a Style

  1. Click Format+Styles and Formatting.

  2. In the Formatting and Styles window, click either the Cell Styles or the Page Styles icon.

  3. Right-click the name of the style you want to change, then click Modify.

  4. Change the desired formatting options.

  5. Click OK.

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 Styles and Formatting window.

3.3. Working With Sheets

Sheets are a good method to organize your calculations. For example, the accounting for your business is much clearer if you create a sheet for each month.

To insert a new sheet in your spreadsheet, do the following:

Procedure 3.3. Inserting New Sheets

  1. Select Insert+Sheet... from the main menu. A dialog box opens.

  2. Decide whether the new sheet should be positioned before or after the selected sheet.

  3. If you want to create a new sheet, make sure the New Sheet radio button is activated. Enter the number of sheets and the sheet name. Skip the next step.

  4. If you want to import a sheet from another file, do the following otherwise skip this step:

    1. Select From file and click Browse...

    2. Select the filename and confirm with OK. All the sheet names are now displayed in the list.

    3. Select the sheet names you want to import by holding the Shift key.

    4. Confirm with OK to import the sheet names you selected.

To rename a sheet, right-click a sheet in the sheet tab and select Rename Sheet.

To delete the current sheet, select Edit+Sheet+Delete... and confirm with Delete Sheets. It is possible to delete more than one sheet by holding the Shift key and selecting the sheets you want to delete in the sheet tab. Right-click and choose Delete Sheet and the same dialog box appears. Confirm with Delete Sheets.

3.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.

[Note]Enable AutoCalculate

Before you apply conditional formatting, choose Tools+Cell Contents+Autocalculate. You should see a check mark in front of AutoCalculate.

Proceed as follows:

Procedure 3.4. Using Conditional Formatting

  1. Define a style first. This style is applied to each cell when your condition is true. Use Format+Styles and Formatting... or press F11. For more information, see Procedure 3.1, “Creating a Style”. Confirm with OK.

  2. Select the cell range where you want to apply your condition.

  3. Select Format+Conditional Formatting... from the main menu. A dialog box opens.

  4. Determine your condition. You can define up to three conditions. Each of the three conditions can be enabled or disabled independently. A condition can operate in cell mode or in formula mode:

    Cell Mode

    The condition is tested if it matches a certain cell value. Beside the first pull-down menu, you can select the operator like equal to, less than, greater than, and so forth.

    Formular Mode

    The condition is tested if a certain formular returns true.

  5. Depending on the mode, enter:

    1. Cell Mode.  Select the operator and the value of the cell.

    2. Formular Mode.  Select the function which you want to test.

  6. Choose the style you want to apply when this condition is true or click New Style... to define a new appearance.

  7. Repeat the previous steps, if you need additional conditions.

  8. Confirm with OK.

Now the style of your cells has changed.

3.5. Grouping and Ungrouping Cells

Grouping a cell range helps to fold your spreadsheet into parts. This makes your spreadsheets more readable as you can display only the parts you are currently interested in. It is possible to group rows or columns and nest groups in other groups.

To group a range, proceed as follows:

Procedure 3.5. Grouping a Selected Cell Range

  1. Select a cell range in your spreadsheet.

  2. Select Data+Group and Outline+Group.... A dialog box appears.

  3. Decide if you want to group your selected range as row or as column. Confirm with OK.

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 in 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 Data+Group and Outline+Ungroup.... The line in the margin disappears.

3.6. Freezing Rows or Columns as Headers

If you have a spreadsheet with lots of data, scrolling makes your header usually disappear. LibreOffice locks rows or colums or both so it remains even if you scroll around.

To freeze a single row or a single column, proceed as follows:

Procedure 3.6. Freezing a Single Row or Column

  1. To freeze a row, click on the header of the row in the left strip.

    To freeze a column, click on the header of the column. The header of the column is the strip under the icon bar, labeled as A, B, C and so forth.

  2. Select Window+Freeze. A dark line appears, indicating where the row or column remains.

It is also possible to freeze both, rows and colums. Proceed as follows:

Procedure 3.7. Freezing Row and Column

  1. 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 then click into cell C4.

  2. Select Window+Freeze. A dark line appears, indicating where the row or column remains.

If you want to revert the freezing, select Window+Freeze and the check mark disappears.

3.7. For More Information

http://www.libreoffice.org/get-help/documentation/