2-Enter Edit Format Data
2-Enter Edit Format Data
Chapter 2
Entering, Editing, and
Formatting Data
Copyright
This document is Copyright © 2005–2012 by its contributors as listed below. You may distribute it
and/or modify it under the terms of either the GNU General Public License
(http://www.gnu.org/licenses/gpl.html), version 3 or later, or the Creative Commons Attribution
License (http://creativecommons.org/licenses/by/3.0/), version 3.0 or later.
All trademarks within this guide belong to their legitimate owners.
Contributors
Barbara Duprey
Jean Hollis Weber
John A Smith
Feedback
Please direct any comments or suggestions about this document to:
[email protected]
Acknowledgments
This chapter is based on Chapter 2 of the OpenOffice.org 3.3 Calc Guide. The contributors to that
chapter are:
Peter Kupfer Andy Brown Stephen Buck
Iain Roberts Hazel Russman Barbara M. Tobias
Jean Hollis Weber Jared Kobos
Entering numbers
Click in the cell and type in the number using the number keys on either the main keyboard or the
numeric keypad.
To enter a negative number, either type a minus (–) sign in front of it or enclose it in parentheses
(brackets), like this: (1234).
By default, numbers are right-aligned and negative numbers have a leading minus symbol.
Entering text
Click in the cell and type the text. Text is left-aligned by default.
Numbers can have leading zeros and still be regarded as numbers (as opposed to
text) if the cell is formatted appropriately. Right-click on the cell and chose Format
Tip Cells > Numbers. Adjust the Leading zeros setting to add leading zeros to
numbers.
Caution
When a number is formatted as text, take care that the cell containing the number
is not used in a formula because Calc will ignore the value.
Different fonts include different special characters. If you do not find a particular
Note special character you want, try changing the Font selection.
Inserting dashes
To enter en and em dashes, you can use the Replace dashes option under Tools > AutoCorrect
Options > Options tab. This option replaces two hyphens, under certain conditions, with the
corresponding dash.
In the following table, the A and B represent text consisting of letters A to Z or digits 0 to 9.
AutoCorrect changes
Automatic correction of typing errors, replacement of straight quotation marks by curly (custom)
quotes, and starting cell content with an uppercase (capital) letter are controlled by Tools >
AutoCorrect Options. Go to the Options or Replace tabs to deactivate any of the features that
you do not want. On the Replace tab, you can also delete unwanted word pairs and add new
ones as required.
AutoInput
When you are typing in a cell, Calc automatically suggests matching input found in the same
column. To turn the AutoInput on and off, set or remove the check mark in front of Tools > Cell
Contents > AutoInput.
A shortcut way to fill cells is to grab the “handle” in the lower right-hand corner of
the cell and drag it in the direction you want to fill. If the cell contains a number, the
Tip number will fill in series. If the cell contains text, the same text will fill in the
direction you chose.
You can also use Edit > Fill > Series to create a one-time fill series for numbers by entering the
start and end values and the increment. For example, if you entered start and end values of 1 and
7 with an increment of 2, you would get the sequence of 1, 3, 5, 7.
In all these cases, the Fill tool creates only a momentary connection between the cells. Once they
are filled, the cells have no further connection with one another.
Click New. The Entries box is cleared. Type the series for the new list in the Entries box (one entry
per line), and then click Add.
This technique overwrites any information that is already in the cells on the other
Caution
sheets—without any warning. For this reason, when you are finished, be sure to
deselect all the sheets except the one you want to edit. (Ctrl+click on a sheet tab
to select or deselect the sheet.)
The validity test options vary with the type of data selected from the Allow list. For example, Figure
8 shows the choices when a cell must contain a cell range.
To provide input help for a cell, use the Input Help page of the Validity dialog (Figure 9). To show
an error message when an invalid value is entered, use the Error Alert page (Figure 10). Be sure to
write something helpful, explaining what a valid entry should contain—not just “Invalid data—try
again” or something similar.
Figure 10: Defining an error message for a cell with invalid data
Editing data 13
Using the keyboard
After selecting the appropriate cell, press the F2 key and the cursor is placed at the end of the
cell. Then use the keyboard arrow keys to move the cursor through the text in the cell.
Formatting data
The data in Calc can be formatted in several ways. It can either be edited as part of a cell style so
that it is automatically applied, or it can be applied manually to the cell. Some manual formatting
can be applied using toolbar icons. For more control and extra options, select the appropriate cell
or cells range, right-click on it, and select Format Cells. All of the format options are discussed
below.
All the settings discussed in this section can also be set as a part of the cell style.
Note See Chapter 4, Using Styles and Templates, for more information.
Formatting numbers
Several different number formats can be applied to cells by using icons on the Formatting toolbar.
Select the cell, then click the relevant icon. Some icons may not be visible in a default setup; click
the down-arrow at the end of the Formatting bar and select other icons to display.
Figure 16: Number format icons. Left to right: currency, percentage, date,
exponential, standard, add decimal place, delete decimal place.
Formatting data 15
For more control or to select other number formats, use the Numbers tab (Figure 17) of the Format
Cells dialog.
• Apply any of the data types in the Category list to the data.
• Control the number of decimal places and leading zeros.
• Enter a custom format code.
The Language setting controls the local settings for the different formats such as the date order
and the currency marker.
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
Tip option in the Font Lists section. For more information, see Chapter 14, Setting Up
and Customizing Calc.
To choose the size of the font, click the arrow next to the Font Size box on the Formatting toolbar.
For other formatting, you can use the Bold, Italic, or Underline icons.
To choose a font color, click the arrow next to the Font Color icon to
display a color palette. Click on the required color.
(To define custom colors, use Tools > Options > LibreOffice > Colors.
See Chapter 14, Setting Up and Customizing Calc, for more information.)
To specify the language of the cell (useful because it allows different
languages to exist in the same document and be spell checked
correctly), use the Font tab of the Format Cells dialog. See Chapter 4 for
more information.
Formatting data 17
Some of the alignment and orientation icons are available only if you have Asian or CTL (Complex
Text Layout) languages enabled (in Tools > Options > Language Settings > Languages). If you
select a non-valid icon from the list, it will not appear on the toolbar.
For more control and other choices, use the Alignment tab (Figure 12) of the Format Cells dialog to
set the horizontal and vertical alignment and rotate the text. If you have Asian languages enabled,
then the Text orientation section shows an extra option (labeled Asian layout mode) under the
Vertically stacked option, as shown in Figure 20.
2) In the Theme Selection dialog, select the theme that you want to apply to the spreadsheet.
As soon as you select a theme, some of the properties of the custom styles are applied to
the open spreadsheet and are immediately visible.
3) Click OK. If you wish, you can now go to the Styles and Formatting window to modify
specific styles. These modifications do not change the theme; they only change the
appearance of this specific spreadsheet document.
Value Highlighting
This function displays cell contents in different colors, depending on type.
Select View - Value Highlighting from the Menu bar, or press Ctrl+F8, to toggle the function on or
off.
Text cells are formatted in black, formulas in green, and number cells in blue, no matter how their
display is formatted. If this function is active, colors that you define in the document will not be
displayed. When you deactivate the function, the user-defined colors are displayed again.
The function may be turned on by selecting Tools > Options > LibreOffice Calc > View and
selecting Value Highlighting in the Display section. Selecting here will apply Value Highlighting
each time you open Calc, which you may not want.
Conditional formatting requires the use of styles. If you are not familiar with styles, please refer to
Chapter 4. An easy way to set up the required styles is to format a cell the way you want it and
click the New Style from Selection icon in the Styles and Formatting window.
After the styles are set up, here is how to use them.
1) In your spreadsheet, select the cells to which you want to apply conditional formatting.
2) Choose Format > Conditional Formatting from the menu bar.
3) On the Conditional Formatting dialog (Figure 23), enter the conditions. Click OK to save.
The selected cells are now set to apply result-dependent formatting.
Parameter field
Enter a reference, value, or formula in the parameter field, or in both parameter fields if you
have selected a condition that requires two parameters. You can also enter formulas containing
relative references.
Cell style
Choose the cell style to be applied if the specified condition matches. The style must have
been defined previously.
See the Help for more information and examples of use.
A maximum of eight rows can be used for the query, including the header row. This
Note equates to the eight arguments of the Standard Filter.
Sorting records
Sorting rearranges the visible cells on the sheet. In Calc, you can sort by up to three criteria, which
are applied one after another. Sorts are handy when you are searching for a particular item, and
become even more powerful after you have filtered data.
In addition, sorting is often useful when you add new information. When a list is long, it is usually
easier to add new information at the bottom of the sheet, rather than inserting rows in the proper
places. After you have added the information, you can sort it to update the sheet.
Highlight the cells to be sorted, then select Data > Sort to open the Sort dialog (Figure
33) or click the Sort Ascending or Sort Descending toolbar buttons. Using the
dialog, you can sort the selected cells using up to three columns, in either ascending
(A-Z, 1-9) or descending (Z-A, 9-1) order.
On the Options tab of the Sort dialog (Figure 34), you can choose the following options.
Case sensitive
If two entries are otherwise identical, one with an upper case letter is placed before one with a
lower case letter in the same position if the sort is descending; if the sort is ascending, then the
entry with an upper case letter is placed after one with a lower case letter in the same position.
Sorting records 27
Include formats
The formatting of a cell is moved with its contents. If formatting is used to distinguish different
types of cells, then use this option.
Direction
Sets whether rows or columns are sorted. The default is to sort by columns unless the selected
cells are in a single column.
bar, or select the Find & Replace icon from the Standard Toolbar.
Cell contents can be formatted in different ways. For example, a number can be
Tip formatted as a currency, to be displayed with a currency symbol. You can see the
currency symbol in the cell, but you cannot search for it.
By default, Calc searches the current sheet. To search through all sheets of the document, click
More Options, then select Search in all sheets option.
Caution Use Replace All with caution; otherwise, you may end up with some highly
embarrassing mistakes. A mistake with Replace All might require a manual, word-
by-word search to fix, if it is not discovered in time to undo it.