Unit 2
Unit 2
Introduction
Data Analysis a is the process to extract useful information for making effective decisions.
The spreadsheet is one of the best software used for data analysis. The spreadsheet
component in LibreOffice known as Calc includes several tools for data analysis.
Consolidating Data
1. Data types of the data which we want to consolidate should be same in all spreadsheet.
2. We should match the labels from all the sheets which are used for consolidating.
3. The first column should be same in all spreadsheet on the basis of which the data is to be
consolidated.
‘Consolidate by’ has two options Row labels and Column labels. Check row label or
column label or both if you want to consolidate it by matching the label.
If Link to source data is checked, then it will keep on updating the data of the Consolidate
sheet automatically if there is any change made in the selected ranges.
Group and Outline in Calc is used to create group of rows and columns together so that
one can collapse (-) to hide it or expand (+) it using a single click on it.
Select the data to be grouped, click on Data>Group and Outline>Group. Choose Rows or
Columns on the basis of which you want to group the data and click OK
NOTE: Shortcut to group data is F12 and to ungroup data is Ctrl + F12.
Subtotals
The Subtotal tool in Calc creates the group automatically and applies common functions
like sum, average on the grouped data. We can use any type of function for each column as
per the requirement of data analysis.
1. Open the spreadsheet and Click on Data menu and choose Subtotals.
2. Choose the column in the Group by list which is to be used for grouping the data.
3. Select the column by clicking the checkbox under Calculate subtotals for to create subtotals.
4. Select the desired function. (By default function is Sum)
5. Click on OK button.
NOTE: Columns should have label (column heading) on which we are applying Subtotal.
After performing subtotal, you can see outline to the left of the row numbers. This outline
shows the hierarchical structure where we can expand or collapse the data by clicking on
‘+’ or ‘-‘sign respectively.
If you want to remove the outline feature then click on Data > Group and Outline >
Remove Outline
What-if Scenarios
What-if scenario is a set of values that can be used within the calculations in the
spreadsheet.
It can be used in the beginning of any project to optimise the output. This tool is used to
predict the output while changing the inputs and thus one can choose the best plan.
1. Select the cells which contains values in the sheet that needs to be changed.
2. Choose Tools>Scenarios.
3. Enter a name for the new scenario.
4. Click on OK button
What-if tool uses Data > Multiple Operations and is a planning tool for what-if questions.
The Multiple Operations tool creates a formula array to display the list of results on a list
of values used in the formula.
This tool uses two arrays of cells, one array contains the input values and the second array
uses the formula and display the result. What-if analysis tool is very helpful to know how
much profit we earn for a particular product for a series of selling units.
1. Enter the data in the cells and then enter a formula to calculate a result from the data
entered.
2. Create an array of input values on the basis of which the output is to be generated.
3. Select the cell range of input array and output array.
4. Click on Data>Multiple Operations
5. Enter the cell address where we applied formula in the dialog box.
6. Enter the address of variable cell.
7. Click on OK
Goal Seek
In general we fill in the values in the cells and then create formula on these values to get the
required result. Goal seek helps in finding out the input for the specific output. for example
A student has received marks in 4 subjects and has to appear for the 5th subject and plans
an aggregate as 70. So, he can use goal seek tool to check how many marks he has to score
in the 5th subject to get the required percentage.
Introduction
Many times, we require to perform repeated tasks such as typing school name, address,
contact numbers with
a specific formatting or apply the same formula at a particular cell for different sheets in a
workbook.
In this chapter, you will learn how to use a macro to automate repeated tasks that are
always performed in the same way over and over again.
Recording a Macro
A macro is a single instruction that executes a set of instructions. These set of instructions
can be a sequence of commands or keystrokes that can be used for any number of times
later.
By default the macro recording feature is turned off when LibreOffice is installed on our
computer.
Macro recording can be enabled by selecting Tools > Options > LibreOffice > Advanced.
Observe the Optional Features. There are two options which are not check marked. Put the
checkmark on the option “Enable macro recording”
Following actions are not recorded in Macro
1. Opening of windows
2. Actions carried out in another window than where the recording was started.
3. Window switching
4. Actions that are not related to the spreadsheet contents. For example, changes made in the
Options dialog, macro organizer, customizing.
5. The macro recorder works only in Calc and Writer.
1. Click on Tools > Macros and then click on the Record Macro.
2. Now start taking actions that will be recorded.
3. Click on “Stop Recording” button to stop the recording of actions.
4. Basic Macros dialog window open to save the Macro.
5. Select the object in the Save Macro to list box.
6. Type the name of the macro and click on Save button.
NOTE: By default the name of the macro is Main and is saved in the Standard Library in
Module1. A Library is a collection of modules which in turn is a collection of macros.
Rules for naming a Macro, Module or a Library:
Running a Macro
Code of a Macro
We can view the code generated for the macros by going to Tools > Macros > Edit Macros.
Choose the macro name from the Object Catalog and the associated code will be visible.
NOTE: The code of a macro begins with Sub followed by the name of the macro and ends
with End Sub. Do not make any changes to the code unless you are aware of the language.
Create a simple Macro using BASIC programming instructions that will display Hello in a
dialog box stored in the Standard module.
1. Open the LibreOffice Basic Macro dialog box using Tools > Macros > Organize Macros > Basic
2. Click on Organizer.
3. From Modules tab, select My Macros folder and click on New button.
4. Give a name to the New Module say ‘Hello’ and click Ok.
5. Select Hello and click Edit to open the Integrated Development Environment (IDE).
6. Type Print “Hello” between Sub Main and End Sub.
7. Run the macro by clicking on Tools>Macro>Run Macro
NOTE: The module can be executed from the IDE by either clicking the Run button or
pressing F5.
Macro as a Function
Suppose we need to perform the same calculation again and again on different sheets and
there is no predefined function for it. In such a situation it will be convenient to create a
macro that performs the calculations. It will save our effort of remembering and typing the
formulas.
When the marks scored by each student in three terminal examinations are stored in three
different sheets T1, T2, T3. Now to generate final result in single result sheet by finding the
addition of marks of each subject, what would be the ideal solution?
Retyping or copying the marks can be one solution but it will be time consuming and also
there are chances of committing typing errors. Instead, the ideal solution will be to find a
way to refer the marks stored in the sheets T1, T2 and T3.
In this manner, there are nearly no chances of errors and if the marks of a subject are
changed, they will be automatically reflected in the final sheet.
In LibreOffice Calc, by default there is only one sheet but we can insert multiple sheets.
There are three ways to insert new sheet.
1. To add a new sheet in the spreadsheet, click on the Add new sheet icon(+) sign located on
the Sheet tab of the spreadsheet
2. Right click anywhere on the sheet tab and select Insert sheet option from the drop-down
list. Insert Sheet dialog box will open as shown below. It gives us a choice to put the new
sheet, after current sheet or before current sheet or assign the name of the sheet etc.
3. Click on Sheet>insert sheet to open Insert sheet dialog box which will help us to insert a
new sheet.
In this section we will learn how to reference cells in other sheets using mouse and
keyboard. Let we understand this by doing the following practical.
To calculate the final marks for English in ‘Result’ sheet, follow the following steps.
1. First copy the Student Name and subject Name from ‘Sheet1’ to ‘Result’ sheet.
3. Now click on the ‘Sheet1’ sheet and click the English Marks for the first student and
write (+) for the next value. Now click on the ‘Sheet2’ sheet and click the English Marks for
the first student as shown below
4. Press Enter key, the total marks of subject English will be displayed in cell B2 of ‘Result’
sheet.
5. Then use fill handle to fill the cells up to the last student’s data. You can copy the same
formula for other subjects
NOTE: Any changes made to marks in ‘Sheet1’ and ‘Sheet2’ sheet will be reflected in the
‘result’ sheet as well. That is how the sheets are linked together
To refer to a cell in another sheet precede the cell reference with a ‘$’ sign. It is then
followed by the name of the sheet in ‘ ’ (single quotes) followed by a . (dot) and then the cell
address. For example, to refer a cell B2 of sheet named Sheet1 we will type: $‛Sheet1’.B2
In above practical, we can directly type the following formula in cell B2 of Sheet named
‘Result’ and then drag the formula to calculate the sum of the marks
=SUM($’Sheet1′.B2 + $’Sheet2′.B2)
OR
=SUM($Sheet1.B2 + $Sheet2.B2)
NOTE: Single quotes (‘ ’) are mandatory if there is a space in the Sheet name like ‘Sheet 1’.
NOTE: To refer to a cell in a different spreadsheet we write in single quotes the path of the
file followed by #$ then the name of the sheet followed by a . (dot) and then the cell address.
For example: ‘file:///C:/Users/ADMIN/Documents/X-A.ods’#$Result.C4
The path of a file has three forward slash ///. A filename can have space within its name
hence single quotes (‘ ‘) are used. It is also possible to insert a sheet from another file. The
From file option of Insert Sheet Dialog box allows us to insert sheet from another file as
well.
Hyperlinks can be used in Calc to jump to a different location from within a spreadsheet to
other parts of the same file or to different files or even to web sites.
A hyperlink can be either absolute or relative. An absolute hyperlink stores the complete
location where the file is stored. So, if the file is removed from the location, absolute
hyperlink will not work. For example: C:\Users\ADMIN\Downloads\try.ods is an absolute
link as it defines the complete path of the file.
A relative hyperlink stores the location with respect to the current location. For example:
Admin\Downloads\try.ods is a relative hyperlink as it is dependent on the current location.
If the complete folder containing the active spreadsheet is moved the relative link will still
be accessible as it is bound to the source folder where the active spreadsheet is stored.
Creating Hyperlinks
4. Then click on the Target button to choose the sheet which is to be hyperlinked. Here in
our case we will select the sheet “Sheet1” as shown above.
6. Enter the text in the Text box to assign the hyperlink to that text.
NOTE: To open the hyperlinked sheet, press the Ctrl key and click on the hyperlinked
word “ResultX-A”, the sheet will be opened in the new window
Editing Hyperlinks
To edit an existing link, place the cursor anywhere in the link. Right click and choose Edit
Hyperlink…, the Hyperlink dialog box will be displayed, where we can do required
changes in the hyperlink.
On clicking the Remove Hyperlink option, the link will be removed from the text.
Linking to External Data
Internet is a rich source of information, which is stored in the form of web pages. The
versatility of a spreadsheet allows us to insert tables from HTML documents into Calc. The
steps for the same are given below
5. A dialog box is displayed to select the language for import. Selecting Automatic shows
data in the same language as in the webpage.
6. From the Available Tables/Ranges list, choose the desired table and click OK. (as shown
below)
NOTE: If you choose HTML_all option, then the entire HTML document is selected.
LibreOffice Calc allows us to link spreadsheet documents with databases and other data
sources. The data source needs to be registered with LibreOffice.
The extension of LibreOffice Base is .odb. To register a data source that is in *.odb format,
follow the steps given below.
1. Select Tools > Options > LibreOffice Base > Databases. The Options – LibreOffice Base-
Databases dialog box appears.
2. Click the New button to open the Create Database Link dialog box.
3. 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.
Ch 7 Share and Review a Spreadsheet
Introduction
A shared spreadsheet is a sheet that can be accessed by more than one user and can allow
them to make changes simultaneously on it. Sharing allows working in collaboration so
that everyone can contribute, make changes and view it.
Sharing Spreadsheet
6. Click on OK button.
NOTE: Once the spreadsheet is saved, the name of the spreadsheet in the title bar will
display (shared) along with the name of the spreadsheet. (as shown below)
4. Remove the check-mark on the check box, “Share this spreadsheet with other users”,
and click on OK button.
When we open a shared spreadsheet, a message will appear that the spreadsheet is in
shared mode and some of the features are not available to use in this spreadsheet
Click on OK button
If you don’t want this warning option to be displayed again, then check the mark in the
checkbox ‘Do not show warning again’.
NOTE: Observe the Edit menu, that shows Undo, Redo, Repeat, Paste, Links to External
files, ImageMap, Object are not available for use.
1. After making the changes in the shared spreadsheet, we should save it before closing the
spreadsheet.
2. If two or more users are working at the same time and the changes do not conflict, then
the message will appear stating that the spreadsheet has been updated.
3. If there is any conflict for the changes, then resolve conflict dialog window will appear.
4. No other user can save the shared spreadsheet during resolving of conflicts.
NOTE: If another user is trying to save the shared document when you are resolving the
conflicts, then he will be notified with a message that the file is locked.
Recording Changes
This feature of LibreOffice Calc provides different ways to record the changes made by one
or other users in the spreadsheet. Steps for recording changes are:
2. Turn Off the feature of Track Changes > Record under Edit menu.
NOTE: The border colour of the cell in which data has been changed turns to red.
In Calc, the comments are automatically added. Also, the author or reviewer can add their
own comments as well.
1. Right click on the cell where you have inserted the comments.
1. Right click on the cell where you have inserted the comments.
1. Right click on the cell where you have inserted the comments.
2. Select the “Show Comment” option from popup menu to display the comment.
1. Right click on the cell where you have inserted the comments.
2. Select the “Hide Comment” option from popup menu to hide the comment.
Formatting comment
1. Right click on the cell where you have inserted the comments.
2. Select the option “Format cell”, which will display the Format Cells dialogue box.
3. Change the font, text colour, fill colour, line colour for the comment box as desired and
click on OK button to apply the changes.
NOTE: Comments can be edited, deleted, show or hide by clicking on Sheet menu > Cell
Comments
It is the final stage before submitting the spreadsheet. In this stage, we will go through the
changes to accept or reject after looking at all the changes made by the team members.
Steps to review changes are:
NOTE: This is used to plan what all changes are to be displayed while reviewing the
spreadsheet.
5. Click on the line and click on Accept or Accept All or Reject or Reject All button to
review the changes.
Merging Documents
If the same spreadsheet is reviewed by different team members and you have two different
versions of the same spreadsheet file. Follow the following steps to merge document.
Comparing Documents
Instead of merging two spreadsheets, we can compare the two spreadsheets by comparing
the documents. Steps to compare the documents are: