Unit-12
Unit-12
MICROSOFT EXCEL
Structure
12.1 Introduction
12.2 Using Formulas, Functions and Macros
12.2.1 Entering Formulas
12.2.2 Entering Date and Time Formulas
12.2.3 Converting Formulas to Values
12.2.4 Inserting Range Names in Formulas
12.3 Entering Functions
12.3.1 Entering Function Manually
12.3.2 Paste Function
12.3.3 Editing Functions
12.4 Macros
12.4.1 Creating and Storing Macros
12.4.2 Running a Macro
12.5 Printing Worksheet Data
12.5.1 Printing an Area
12.5.2 Defining and Deleting a Print Area
12.5.3 Printing Worksheets
12.5.4 Inserting and Removing Page Break
12.5.5 Modifying Page Setup
12.6 Creating Headers and Footers
12.6.1 Using Built-in Headers and Footers
12.6.2 Custom Headers and Footers
12.7 Protecting Data Within Workbooks
12.7.1 Password to Open a File
12.7.2 Password to Modify a File
12.7.3 Creating the Backup Option
12.7.4 Removing Protection and Modification Passwords
12.7.5 Workbook Level Protection
12.7.6 Protection and Security at Worksheet Level
12.7.7 Cell Protection
12.8 Sharing Data With Other Applications
12.8.1 Inserting Pictures into Worksheets
12.8.2 Inserting or Linking to a Worksheet
12.8.3 Embedding an Excel Object in Another Application
12.9 Working With Data Forms Using Lists
12.9.1 Adding Records with Data Forms
12.9.2 Deleting Records with Data forms
12.9.3 Finding Records with Data Form
12.9.4 Sorting Data in a List
12.9.5 Filtering Data in a List
12.9.6 Using the Autofilter
12.9.7 Setting Custom Categories
12.10 Pivot Tables
12.11 Let Us Sum Up
12.12 Check Your Progress Exercise
12.13 Answers to Check Your Progress Exercise 207
Understanding
Computer Applications 12.1 INTRODUCTION
In this unit we will introduce several advanced features of Microsoft Excel. These are
related to using formulas, functions and macros, creating headers and footers in the
worksheet, protecting data within the worksheet, inserting picture into worksheet etc.
One feature which we use quite often in MS Excel is MACRO. Macros automate
fragmentally performed tasks by changing them into a set of keystrokes that are stored
or recorded and are assigned a control key. Whenever the specified control key is used,
the entire operation is performed automatically. You can have macros for formatting
worksheet, report generation and so on.
Objectives
After going through this unit, you will be able to:
use formula, function within the worksheet,
edit functions,
define macros,
print worksheet data,
create headers and footers,
protect data within workbooks, and
share data with other applications.
Check box
The arithmetic operators used in formulas for addition, subtraction, multiplication, division,
+, -, *, / are used respectively. In addition, exponent (^), percentage (%), text operator
(&) and comparison operators like =, <, >, <=, >= are used in formulas.
Most errors occur when the arithmetic operators are not in the proper order of precedence.
Negative (–), Percentage (%), Exponential (^), Multiplication and Division (* and /),
Addition and subtraction (+ and –), joining Text (&), Comparison operators (=,<,>,<=,>=,<>)
i) Is the order of precedence.
Two examples are discussed hereunder:
14+9*5
In this example, multiplication would be performed before addition.
70/2*5
Order of precedence in the example states that multiplication and division operators are
at the same level. Since the division operator is prior to multiplication, seventy would first
be divided by two and then the result of the division would be multiplied by five.
4. Type a name in the Name in workbook text box. There should be no space in ranged
names. The first character of a range name should be a letter or underline.
5. Click on the OK button.
12.2.4 Inserting Range Names in Formulas
You can insert a name into the formula. The steps are:
1. Create a formula that can use the name and type the (=) equal to symbol in a cell.
2. Select the Name option from the Insert menu.
3. Select the Paste option from the Name submenu.
The Paste Name dialog box gets invoked.
1. In the Paste Name drop-down list, select the name you want to insert.
2. Click on the OK button.
3. Enter the rest of the formula and press Enter.
For example, to sum the marks of 25 students, enter the marks of the 25 students in 25
contiguous cells. Give a name to the range of cells namely Marks. Enter the formula
=SUM(in a cell. Select the name option from the Insert menu. Select the Paste option
from the Name submenu. The formula in the cell now becomes =SUM(Marks). Always
complete the formula by adding the closed brackets. Press the Enter key. This shows you
the sum of the marks of the 25 students.
Deleting Range Names
If you change the contents of the range, you may want to change the range name also, or
delete the name if it is no longer suitable for the contents that it contains. To delete a
name, the steps are:
1. Select the Name option from the Insert menu.
Excel automatically inserts the SUM function and selects the cells in the column
above the selected cell.
3. You can also highlight the cell range (including a blank cell in which you want the
total) that you want to sum and then click on the AutoSum button.
Excel automatically calculates the total and displays it.
12.3.2 Paste Function
The Paste Function feature is a convenient way of applying functions to the formulas for
calculations. To use this feature, the steps are:
1. Select the Paste Function button from on the standard toolbar or select the Function
option from the Insert menu. The Paste Function window is displayed in Figure 12.2.
4. Enter the arguments in the display area or click on the cell reference button to go to
the worksheet to select the cells.
5. Click again on the cell reference button to come back to the same formula palette.
6. Press Enter or click on the OK button.
12.4 MACROS
Macros automate frequently performed tasks by changing them into a set of keystrokes
that are stored or recorded and are assigned a control key. Whenever the specified
control key is used, the entire operation is performed automatically. You can have macros
for formatting worksheets, report generations and so on. This feature is time saving,
flexible and very powerful.
Macro recorder is a tool that translates your actions in Visual Basic Applications (VBA)
macro. It works like a tape recorder – when you turn it on, it records everything you do.
Later you can run the macro and all the previously performed actions are repeated.
You can name your macro in the Record macro dialog box as shown below. The name
that you specify should not contain spaces or other punctuation marks, but it can contain
underscores.
You can assign a shortcut key for the macro that you want to record.
You can specify the letter for your shortcut key and use it in conjunction with Ctrl to run
the macro. The latter can be in lower or upper case; for example, you can assign the
Ctrl + r shortcut key combinations for a macro that is recorded for generating reports.
You can store macros in the Store macro in text box. The options available are:
l Personal Macro Workbook – which has the name PERSONAL.XLS. This workbook
opens and is hidden automatically everytime you start Excel.
l The New Workbook – which stores/records the macro in a new workbook that is
created.
2. You can click on the OK button and the macro recording processing begins.
3. You can then perform the actions that you want to record. It is a good practice to
save your workbook and the recorded macro that it contains before running the
macro.
213
Understanding Once you have completed all the necessary actions for storing/recording macros,
Computer Applications you can click on the stop button as shown in Figure below.
You can also select the Stop Recording option from Macro submenu within the
Tools menu option.
3. Give a name to the macro that you want to record and assign m as a shortcut key.
4. Click on OK.
5. In the Excel worksheet, type the Name, Product, Varieties,Total.
6. Type in the rest of the data shown in the sample worksheet.
7. Click on the Stop button, to end the recording process.
8. Clear the data that you have copied on your worksheet.
9. Run the macro by pressing Ctrl+m.
The entire worksheet would be created again for you.
3. In the Print What section of the dialog box, choose the Selection option.
3. Select the Set Print Area from the Print Area submenu as shown in Figure 12.7.
3. If you want to define titles across the top of each page, select the Rows to repeat
at top box. If you want to define titles down the left side of each page, select the
column to repeat at left box.
4. Click on the OK button.
Removing Print Titles
You can remove the print titles by following the steps here under:
1. Select the Page Setup option from the File menu.
2. Select the Header/Footer tab as shown in Figure 12.9.
3. Click on the arrow next to the Header box.
4. Select a header from the drop-down list.
5. Select the data that you want to use as footer from the list.
6. Click on the OK button.
Protection against loss or corruption of worksheet data has always been a matter of
great concern. This important issue has been dexterously dealt by Excel. There are
several levels of protection that can be applied to a workbook.
4. Re-enter the password to proceed in the Confirm Password dialog box and click
on the OK button. The Save As dialog box is displayed again. 219
Understanding 5. Click on the Save button in the Save AS dialog box.
Computer Applications
6. If the Replace Existing File dialog box gets invoked, then click on Yes to implement
password protection.
The Protect Workbook dialog box enlists certain options. These are:
• Structure - prevents changes made to worksheet structure. Deleting, inserting,
renaming, copying, moving, hiding or unhiding sheet is prevented.
• Windows – checks changes made to workbook windows. Windows control button
is hidden and its window functions are deactivated.
• Password (optional) – is for optional passwords which can be upto 255 characters,
including special characters, and is case-sensitive.
The dialog box offers several options. These options allows a user to protect a sheet at
various levels.
• Contents - protects cells and chart items in a worksheet.
• Objects – protects graphic objects on a worksheet.
• Scenarios – prevents changes to scenario definition.
• Password (Optional) – is case-sensitive and can contain 255 characters, which
can include special characters. 221
Understanding HIDING SHEET: You can also hide all or part of the sheet. For this, you can select the
Computer Applications Format, Sheet and Hide options to a hide a worksheet. Unhide the worksheet by selecting
Format, Sheet and Unhide. If the workbook structure is protected, then the Hide and the
Unhide options fail to work. To overcome this, you should first hide the sheets and then
protect the workbook structure. Then unprotect the workbook to unhide the screen.
You can hide rows and columns by selecting the Tools, Row Hide and Format, Column
Hide options, respectively. If you choose Tools, Protection, Protect Sheet command,
then it becomes all the more difficult for the user to unhide the rows and columns.
12.7.7 Cell Protection
Cell protection is sometimes required to keep data in cells secure even when the entire
worksheet in which it resides has been worked on by other users.
You can protect the cells by following the steps:
1. Select the Cells options from the Format menu. The Format Cells dialog box gets
invoked as shown in Figure 12.14.
2. Select the Protection tab.
There are two options available in the dialog box. These are:
Locked – this option does not allow the cells to be changed once the sheet is protected.
Hidden – this option hides the formulas once the sheet is protected.
Scroll
Bar
3. Select a text box and enter the criteria that you want to search. For example, marks
in Maths.
4. Select the Find Next button after you have entered the criteria. If no matches are
found, Excel beeps. Select the Find Previous button if you want to search backwards
in the list to find a match.
5. Select the Close button to clear the dialog box.
12.9.4 Sorting Data in a List
Sorting helps to arrange the data entries in a systematic order. You can sort a data base
or a list by a single or multiple fields in ascending or descending order.
Sorting by a Single Field
To sort a list or a database by a single field, you can:
1. Select any one cell within the database range.
2. Select the sort option from the Data menu. The Sort dialog box gets invoked as
show in Figure 12.19.
You can use the drop-down menu lists for other fields to apply additional filters to your
database. A record must match all the selections that you make in the drop-down list.
Excel immediately hides all those records that do not match the criteria. There are three
options that you can use for special purposes:
• Choose(All) – to cancel the filter defined for the current column (filters in other
columns remain in effect).
• Choose (Top 10) – to apply criteria based on the values in the cells of the current
columns; for example, you can display the top ten records based on their cell values.
• Choose (Custom) – this is to apply complex criteria to your database.
If you select the Top 10 AutoFilter option from the drop-down list, as shown in Figure
12.21 (b) then the Top 10 AutoFilter dialog box gets displayed.
Once you apply the option to your data, then the data gets filtered and gets displayed in
the required format as shown in Figure 12.21 (c)
5. Click on the arrow next to the first box. Select one of the operators from the resulting
list. These include conditions such as Equals, Does not equal, Is greater than, Is
less than, and so on.
6. Click on the arrow of the next box. A drop-down list is displayed. In this list there
are all unique data entries in the current column.
7. Select an entry (to complete the criteria) which you want to compare or enter the
data yourself in the text box.
8. You can repeat the last three steps to specify another criteria in the second row of
the text boxes.
If you specify another criteria, then select either the And or the Or option button to
connect the two criteria.
1. Click on the OK button to apply the custom criteria.
Excel hides all records that do not match the criteria. For example, if you want the
record for which the Name is Yashpal, then you can specify the conditions accordingly in
the custom AutoFilter as shown in Figure 12.22 (b).
The result of this condition is displayed by Excel which hides all those records that do not
228 match the criteria.
Advanced Features of
12.10 PIVOT TABLES Microsoft Excel
Pivot tables enable you to easily summarize and compare data in a list.
They are called pivot tables because you can change their layout by rearranging or
pivoting the row and column headings quickly and conveniently. You can use pivot tables
to create summaries of large amounts of data. You can summarize and rearrange data
specifically for charts with the help of pivot tables. Whenever the pivot tables change,
the chart based on those pivot tables also change. You can also use them for in-depth
data analysis or creating reports.
Using the Pivot Table Wizard
A pivot table can be created with the aid of the Pivot Table Wizard. To use the wizard,
the steps are:
1. Select the Pivot table Report option from the Data menu.
Step 1 of the Pivot Table Wizard dialog box gets invoked as shown in Figure 12.23 (a).
2. Type the range address that is to be specified in the range text box.
3. Click on the Next button.
Step 3 of the Pivot Table Wizard gets invoked as shown in Figure 12.23 (c):
Figure 12.23 (c) : Step 3 Pivot Table Wizard Dialog Box 229
Understanding 4. Click on the Next button.
Computer Applications
5. Indicate whether you want to place the pivot table in a New worksheet or an Existing
Worksheet.
7. You can enter Format and Data options according to your requirements.
The Pivot Table Wizard displays the results in a table on the worksheet [refer to
Figure 12.23 (d)].
233