Vous êtes sur la page 1sur 63

OUR MISSION

Our mission is to:


Establish a training approach where even computer shy greenhorns
would within the corporate home environment drop that tag of
computer illiterate, and become confident users equipped to dig
deeper on their own,
Have a Training schedule that is cost effective, easily accessible and
pliable to users level of IT exposure and flexible also to users work
schedule,
Have a dynamic training approach that flows with the prevalent IT
trend to update the corporate body of the Dangote Group on
awareness of the current day state of the art on Information
Technology and communication, and
Have an IT training unit in Dangote Group that is in step with the
footprints of similar platforms in technologically advanced countries.

ABOUT THIS MANUAL


This manual covers Microsoft Advanced Level Excel application.
There are enough exercises to help the trainee to consolidate his/her understanding of what
has been discussed in class are included.
Bold prints are used to emphasize standard names and procedures.
Pre-requisite: Microsoft Excel 2010 basics.

ADVANCED EXCEL COURSE OUTLINE

CHAPTER ONE
WORKING WITH CELLS
1.1 INTRODUCTION:
1.2 CELL REFERENCING
1.2.1 Relative reference
1.2.2 Absolute references use of $
1.2.3 Mixed references
1.3 DEFINED NAME
1.3.1 The Scope of a Name
1.3.2 Syntax Rules for Names:
1.4 To Define Name
1.4.1 To Define a name for a cell or cell range on a worksheet by using Name Box
1.4.2 Define a Name by Using a Selection of Cells in the Worksheet
1.4.3 Define a Name by Using the New Name Dialog Box
1.5 Using Defined Names in Formula:
1.6 To Apply a Defined Name
1.7 Manage Names by Using the Name Manager Dialog Box
1.7.1 Sort names
1.7.2 Filter names
1.7.3 Change a Name
1.7.4 Delete one or more names
CHAPTER TWO
CONDITIONAL FORMATTING IN EXCEL
2.1 About Conditional Formatting
2.2 2-Color Scale
2.3 3-Color Scale
2.4 Data Bar
2.5 Icon Sets
2.6 Conditional Formatting Rules:
2.6.1
Conditional Formatting Rules Manager
2.6.2
Change the format of a rule
2.7 Find Duplicate Data in Excel with Conditional Formatting
2.8 Excel Conditional Formatting for a Date:
2.9 How To Remove Conditional Formatting

CHAPTER THREE
HYPERLINKS & OLE
3.1 Working with Hyperlinks
3.2 To Apply Hyperlink
3.2.1 To Remove a Hyperlink
3.3
Object Linking and Embedding
3.3.1
To Embed
3.3.2
To Link
CHAPTER FOUR
DATA MANAGEMENT
4.0
INTRODUCTION
4.1
Rules Guiding Creation of an Excel Table
4.1.1
Create the Table
4.1.2 To Set a Criteria
4.1.3
How to Create a Drop-Down List in an Excel Cell
4.2
Overview: Using a Data Entry Form
4.2.1
Finding the Data Entry Form Button
4.2.2 To open the Data Entry Form
4.2.3
Entering the Records:
4.3
Using the Form's Data Tools
4.3.1
Searching for Records Using One Field Name
4.3.2
Searching for Records Using Multiple Field Names

4.3.3
4.3.3.1
4.3.3.2
4.4
4.5

4.6

4.7

To remove duplicate data records from a database


To remove only those records from the database that match another record exactly:
To remove records from the database that have duplicate data in one or more columns:
Data Validation - Restricting what data can go into a cell
4.4.1
To test out your new error message,
FILTER
4.5.1
The Three Types of Filters
4.5.2
To Filter text
4.5.3 Create Criteria
4.5.4
Filter Numbers
4.5.4.1 How to add one more criteria
4.5.5
Filter Dates Or Times
4.5.5.1 Create criteria
4.5.5.2 How to add one more criteria
4.5.6
To Clear a Filter
PIVOT TABLE
4.6.1
Entering Data into a Pivot Table
4.6.2
To Create the Pivot Table
4.6.3
Adding Data to the Pivot Table
4.6.4
Filtering the Pivot Table Data
4.6.5
Change the Pivot Table Data
CONSOLIDATION
4.7.1
How to Consolidate Data by Position
4.7.2
To Consolidate Data by Category

CHAPTER FIVE
WHAT-IF ANALYSIS
5.1
Using Goal Seek Feature
5.2
Using the Scenario Manager
5.2.1
How to Create a Report from a Scenario
5.3
Data Tables in Excel
CHAPTER SIX
FUNCTIONS
6.1
DATE FUNCTIONS
6.1.1
Excel Date & Time System:
6.1.2
NOW Function:
6.1.3
DATEDIF FUNCTION:
6.1.4
WORKDAY FUNCTION:
6.2
LOGICAL FUNCTIONS
6.2.1
The AND Function
6.2.2
The OR Function
6.3
The IF Function
6.4
Combining the AND and OR Function with the IF Function in Excel
6.5
TEXT FUNCTIONS
6.5.1
String Concatenation
6.5.1.1
LEFT FUNCTION
6.5.1.2
RIGHT FUNCTION:
6.5.1.3
MID FUNCTION:
6.5.1.4
LEN FUNCTION:
6.6.
LOOKUP FUNCTIONS
6.6.1
VLOOKUP
6.6.1.1 The VLOOKUP Dialog Box
6.6.1.2 Excel VLOOKUP Error Messages
6.6.2
FINDING MULTIPLE FIELDS OF INFORMATION WITH THE VLOOKUP FUNCTION
6.6.2.1
Entering the VLOOKUP Array
6.6.3
Creating the VLOOKUP Array Formula
6.6.4
Copying the VLOOKUP Array Formula
6.6.5
Retrieving Data with the VLOOKUP Array Formula
6.6.6
HLOOKUP
6.8
TROUBLESHOOTING FUNCTIONS

CHAPTER SEVEN
MACROS
7.1
Adding the Developer Tab
7.2
Adding a Worksheet Title
7.3
Recording a Macro
7.4
To Run A Macro You Have Recorded:
CHAPTER EIGHT
TEMPLATE & SECURITY & WATERMARK
8.1
Security and Templates
8.2
Working with Templates
8.3
Putting a Watermark on an Excel Document

CHAPTER ONE

WORKING WITH CELLS

1.1 INTRODUCTION:
Microsoft Excel is data sensitive, that is to say Excel distinguishes between numbers, text, currency, dates,
etc, that you enter into it. The reason for this is that Excel will want to know how to process the data you
enter, as different data types may require different processing. Consider, for example, the following
entries made into an Excel worksheet:

Figure 1.1

Of the three columns in Figure 1.1 above, the S/No and Phone No columns are nominal i.e. no
mathematical operation can be performed on them, while only the Cost column are numbers.
1.2 CELL REFERENCING
Cell reference refers to a cell or a range of cells on a worksheet and is used in Excel formulas. There are
two major distinctions:

Relative reference and


Absolute reference.

1.2.1 Relative reference: is based on the relative position of the cell that contains the formula. If the
position of the cell that contains a formula changes, the reference also changes. The copied formula across
rows or down columns, would automatically adjusts. For example, in the worksheet below, if you copy or
fill a relative reference in cell D2 to cell D3, it automatically adjusts from = SUM (A2:B2) to = SUM (A3:B3).

Figure 1.2.1 Relative Reference

Also, from figure 1.2.1 above, you will notice that Division by 0.5 in Column E3:E7 gives #DIV/0! an error
message because of division by zero occurrence. This is because the formula =C2*D2 was copied or filled
using relative reference.
To correct this error, dollar ($) must precede the reference C2 as $C$2 to make it absolute reference, see
next section 1.2.2.
1.2.2 Absolute references use $: Example $A$1. The dollar sign in Absolute Reference holds the cell
position to be static. In absolute reference, if you copy or fill an absolute reference in cell E2 to cell E3, the
absolute cell C2 stays the same in both cells for the formulas: =D2/$C$2 and D3/$C$2. The value 0.5 is
fixed for all the cells in the range, D2:D7, for the multiplication operation.

Absolute Cell Reference

Figure 1.2.1 Absolute Reference

1.2.3 Mixed references: A mixed reference has either an absolute column and relative row, or absolute
row and relative column. An absolute column reference takes the form $A1, $B1, while an absolute row
reference takes the form A$1, B$1, and so on. If the position of the cell that contains the formula changes,
the relative reference is changed but the absolute reference does not change. For example, if you copy or
fill a mixed reference from cell C2 to C3, it adjusts from =$A2/B$2 to =$A3/B$2

Figure 1.2.3 Mixed Cell Reference


reference

1.3 DEFINED NAME


Defined name is a name that represents a cell, range of cells, formula, or constant value. You can create
your own defined name, and Microsoft Office Excel sometimes creates a defined name for you, such as
when you set a print area. A name must always be unique within its scope.

1.3.1 The Scope of a Name


All names have a scope, either to a specific worksheet (also called the local worksheet level) or to the
entire workbook (also called the global workbook level). The scope of a name is the location within which
the name is reChainnized. For example:
1.

If you have defined a name for a range, such as Budget_FY08, and its scope is Sheet1, that name,
if not qualified, is reChainnized only in Sheet1, but not in other sheets. To use a local worksheet
name in another worksheet, you have to qualify it by preceding it with the worksheet name and
the big bang (!). For example:
Sheet1! Budget_FY08

The Worksheet
2.

Big bang The range

If you have defined a name, such as Sales_Dept_Goals, and its scope is the workbook, that name is
reChainnized for all worksheets in that workbook, but not for any other workbook.

1.3.2 Syntax Rules for Names:


1. Valid Characters: The first character of a name must be a letter, an underscore character (_), or a
backslash (\). Remaining characters in the name can be letters, numbers, periods, and underscore
characters.
2. Reserved Letters: You cannot use the letters "C", "c", "R", or "r" as a defined name, because they
are reserved for Excel row or column.
3. Cell references are disallowed: A cell reference such as Z$100 or R1C1 cannot also be a defined
name.
4. Spaces are not allowed. Use the underscore character (_) and period (.) as word separators, such
as, Sales_Tax or First.Quarter.
5. Name length or description: can contain up to 255 characters.
6. Case sensitivity Excel is not case sensitive for defined Names.

1.4

To Define Name
You can define a name by using the:
Name box on the formula bar: This is best used for creating a workbook level name for a
selected range.
Existing row and column labels of a selection of cells: You can use the Create from
Selection command to conveniently create names from existing row and column labels by
using a selection of cells in the worksheet.
New Name dialog box: This is best used when you want more flexibility in creating names,
such as specifying a local worksheet level scope or creating a name comment.

1.4.1 To Define a name for a cell or cell range on a worksheet by using Name Box
1. Select the cell, range of cells, or nonadjacent selections that you want to name.
2. Click the Name box at the left end of the formula bar
3. Type the name that you want to use to refer to your selection.
4. Press ENTER.
1.4.2 Define a Name by Using a Selection of Cells in the Worksheet
You can convert existing row and column labels to names.
1. Select the range that you want to name, including the row or column labels.
2. On the Formulas tab, in the Defined Names group, click Create from Selection.
3. In the Create Names from Selection dialog box, designate the location that contains the labels by
selecting the Top row, Left column, Bottom row, or Right column check box.
Note: A name created by using this procedure refers only to the cells that
contain values and does not include the existing row and column labels.
1.4.3 Define a Name by Using the New Name Dialog Box
Enter the data into appropriate cells as shown in figure 1.4.3 below.

Figure 1.4.2 Define Names Group

Figure 1.4.3

To Define a Name by Using the New Name Dialog Box


8

1. On the Formulas tab, in the Defined Names group, click Define Name. The New Name dialog box
is displayed. See figure 1.43a below.

2. In the New Name dialog box, in the Name box, type the name that you want to use for your
reference. Type JANContr
3. To specify the scope of the name, in the Scope drop-down list box, select Workbook.

Figure 1.4.3a New Name Dialog Box

4. In the Comment box, enter a descriptive comment up to 255 characters. This is optional.
5. In the Refers to box, the current selection is entered by default. To enter other cell references as
an argument, click the Collapse Dialog
(which temporarily shrinks the dialog box), select the
cells on the worksheet, and then click select B2 to B5
6. Click the expand Expand Dialog icon
to open up the New Name Dialog box again
7. Repeat steps 2 to 6 to name the next two columns i.e. FEBContr, MARContr respectively
8. To finish and return to the worksheet, click OK.

1.5 Using Defined Names in Formula:


You can also reference a defined name range in a formula. Refer to figure 3.
To add up column B:
1.
Click cell B6, enter the following formula: =sum(JANContr). See figure 5 below
2.
Press the Enter key.
Note:
9

i.
ii.

In the formula instead of using the cell references, the defined name, JANContr, for the range has
been used.
Instead of typing the full formula in step 2 just type the equality sign, then sum( now locate Use
in Formula command in the Defined Names group of the Formula tab, clicking it drops down a
menu, from the menu select the defined name you wish to use. Excel places it in the formula you
are typing, you can then type ), to complete the formula.

Exercise: Repeat the preceding steps for FEBContr and MARContr, in columns C6 and D6. Use the defined
names to get the grand total in cell E6.

=SUM(JANContr)

Figure 1.5 Using Defined Name in formula


NOTE: Setting up a Named Range is a two-step process. You first:

1.6

Define the Name, and then you


Apply it.

To Apply a Defined Name


To apply your new Name, click cell B6, in figure 1.5 above
On the Define Names group, Click Define
Names and select Apply Names
From the Apply Names dialogue box, select the
name(s) you want and click OK.

When you click OK, Excel removes all the cell


references and replaces them with the Name you
defined:
In the image above, cell B6 will now read:
=SUM (JANcontr) in the formula bar.
Figure 1.6 Apply Name Dialog Box

10

1.7 Manage Names by Using the Name Manager Dialog Box


You can use the Name Manager Dialog box to work with all of the defined names and table names in the
workbook. For example, you may want to find names with errors, confirm the value and reference of a
name, view or edit descriptive comments, or determine the scope, or sort and filter list of names, etc. To
open the Name Manager Dialog box, on the Formulas tab, in the Defined Names group, click Name
Manager. As earlier stated, you can among others, use this dialog box to:

Define a new name

Edit/Change an existing name

Delete an existing name

Sort & Filter existing names.

Figure 1.7 Name Manager Dialog Box

1.7.1 Sort names


To sort the list of names in ascending or descending order, alternately click the column header.

1.7.2 Filter names


Use the commands in the Filter drop-down list to display a subset of names. Selecting each command
toggles the filter operation on or off, which makes it easy to combine or remove different filter
operations to get the results that you want.
To filter the list of names, do one or more of the following:
SELECT:
TO:
Names Scoped To
Worksheet

Display only those names that are local to a worksheet.

Names Scoped To
Workbook

Display only those names that are global to a workbook.

Names With Errors

Display only those names with values that contain errors (such as #REF,
#VALUE, or #NAME).

Names Without Errors

Display only those names with values that do not contain errors.

Defined Names

Display only names defined by you or by Excel, such as a print area.

Table Names

Display only table names.


11

1.7.3 Change a Name


If you change a defined name or table name, all instances of that name in the workbook are also
changed.
1. On the Formulas tab, in the Defined Names group, click Name Manager.
2. In the Name Manager Dialog box, click the name that you want to change, and then click Edit.
3. In the Edit Name dialog box, in the Name box, type the new name for the reference.
4. In the Refers to box, change the reference, and then click OK.
5. In the Name Manager Dialog box, in the Refers to box, change the cell, formula, or constant
represented by the name.

To cancel unwanted or accidental changes, click Cancel

To save changes, click Commit

NOTE

, or press ESC.

, or press ENTER.

The Close button only closes the Name Manager Dialog box.

1.7.4 Delete one or more names


1. On the Formulas tab, in the Defined Names group, click Name Manager.
2. In the Name Manager Dialog box, click the name that you want to change.
3. Select one or more names by doing one of the following:

To select a name, click it.

To select more than one name in a contiguous group, click and drag the names, or press
SHIFT and click the mouse button for each name in the group.

To select more than one name in a noncontiguous group, press CTRL and click the mouse
button for each name in the group.
4. Click Delete. You can also press the DELETE key.
5. Click OK to confirm the deletion.

12

CHAPTER TWO
2.1

CONDITIONAL FORMATTING IN EXCEL

About Conditional Formatting

Conditional formatting can call attention to potential problem areas by highlighting some sensitive
information based on given criteria. For example, you could apply conditional formatting on a range of
cells that contain sales totals; specifying that if any drops below a given amount, the format of the cell
should change and stand out from other cells.
When creating a new formatting rule, several options are available for how you want the formatting to
appear. The following list covers the broad categories for these options, but there are also several
subcategories within each one.
1. Under the Home tab, in the Styles group, click on Conditional Formatting icon to open the drop
down menu.

Figure 2.1 Conditional Formatting

2.2
2-Color Scale
This option allows you to pick two colors, assigning one to the highest value in a selection and the other
to the lowest. Values that fall within the minimum and maximum will be assigned a color that is
somewhere between these two original choices. For example in a 2-color, green and red color scale,
you can specify that higher value cells have a more green color and lower value cells have a more red
color.
Two-Color Scale
1. Select the relevant cells
2. On the Home tab, Styles group, click the arrow next to Conditional formatting and then click
Color Scales
3. Select a two-color scale.
13

2.3

3-Color Scale
Similar to the 2-Color Scale, this option allows you to pick one additional color that will be
associated with the midpoint of your data range.
Three-Color Scale
1. Select the relevant cells
2. On the Home tab, Styles group, click the arrow next to Conditional formatting and then click
Color Scales
3. Select a three-color scale. The top color represents higher values, the middle colors represent
values about the centre and the bottom color represents the lower values.

2.4
Data Bar
Rather than alter the color of an entire cell, the Data Bar option can be chosen if you want to show how
each particular value in your list compares to the rest of the collection.
Format Cells Using Data Bars
Data bars help you see the value of a cell relative to other cells. The length of the data bar
represents the value in the cell. A longer bar represents a higher value (higher sales, higher
production, etc.) and a shorter bar represents a lower value (lower sales, lower production, etc.)
1. Select the relevant cells
2. On the Home tab, Styles group, click the arrow next to Conditional formatting and then click
Data Bars
3. Select a Data Bar icon.
2.5
Icon Sets
With this tool, you can choose a set of graphics and have your formatting rule apply a different icon to
each value in your list based on the group to which the value belongs. For example, you may choose an
Icon Set with four images, and break your data up into quarters.
Format Cells Using an Icon set
The icon sets help you classify data into three to five categories based on threshold values. For
example in the three arrows icon set, the green up represents higher values, the sideways yellow
reps the middle values and the red down arrow reps the lower values.
1. Select the relevant cells
2. On the Home tab, Styles group, click the arrow next to Conditional formatting then click Icon set
3. Select an icon set.
Note: While it is possible to edit the formatting that is applied with conditional formatting, it is not
possible to edit the date options using the Manage Rules option in the Conditional Formatting drop
down list.
2.6
Conditional Formatting Rules:
In previous versions of Excel, you could have a maximum of three conditional formats. There is no such
limit in Office Excel 2010; you may have as many conditional formats as you like.
When you select which kind of condition to create, Office Excel 2010 displays a dialog box that contains
fields and controls you can use to define your rule. To display all your rules, under the Home tab, in the
14

Styles group, click Conditional Formatting. From the menu that appears, click Manage Rules to display
the Conditional Formatting Rules Manager dialog box.

Figure 2.6 Conditional Formatting Rules Manager Dialog Box

2.6.1 Conditional Formatting Rules Manager


The Conditional Formatting Rules Manager enables you to control your conditional formats in the
following ways:
1. Creates a new rule by clicking the New Rule button.
2. Changes a rule by clicking the rule and then clicking the Edit Rule button.
3. Removes a rule by clicking the rule and then clicking the Delete Rule button.
4. Moves a rule up or down in the order by clicking the Move Up or Move Down button.
5. Controls whether Office Excel 2010 continues evaluating conditional formats after it finds a rule to
apply by selecting or clearing a rules Stop If True check box.
6. Saves any new rules and closes the Conditional Formatting Rules Manager by clicking OK.
7. Saves any new rules without closing the Conditional Formatting Rules Manager by clicking Apply.
8. Discards any unsaved changes by clicking Cancel.
NOTE: Clicking the New Rule button in the Conditional Formatting Rules Manager displays the New
Formatting Rule dialog box. The commands in the New Formatting Rule dialog box duplicates the
options displayed when you click the Home tabs Conditional Formatting button.
2.6.2 Change the format of a rule
After creating a rule, you can change the format applied if the rule is true by clicking the rule and then
clicking the Edit Rule button to display the Edit Formatting Rule dialog box. Then in the Edit Formatting
Rule dialog box, click the Format button to display the Format Cells dialog box. After you define your
format, click OK.
It is important that you ensure your conditions are logically consistent and that you enter your
conditions correctly.
15

Figure 2.6.2 Edit Formatting Rule

2.7

Find Duplicate Data in Excel with Conditional Formatting


It is easy to find a variety of duplicate data-formulas, numbers, dates; data records-in Excel using
conditional formatting. Enter the following data into cells A1 to A6:11, 12, 16, 12, 15, 12.

1. Drag select cells A1 to A6 on the spreadsheet.


2. Click on the Home tab.
3. Click on the Conditional Formatting icon on the ribbon to open the drop
down menu.
4. Choose Highlight Cell Rules > Duplicates Values... to open the
conditional formatting dialog box.
5. Select Light Red Fill with Dark Red Text from the list.
6. Click OK to accept the selections and close the dialog box.
7. Cells A2, A4, and A6 should be formatted with a light red background
color and dark red text since all three contain duplicate data-the number
12.

Figure 2.7 Finding Duplicate Data

The same steps can be followed to use conditional formatting to highlight duplicate data records in an
Excel database, as well as duplicate formulas, dates, or other values in your data range.
2.8

Excel Conditional Formatting for a Date:


Excel allows you to easily add formatting so that a date that has past-such as overdue bills is easily
spotted. Similarly, a date in the future can also be highlighted using different background and/or
font colors.
1. Click on cell C1 to make it the active cell.
2. Click on the Home tab.
3. Click on the Conditional Formatting icon on the ribbon to open the drop down menu.
16

4. Choose Highlight Cell Rules > A Date Occurring... to open the conditional formatting dialog box.
5. Click on the down arrow of the date options drop down menu (left side) to open the list.
6. Select In the last 7 days from the list.
7. Click on the down arrow of the format options drop down menu (right side) to open the list.
8. Select Light Red Fill with Dark Red Text from the list.
9. Click OK to accept the changes and close the dialog box.
10. Type yesterday's date in cell C1 and press the ENTER key on the keyboard.
11. Cell C1 should be formatted with a light red background color and dark red text since yesterday's
date occurred within the last seven days.
2.9
How To Remove Conditional Formatting
Step 1: If you only want the formatting removed from a certain collection of cells, a table, or a pivot
table, select that area on the spreadsheet. Otherwise, if you want the formatting removed from
the entire worksheet, dont worry about selecting anything just continue with the next step;
Step 2: From the Home tab, click on the Conditional Formatting icon in the Styles section.
Step 3: Select Clear Rules and then make an additional selection based on which item spreadsheet,
selected cells, table, or pivot table the conditional formatting should be removed from.
After making this selection, the formatting will disappear. However, you can always use the Undo button
to get it back if you find that you made a mistake.

17

CHAPTER THREE

HYPERLINKS & OLE

3.1 Working with Hyperlinks


A hyperlink is a Colored and underlined text or a graphic that you click to go to a file, a location in a file, a
Web page on the World Wide Web, or a Web page on an intranet. It can be seen as a link from a document
that opens another page or file when you click it. You can place Hyperlinks in cells on your spreadsheet,
and when you click the hyperlink, you will go to the worksheet or workbook that the hyperlink points to.
3.2 To Apply Hyperlink
Follow these steps to insert a hyperlink:
We will create a hyperlink that takes us to sheet2 from sheet1 of the same workbook. Open file named
Hyperlink test-data in the ADV XL PR FOLDER; make cell A1 your active cell.
1. From the Insert tab of the Ribbon, in the Link group click Hyperlink. The Insert Hyperlink dialog box is
displayed.
2. In the Text to display textbox type Dangote Academy.
3. In the Link to area of the dialog box click
Place in This Document button.
4. Because A1 is your active cell, you will
see A1 already displayed in the Type the
cell reference text box.
5. In the Or select a place in this document
textbox click Sheet2.
6. Click the Screen Tip button to display
the Set Hyperlink Screen Tip dialog box.
7. In the Screen Tip Text textbox type; click
to view students score
8. Click the OK button.
Figure 3.2 Insert Hyperlink Dialog Box

TIP: To select a cell that has a hyperlink in it without going to the hyperlink destination, click the cell and
hold the mouse button until the pointer becomes a cross, and then release the mouse button.
3.2.1 To Remove a Hyperlink
1. Using the tip given above, make the cell containing the hyperlink the active cell.
2. From the Insert tab of the Ribbon, in the Link group click Hyperlink. The Insert Hyperlink dialog box
is displayed.
3. Click the Remove Link button.
4. Click OK.

18

3.3
Object Linking and Embedding
Object Linking and Embedding (or OLE for short) is a technique used to insert data from one application
to another. We will create a simple spreadsheet to illustrate the process, and place it in to Word document.
When the Excel spreadsheet is edited, the Word version updates itself automatically.
If you do not want the data manipulation in Excel to update in Word, it is called Embedding; but if you do
want the data in Word to be updated, it is called Linking.
3.3.1 To Embed
Enter the data given in the figure below into an Excel spreadsheet, and then do the following:
1.
2.
3.
4.
5.
6.
7.
8.

Select the range of data you just entered.


Click on Copy in the Clipboard Group of the Home Tab
Open MS Word
In the Home tab, under the Clipboard group, click the
dropdown arrow under Paste command icon.
Click Paste Special from the dropdown menu. The
Paste Special dialog box appears, see fig 3.3.1 below.
Click or select Paste option
In the As combo box, click the Microsoft Office Excel Worksheet Object option.
Click the OK button.

Figure 3.3.1 Paste Special Dialog Box


If you make any changes to the data in Excel Worksheet, the data will not be updated in Word because
the data is embedded into the Word document. This is Embed.
3.3.2 To Link
Repeat steps 1 to 5 in 3.3.1 above; then for step 6.
19

6.

Click or select Paste link option to get Figure 3.3.2 below

Figure 3.3.2 Paste Special Dialog Box

Go to the Excel spreadsheet and make some changes then come and view the effect in your MS Word.

Word 2010 has successfully linked the data from Excel 2010. This is called Linking.
You can also link or embed things like Charts or Pivot Tables into Word.

20

CHAPTER FOUR

DATA MANAGEMENT

4.0
INTRODUCTION
This section covers how to create a database in Excel as well as a number of Excel's data tools. The tools
include using a form to simplify data entry, sorting and filtering data, removing duplicate records, and
creating drop down lists.
There are many different types of databases available such as Microsoft Access Databases, Oracle
Databases, MySQL databases and so on; but Microsoft Excel has a form of a database known as database
table; it is a flat file.
To look for specific data within a Microsoft Excel Database or Excel Table we do not use the common
database language of SQL, we use specially written functions written by you and known as criteria.
4.1
Rules Guiding Creation of an Excel Table
To create an excel database we must be guided by some rules:
You must maintain one excel database per worksheet else you get yourself into lots of trouble. If
you need to have multiple excel databases within your workbook simply put each excel database
onto a separate worksheet.
The first row of your database table must contain the field names (or header labels) of the list
and the names must be unique.
The next issue you need to be concerned with is identifying the field names; that is, they should
be of different data types, format, pattern etc to the rest of the database in your list. It is advised
to format the field names in bold to satisfy this requirement.
Around the row and columns of the fields and data there must be a blank row and column. What
this means is that you can still have a heading at the top of the fields, but there must be a blank
row between the heading and the fields as well as along the last column as well. The blank row
rule also applies to the bottom of the list as well.
When you are entering data into your list, every cell in every record must contain some value
even if it is simply blank (a blank value is still considered a value) and each record must contain
the same number of fields. If there is no specific data for a field you simply leave it blank and
move to the next field.
Ensure that when you are entering data into a field that you do not have spaces before the text
or at the end of the text in the field. This can affect the sorting and give funny results.
Upper case and low case characters in the field do not affect the searches or sort orders unless
you specifically tell the Microsoft Excel application it is an issue.
You can also use formulas if required. Formulas can refer to cells within the Excel Database table.
You can edit and format the cells just like any other spreadsheet however the issue you must
consider as a priority is that the field names must have a different format to the rest of the data
in the database table.
4.1.1 Create the Table
Once the data has been entered, it can be converted into a table. To do so:
1. Select the data range to make it active
2. Click on the Home tab.
3. Click on the Format as Table option to open the drop down menu.
21

4.
5.
6.
7.

Choose the blue Table Style Medium 9 option to open the Format as Table dialog box.
While the dialog box is open, the selected range will be surrounded by the marching ants.
If the marching ants surround the correct range of cells, click Ok in the Format as Table dialog box.
If the marching ants do not surround the correct range of cells, drag select the correct range in the
spreadsheet and then click Ok in the Format as Table dialog box.
8. The table should have the drop down arrows added beside each field name and the table rows
should be formatted in alternating light and dark blue.
4.1.2 To Set a Criteria
After setting up your table guided by these rules, you are now ready to interrogate or query the table by
applying criteria.
The easiest way that you can do this is by using the Form dialog box. To get into the Excel Database form
choose Data menu and then choose Form from the drop down menu.
From the Excel Database Form you can simply choose the Criteria button, type the criteria you have for
your data and choose the Find Next button and it will take you to the first record that satisfies the
criteria you are searching for.
4.1.3 How to Create a Drop-Down List in an Excel Cell
1. Select the active cell (s) Click on the Data tab.
2. Click on the Data Validation option to open the menu.
3. Click on the Data Validation in the menu to bring up the dialog box.
4. Click on Settings tab in the dialog box.
5. From the Allow menu choose List.
6. Click on the Source line in the dialog box.
7. Select the desired cells in the spreadsheet. Click OK.
8. A down arrow should appear next to the selected cell (s).
9. When you click on the arrow the drop down list should open to display the options.
4.2
Overview: Using a Data Entry Form
Using Excel's built in data entry form; you can enter data into the Excel database. Forms allow you to:
start a new database table or to add new records to an existing one
scroll through data records one at a time
search for records containing specific information
edit or delete individual records if necessary
4.2.1 Finding the Data Entry Form Button
Microsoft chose not to include the Form button on the ribbon. Therefore the first step to using the data
entry form is to add the Form button to the Quick Access Toolbar so that it can be used. Proceed as follows:
Provide the column headings to be used in your database. You can include up to 32 field names in
the form.
Click on the Form button, and Excel will do the rest
It is a one-time operation. Once added, the Form button remains available on the Quick Access Toolbar.
22

4.2.2 To open the Data Entry Form


1. Click on the form button from the Quick Access Toolbar
2. Clicking on the form button will bring up a message box from Excel containing a number of
options related to adding headings to the form.
3. Since we have already typed in the field names we want to use as headings all we have to do is
Click OK in the message box.
4. The form containing all of the field names should appear on the screen.
4.2.3 Entering the Records:
Once the data headings have been added to the form, adding records to the database is simply a matter
of typing in the data in the correct order into the form fields.

4.3
Using the Form's Data Tools
A major problem with a database is maintaining the integrity of the data as the file grows in size. This
requires:
Fixing data errors or updating individual records and
Deleting obsolete or duplicate records.
The data entry form contains several tools along the right hand side that makes it easy to find and
correct or delete records from the database.
These tools are:
1. The Find Prev and Find Next buttons - these allow you to scroll forward and back through the
database one record at a time.
2. The Delete button - this is used to delete records from the database.
3. The Restore button - This button can be used to undo changes to a record that is being edited.
Occasionally, we make the wrong changes to a record or even edit the wrong record all together.
If so, the restore button can be used to undo those changes.
Note: the restore button only works as long as a record is present in the form. As soon as you
access another record or close the form, the restore button becomes inactive.
4. The Criteria button allows you to search the database for records based on specific criteria, such
as name, age, or program

4.3.1 Searching for Records Using One Field Name


1. Click on the Criteria button in the form. Clicking on the Criteria button clears all the form fields but
does not remove any data from the database.
2. Click on the Program field and type Science as we want to search for all students enrolled in the
Science program at Dangote Academy.
3. Click on the Find Next button.
The Criteria button allows you to search the database for records using one or more field names - such
as name, subject, age, etc.
23

4.3.2 Searching for Records Using Multiple Field Names


In this example we will search for all students who are 18 years of age and enrolled in the Arts program
at the college. Only those records that match both criteria should be displayed in the form.
1. Click on the Criteria button in the form.
2. Click on the age field and type 18.
3. Click on the Program field and type Arts.
4. Click on the Find Next button. The record for H. Thompson should appear in the form since she is
both 18 years old and enrolled in the Arts program.
5. Click on the Find Next button a second time and the record for J. Graham should appear since he
too is both 18 years old and enrolled in the Arts program.
6. Click on the Find Next button a third time and the record for J. Graham should still be visible since
there are no other records that match both criteria.
The record for W. Henderson should not be displayed in this example because, although he is enrolled in
the Arts program, he is not 18 years old so he does not match both of the search criteria.
4.3.3 To remove duplicate data records from a database
Click on any cell in the database.
1. Click the Data tab on the ribbon.
2. Click on the Remove Duplicates icon. Clicking on the icon highlights all data in the database
and opens the Remove Duplicates dialog box.
3. When the dialog box opens, all of the column headings are selected by default.
4.3.3.1 To remove only those records from the database that match another record exactly:
1.
Leave all column headings selected and Click OK.
4.3.3.2 To remove records from the database that have duplicate data in one or more columns:
1. Remove the check marks from those columns you do not want to compare. Click OK
Note: If you remove the wrong data, click the Undo button on the Quick Access toolbar or press CTRL+Z
on the keyboard to get your data back.
Exercise
Add drop down list to columns B and C. column B should contain list of Subjects, and column C, a list of
Grades. Make sure that cells B1 and C1 do not contain drop down lists. When you are done, the Subject
column should look like this:

24

ation

And the Grade column should look like this:

4.4

Data Validation - Restricting what data can go into a

Figure 4.3 Drop down list Exercise

cell
You can restrict what goes in to a cell on your spreadsheet, and display an error message for your users.
This can be done with the Comments column. When a user enters too much text, you can let him know
by displaying a suitable error message. Do this:

Highlight the relevant column on your spreadsheet


From the Data Tools panel, click Data Validation to bring up the dialogue box again
From the Allow list, select Text length:

When you select Text Length from the list, three new areas appear:

Figure 4.4b Data validation

Select Between for Data list box, type 0 for Minimum and 25 for Maximum.
To add an error message, click the Error Alert tab at the top of the Data Validation dialogue box:

25

Make sure there is a tick in the box for


"Show error alert after invalid data is
entered".
You have three different Styles to
choose from for your error message.
Click the drop down to select.
In the Title textbox, type some text for
the title of your error message.
Figure 4.4c Data validation Dialog Box

What we are doing is restricting the amount of text a user can input into any one cell on the Comments
column, to not more than 25 characters.

Now click inside the error message field and type some text for the main body of your error message.
This will tell the user what he or she did wrong:

Click OK on the Data Validation


dialogue box when you are done.
Figure 4.4d

4.4.1 To test out your new error message,


Click inside any cell in your Comments Column. Type a message longer than 25 characters. Press the
enter key on your keyboard. You should see the error message below appear:
As you can see, the user is prompted
to Retry or Cancel.
But our title (Too many characters)
is at the top, our Stop symbol is to
the left, and our Error message is
displaying nicely!
Figure 4.4 E Error Message

26

4.5
FILTER
Filter displays only the rows that meet criteria that you specify and hides the others.
After you filter data, you can copy, find, edit, format, chart, and print the subset of filtered data without
rearranging or moving it. You may also filter by more than one column.
Filters are additive, which means that each additional filter is based on the current filter and further
reduces the subset of data.
Note: When you use the Find dialog box to search filtered data, only the data that is displayed is
searched; data that is not displayed is not searched. To search all the data, clear all filters.
4.5.1 The Three Types of Filters
Using AutoFilter, you can filter by:
List of values,
Format, or
Criteria.
Each of these filter types is mutually exclusive for each range of cells or column table. For example,
1. You can filter by cell color or by a list of numbers, but not by both.
2. You can filter by icon or by a custom filter, but not by both.

Note the filter icon in the column heading:

A drop-down arrow
means that filtering is enabled but not applied.
When you hover over the heading of a column with filtering enabled but not applied, a screen tip
displays "(Showing All)".

A Filter button
means that a filter is applied.
When you hover over the heading of a filtered column, a screen tip displays the filter applied to
that column, such as "Equals a red cell color" or "Larger than 150".

4.5.2 To Filter text


1. Select a range of cells containing alphanumeric data.
2. On the Data tab, in the Sort & Filter group, click Filter.
Click the arrow

in the column header.


Figure 4.5.2 Sort & Filter
Group

Select from a list of text values


In the list of text values, select or clear one or more text values to filter by.

27

The list of text values can be up to 10,000. If the list is large, clear (Select All) at the top, and then
select the specific text values to filter by.

Filter By Format (Color)


1. Select the range of cells containing colored data.
2. On the Data tab, in the Sort & Filter group, click Filter.
3. Click the down arrow
in the column header.
4.
Click on filter by Color
5.
Select a particular Font color to filter by from the list displayed
You can as well choose Automatic option in the drop down menu to filter data with Automatic color
(default color).
4.5.3 Create Criteria
1. Point to Text Filters and then click one of the comparison operator commands,
Or click Custom Filter.
To filter by text that begins with a specific character, select Begins With,
Or to filter by text that has specific characters anywhere in the text, select Contains.
2. In the Custom AutoFilter dialog box, enter text or select the text value from the list.
For example, to filter by text that begins with the letter "J", enter J, or to filter by text that has "bell"
anywhere in the text, enter bell.
If you need to find text that shares some characters but not others, use a wildcard character.
How to use wildcard characters
The following wildcard characters can be used as comparison criteria for text filters.
USE
? (question mark)

TO FIND
Any single character
For example, sm?th finds "smith" and "smyth"
* (asterisk)
Any number of characters
For example, *east finds "Northeast" and "Southeast"
~ (tilde) followed by ?, *, A question mark, asterisk, or tilde
or ~
For example, fy06~? finds "fy06?"
3. Optionally, filter by one more criteria.
How to add one more criteria
1. Do one of the following:
a. To filter the table column or selection so that both criteria must be true, select And.
b. To filter the table column or selection so that either or both criteria can be true, select Or.
2. In the second entry, select a comparison operator, and then in the box on the right, enter text or
select a text value from the list.
4. To reapply a filter after you change the data, click a cell in the range or table, then on the Data tab,
in the Sort & Filter group, click Reapply.
28

4.5.4 Filter Numbers


For Range of cells
Select the range of cells containing numeric data.
On the Data tab, in the Sort & Filter group, click Filter.
For a Table:

Click the down arrow

in the column header.

Select from a list of numbers


In the list of numbers, select or clear one or more numbers to filter by.
Note: To make the AutoFilter menu wider or longer, click and drag the grip handle at the bottom.
Create Criteria
1. Point to Number Filters and then click one of the comparison operator commands or click
Custom Filter. For example, to filter by a lower and upper number limit, select Between.
2. In the Custom AutoFilter dialog box, in the box or boxes on the right, enter numbers or select
numbers from the list.
For example, to filter by a lower number of 25 and an upper number of 50, enter 25 and 50.
3. Optionally, filter by one more criteria.
4.5.4.1
How to add one more criteria
1. Do one of the following:
To filter the table column or selection so that both criteria must be true, select And.
To filter the table column or selection so that either or both criteria can be true, select
Or.
2. In the second entry, select a comparison operator, and then in the box on the right, enter a
number or select a number from the list.
To reapply a filter after you change the data, click a cell in the range or table, and then on the Data
tab, in the Sort & Filter group, click Reapply.
4.5.5 Filter Dates Or Times
Range of cells
1. Select a range of cells containing numeric data.
2. On the Data tab, in the Sort & Filter group, click Filter.
Table
2. Click the arrow in the column header.
Select from a list of dates or times
In the list of dates or times, select or clear one or more dates or times to filter by.
By default, all dates in the range of cells or table column are grouped by a hierarchy of years,
months, and days. Selecting or clearing a higher level in the hierarchy selects or clears all nested
dates below that level. For example, if you select 2006, months are listed below 2006, and days are
listed below each month.

29

4.5.5.1 Create criteria


1. Point to Date Filters
2. Click one of the comparison operator commands (Equals, Before, After, or Between) or click
Custom Filter.
3. In the Custom AutoFilter dialog box, in the box on the right, enter a date or time, select a date
or time from the list, or click the Calendar button to find and enter a date. For example, to
filter by a lower and upper date or time, select Between.
3. In the Custom AutoFilter dialog box, in the box or boxes on the right, enter a date or time,
select dates or times from the list, or click the Calendar button to find and enter a date.
For example, to filter by an earlier date of "3/1/2006" and a later date of "6/1/2006", enter
3/1/2006 and 6/1/2006. Or, to filter by an earlier time of "8:00 AM" and a later time of "12:00
PM", enter 8:00 AM and 12:00 PM.
Dynamic filter: A dynamic filter is one where the criteria can change when you reapply the filter.
1. Click one of the pre-defined date commands. For example, to filter all dates by the current date,
select Today, or by the following month, select Next Month. Click OK.
Notes: The commands under the All Dates in the Period menu, such as January or Quarter 2, filter by
the period no matter what the year. This can be useful, for example, to compare sales by a period
across several years.
This Year and Year to Date are different in the way that future dates are handled. This Year can
return dates in the future for the current year, whereas Year to Date only returns dates up to and
including the current date.
4.5.5.2 How to add one more criteria
To filter the table column or selection so that both criteria must be true, select And.
To filter the table column or selection so that either or both criteria can be true, select Or.
In the second entry, select a comparison operator, and then in the box on the right, enter a
date or time, select a date or time from the list, or click the Calendar button to find and enter
a date.
To reapply a filter after you change the data, click a cell in the range or table, and then on the Data tab,
in the Sort & Filter group, click Reapply.
Filter for blanks or Nonblanks:
You can also apply filter to blanks, this can help show cells with no entries in them.
4.5.6 To Clear a Filter
You can clear a filter for a specific column or clear all filters.
To clear a filter for one column in a multicolumn range of cells or table,

Click the Filter button


on the heading, and then click Clear Filter from <Column Name>.
Clear all filters in a worksheet and redisplay all rows
On the Data tab, in the Sort & Filter group, click Clear.
30

31

4.6
PIVOT TABLE
An Excel pivot table is a versatile reporting tool that makes it easy to extract information from a large
table of data without the use of formulas. A pivot table is extremely user friendly in that by moving, or
pivoting, fields of data from one location to another using drag and drop we can look at the same data in
a number of different ways.
4.6.1 Entering Data into a Pivot Table
The first step in creating a pivot table is to enter the data into the worksheet. When doing so, keep the
following points in mind:
At least three columns of data are needed to create a pivot table.
It is important to enter data correctly. Errors, caused by incorrect data entry, are the source of
many problems related to data management.
Leave no blank rows or columns in between. This includes NOT leaving a blank row between the
column headings and the first row of data see example below.

4.6.1A Pivot Table Data

4.6.2
1.
2.
3.
4.
5.
6.
7.
8.

To Create the Pivot Table


Drag and select cells A2 to D12 to highlight them.
Click on the Insert tab of the ribbon.
Click on the down arrow at the bottom of Pivot Table button to open the drop down list.
Click on Pivot Table in the list to open the Create Pivot Table dialog box. By pre-selecting the data
range A2 to F12, the Table/Range line in the dialog box should be filled in for us.
Choose Existing Worksheet for the location of the pivot table.
Click on the Location line in the dialog box.
Click on cell D16 in the worksheet to enter that cell reference into the location line.
Click OK.

32

A blank pivot table should appear on the worksheet with the top left corner of the pivot table in cell D16.
The Pivot Table Field List panel should open on the right hand side of the Excel window. At the top of the
Pivot Table Field List panel are the field names (column headings) from our data table. The data areas at
the bottom of the panel are linked to the pivot table.

Figure 4.6.1b Pivot Table Field Lists

4.6.2 Adding Data to the Pivot Table


You have two choices when it comes to adding data to the Pivot Table:
Drag the field names from the Pivot Table Field List panel and drop them on the Pivot Table in
the worksheet.
Drag the field names to the bottom of the Pivot Table Field List panel and drop them in the data
areas.
The data areas in the Pivot Table Field List panel are linked to corresponding areas of the pivot table. As
you add the field names to the data areas, your data is added to the pivot table. Depending on which fields
are placed in which data area, different results can be obtained.
Drag the field names to these data areas:
Total Sales to the Report Filter area
Region to the Column Labels area
Sales Rep to the Row Labels area
Orders to the Values area
Once completed, the Pivot Table should have the data laid out in the same order as in the example below.

33

Figure 4.6.2 Pivot Table Data Result

4.6.3 Filtering the Pivot Table Data


The Pivot Table has built in filtering tools that can be used to fine tune the results shown by the Pivot
Table. Filtering data involves using specific criteria to limit what data is displayed by the Pivot Table.
1. Click on the down arrow next to the Region heading in the Pivot Table to open the filter's drop
down list.
2. Click on the check box next to the Select All option to remove the check mark from all the boxes
in this list.
3. Click on the check boxes next to the East and North options to add check marks to these boxes.
Click OK.
The Pivot Table should now show only the order totals for the sales reps that work in the East and North
regions.
4.6.4 Change the Pivot Table Data
To change the results shown by the Pivot Table:
1. Rearrange the pivot table by dragging the data fields from one data area to another in the Pivot
Table Field List panel.
2. Apply filtering to get the desired results.
Drag the field names to these data areas:
Orders to the Report Filter area
Sales Rep to the Column Labels area
Region to the Row Labels area
Total Sales to the Values area

34

3. Click on the down arrow next to the Region heading in the Pivot Table to open the filter's drop down
list.
4. Click twice on the check box next to the Select All option to first add and then remove the check marks
from all the boxes in this list.
5. Click on the check box next to the West option to add a check mark to this box. Click OK.
The Pivot Table should now show the total sales for only those sales reps that work in the West region.

4.7
CONSOLIDATION
You can summarize data from one or more sources by consolidating it into a table. The source areas can
be on the same worksheet as the consolidation table, on different sheets in the same workbook, or in
different workbooks. When you consolidate the source data, you apply a summary function, such as the
SUM() function, to create the summary data. There are three ways to consolidate data:
1. Consolidation by category
2. Consolidation by position
3. Consolidation by PivotTable report.

Consolidation by position: When the data in the source areas is arranged in the same order and uses the
same labels. Use this method to consolidate data from a series of worksheets, such as departmental
budget worksheets that have been created from the same template.
Consolidation by category: When the data in the source areas is not arranged in the same order but uses
the same labels. Use this method to consolidate data from a series of worksheets that have different
layouts but have the same data labels.
You can create a PivotTable report from multiple consolidation ranges. This method is similar to
consolidating by category, but it offers more flexibility to reorganize the categories. The use of PivotTables
will be better covered in the section that deals with Data Management, Pivot Tables.

4.7.1
How to Consolidate Data by Position
To consolidate data by position, follow these steps:
1. Data in Sheet1:

2. Data in Sheet2:

Figure 4.7.1a Consolidation Data

35

Click the upper-left cell of the destination area for the consolidated data. In this example, click cell A1 on
Sheet2.
2. On the Data tab, click Consolidate located in the Data Tools group. The Consolidate dialog box is
displayed.
3. In the Function list, select the summary function that you want Microsoft Excel to use to
consolidate the data. In this example, use Sum.
4. In the Reference box do one of these:
a. Type each source area you want to
consolidate, in this example, type the
first area, Sheet1!$A$1:$C$6.
OR
b. Return to sheet1 and select the range
A1-C6.
5. Then click Add.
6. Repeat steps 4 and 5 for the entire source
areas that you want to consolidate.
7. Under Use labels in, select the Top row check
box and the Left column check box (in this
example, there are labels both on the first
row and also in the left column).
Figure 4.7.1b Consolidate Dialog box
8. Click OK.

4.7.2 To Consolidate Data by Category


1. Type the following data into Sheet1
2. Click the upper-left cell of the destination area for the
consolidated data, which would be cell A1 on Sheet2.
3. On the Data tab, click Consolidate located in the Data
Tools group. The Consolidate dialog box is displayed.
4. In the Function list, select the summary function that
you want Microsoft Excel to use to consolidate the data.
Again we select Sum for this example.
5. In the Reference box do one of these:
6. Type each source area you want to consolidate, In this
example, type the first area, Sheet1!$A$2:$C$6
OR
Figure 4.7.2 Consolidation Data
7. Return to sheet1 and select the range A2-C6.
8. Then click Add.
9. Repeat step 6 to 7 for all source areas you want to consolidate, if there are any.
36

10. Under Use labels in, click to select the Left column check box (in this example, there are labels in the
left column). Click OK.
NOTE:
If you want Microsoft Excel to update your consolidation table automatically when the source data
changes, select the Create links to source data check box.
You cannot create links when source and destination areas are on the same sheet.

37

CHAPTER FIVE

WHAT-IF ANALYSIS

5.1
Using Goal Seek Feature
Goal Seek feature allows you to alter the data used in a formula in order to find out what the results will
be. The different results can then be compared to find out which one best suites your requirements.
Example 1: Goal Seek:
This example first uses the PMT function to calculate the monthly payments for a loan; then it uses Goal
Seek to lower the monthly payment by altering the loan period.
1. Click on cell B5, type the formula: = PMT (B2/12,
B3, -B4) and press the ENTER key. The value
4,349.88 should appear in cell B5 as the current
monthly payment for the loan.
Altering the monthly payment using Goal Seek:
We would like to pay 3,000 every month (not
4,349.88); and we also want to know the number of
monthly installments and the percentage interest that
would translate to.
2. Under Data tab choose What-If Analysis from the ribbon to open the drop down list.
3. Click on Goal Seek... to bring up the Goal Seek dialog box.
4. Click on the Set cell: line.
5. Click on the T0 value: line, type 3000
6. Click on the By changing cell: line, then click on cell B3 since we want to change the monthly
payment by altering the total number of payments to be made. Click OK.
7. At this point, Goal Seek should begin searching for a solution. If it finds one, the Goal Seek
dialog box will inform you that a solution has been found.
8. In this case, the solution is to change the number of payments in cell B3 to 95.25.
9. To accept this solution, click OK in the Goal Seek dialog box and Goal Seek will alter the data in
cell B3.
10. To find a different solution, click Cancel in the Goal Seek dialog box. Goal Seek returns the
value in cell B3 to 60. You are now ready to run Goal Seek again.
Example 2 Goal Seek
Your business currently has a modest profit of N25,000. Then you set yourself a new profit Goal of
N45,000. At the moment, you are selling 1000 items at N25 each. You still want to sell same quantity of
1,000 at a different price for the new target profit of N45,000. The question is, what should the new
price be?

38

Solution:
Create the spreadsheet (A1:D4) below. Please ensure that cells A4 and E4 are formulas =B3*B3 and
E2*E3 respectively because Goal Seek requires formulas in the two fields.
Follow the steps 2 & 3 above
to get the Goal Seek
dialogue box.

You are seeking to hit a


goal (target) that should
show on cell E4 so type E4 in
the Set Cell text box,

In the To value box


enter N45,000 the new
profit goal you desire and
finally

Enter E3 in the By
changing cell box.
Goal Seek Application

Goal Seek will return the Goal Seek Status dialog box as shown above. In our example, it found a
solution and that is stated in the message in the Goal Seek Status dialog box. You can see the former
value in cell E3 has changed to 30 in the table. That means that, to sell 1000 pieces of the items for a goal
profit of N45,000, you have to sell at the rate of N30 apiece.
Exercise 3
As a follow up to exercise 2 above, you had a deliberation with your staff and agreed that a price change
from N25 to N30 is not a wonderful idea, that it may be better to sell more items. However, you still
want a profit of N45 000. Use Goal Seek to find out how many items you will have to sell to meet your
new profit figure.

5.2
Using the Scenario Manager
The scenario manager is one of the features under
the "What-If Analysis" in Excel. They are similar to
data tables in that you are changing values to get
new results.
We will see how they work now, as we tackle a
family budget. So, create the spreadsheet below:
The figure in B12 above is just a SUM function,
and is your total debts. The figure in D3 is how
much you have to spend each month (not a lot!). The
figure in D13 is how much you have left after you
deduct all your debts.

Figure 5.2A Scenario Manager Sample Data

39

With only 4,600Naira spending money left each month, clearly some changes have to be made. We'll
create a scenario to see what effect the various budgets cuts have.
Under Data tab, in the Data Tools group, click What if Analysis and select Scenario Manager from the
menu to get the Scenario Manager dialogue box:
Click the Add button to get the Add Scenario another dialogue box:
Figure 5.2B1 Add Scenario Dialogue Box

Figure 5.2B2 Add Scenario Dialogue Box

The J22 in the image is just whatever cell you had selected when you brought up the dialogue boxes.
We'll change this. First, type a Name for your Scenario in the Scenario Name box. Call it Original Budget.
Excel now needs you to enter which cells in your spreadsheet will be changing. In this first scenario,
nothing will be changing (because it's our original). But we still need to specify which cells will be
changing. Let Us try to reduce the Food bill, the Clothes Bill, and the Phone bill. These are in cells B7 to
B9 in our spreadsheet. So in the Changing Cells box, enter B7:B9
Click OK and Excel will ask you for some values:
We do not want any values to change in this first
scenario, so just click OK. You will be taken back to
the Scenario Manager box. It should now look like
this:
Now that we have one scenario set up, we can add a
second one. This is where we will enter some new
values - our savings.
Figure 5.2c Scenario Values Dialog Box1

Click the Add button again to get the Add Scenario


dialogue box back up. Type a new Name, something like Budget Two. The Changing Cells area should
already say B7:B9. So just click OK.
40

You will be taken to the Scenario Values dialogue box again. This time, we do want to change the values.
Enter the same ones as in the image below:

Figure 5.2C Scenario Values Dialog Box 2

These are the new values


for our Budget. Click OK and you'll be taken back to
the Scenario Manager. This time, you'll have two
scenarios to view:
As you can see, we have our Original Budget, and
Budget Two. With Budget Two selected, click the
Figure 5.2D Scenario Manager Dialog Box
Show button at the bottom. The values in your
spreadsheet will change, and the new budget will be calculated. The image below shows what it looks
like in the spreadsheet:
Click on the Original Budget to highlight it. Then
click the Show button. The first values will be
displayed. Click the Close button when you are
done.
So a Scenario offers you different ways to view a
set of figures, and allows you to switch between
them quite easily.

5.2.1 How to Create a Report from a Scenario


To create a report from your scenarios,
Under Data tab, in the Data Tools group, click
What if Analysis
click Scenario Manager
From the Scenario Manager dialogue box,
click the Summary button to see the
following dialogue box:
Figure 5.2e Scenario Manager Dialog Box & Budget2 Data
What you are doing here is selecting cells to go in
your report. To change the cells, click on your spreadsheet. Click individual cells by holding down the
CTRL key on your keyboard, select cells D3, B12 and D13. If you want to get rid of a highlighted cell, just

41

click inside it again with the CTRL key held down. Click OK when you have selected the cells you want.
Excel will create

Figure 5.2.1 Scenario Summary

5.3
Data Tables in Excel
Data Table helps us to see different results by altering an input cell in a formula. Example; we are going to
alter the interest rate, and see how much a 10,000 loan would cost each month. The interest rate will be
our input cell.
By asking Excel to alter this input, we can quickly see the different monthly payments. We want to know
how much we would pay back each month if the interest was 24% per year. But other banks may be
offering better deals. So we will ask Excel to calculate how much we would pay each month if the interest
rate was 22% a year, 20% a year, or 18% a year.
Make the following entries into an Excel sheet:

Figure 5.3a Data Table Example1

Figure 5.3b Data Table Example2

Click cell D2 and enter the formula, =PMT(B3 / 12, B4, -B5) When you press the enter key on your
keyboard, Excel should give you an answer of 287.68.

42

Now that we have our function in place, we can create an Excel Data Table. First, though, we need to tell
Excel about those other interest rates. It will use these to work out the new monthly payments.
Remember, Excel is recalculating the PMT function. So it needs some new values to calculate with.
We have put the PMT function in cell D2 for a reason. This is one Row up, and one Column to the right of
our first new interest rate of 22%. The new monthly payments are going to go in cells D3 to D5. Excel needs
the table setting out this way.
So that Excel can work out the new totals, you have to highlight both the new values and the Function
you're using. So highlight the cells C2 to D5.
As you can see, the cells C2 to D5 are now highlighted. This includes our new interest rate values in the C
column and our PMT function in cell D2. We can now create an Excel Data Table, which will work out new
monthly payments for us. So do this:
1. Click on the Data tab.
2. Choose What-If Analysis from the Data Tools group of the Ribbon to open the drop down list.
3. Click on Data Table... in the list to bring up the Data Table dialog box.
In the dialogue box, there is only a Row input cell or a Column input cell. We want Excel to fill downwards,
down a column. So we need the second text box on the dialogue box "Column input cell". If we were filling
across in rows, we would use the "Row input cell" text box. The Input Cell for us is the one that contains
our original interest rate. This is the cell you want Excel to substitute. Continue with the steps below:
4. Click inside the Column input cell box and enter B3:
5. Click OK. When you do, Excel will work out the new monthly payments:

Figure 5.3C Data Table Example3

So if we could get an 18 percent interest rate, our monthly payments would be 253.93. If you click inside
any of the cells D3:D5, then look at the formula bar, you will see this:
{=TABLE(,B3)}; Excel has created Table based on the input of cell B3

43

CHAPTER SIX

FUNCTIONS

6.1
DATE FUNCTIONS
6.1.1 Excel Date & Time System:
Excel stores all dates as integers and all times as decimal fractions. With this system, Excel can add,
subtract, or compare dates and times just like any other numbers, and all dates are manipulated by using
this system.
In this system, the serial number 1 represents 1/1/1900 12:00:00 a.m. So;
Jan 1, 1900 = 1
Jan 2, 1900 = 2
Jan 3, 1900 = 3

and so on.

Times are stored as decimal numbers between .0 and .99999, where .0 is 00:00:00 and .99999 is
23:59:59. The date integers and time decimal fractions can be combined to create numbers that have a
decimal and an integer portion. For example, the number 32331.06 represents the date and time
7/7/1988 1:26:24 a.m.
To help you perform complex date and time calculations, Excel includes many built-in date and time
functions.
6.1.2 NOW Function:
Add Today's Date and/or Time to an Excel Spreadsheet
The NOW function, one of Excel's date and time functions, is used to add the current time and date to a
spreadsheet.
The syntax for the NOW function is: = NOW ( )
Note: The NOW function takes no arguments.
Example: Using Excel's NOW Function
1. Click on a cell, e.g. D1 - the location where the results will be displayed.
2. Click on the Formulas tab.
3. Choose Date & Time from the ribbon to open the function drop down list.
4. Click on NOW in the list to bring up the function's dialog box.
5. Click OK.
6. The current time and date should appear in cell D1.
7. When you click on cell D1 the complete function = NOW ( ) appears in the formula bar.
8. If you want cell D1 to show only the current time or date, change the cell's format to show either time
or date only.
6.1.3 DATEDIF FUNCTION:
Counts the Number of Days between Dates in Excel. The DATEDIF function can be used to calculate the
number of days between two dates. An interesting point about DATEDIF is that it is an "undocumented"
function which means it is not listed with other functions under the Formulas tab in Excel 2007 and 2010.
To use the function you must type it manually into a cell on the worksheet rather than using the dialog
44

box method available for other functions. The syntax for the DATEDIF function is: = DATEDIF (start_date,
end_date, unit)
The function has three arguments that need to be entered as part of the function:
start_date - the first or starting date.
end_date - the second or last date.
unit - tells the function to find the number of days ("D"), complete months ("M"), or complete
years ("Y") between the two dates.
The unit argument can also be a combination of days, months, and years:
"YM" - excludes years - calculates the number of months between two dates as if the dates were
in the same year.
"YD" - excludes years - calculates the number of days between two dates as if the dates were in
the same year.
"MD" - excludes months - calculates the number of days between two dates as if the dates were
in the same month and year.
Example
Note: Commas are used as separators between the function's three arguments. Enter the following
dates into cells D1 and D2: 1/30/2012 and 5/18/2012
1.
2.
3.
4.
5.

Click on cell E1 in the spreadsheet - this is where the function will be located.
Type " = datedif " in cell E1.
Type an opening round bracket (after the function name in cell E1.
Click on cell D1 in the spreadsheet to enter the cell reference of the start_date into the function.
Type a comma ( , ) in cell E1 after D1 to act as a separator between the two cell references in the
function.
6. Click on cell D2 in the spreadsheet to enter the cell reference of the end_date into the function after
the first comma.
7. Type a second comma ( , ) in cell E1 following the second cell reference as a second separator.
8. For the unit argument, type the letter D in quotes ("D" ) in cell E1 after the second comma to tell the
function we want to know the number of days between the two dates.
9. Type the closing bracket " ) " .
10. Press the ENTER key on the keyboard.
11. The answer 108 should appear in cell E1 as there are 109 days between January 30th and May 18.
12. If you click on cell C1, the complete function = DATEDIF ( D1 , D2 , "D" ) appears in the formula bar
above the worksheet.
If you get a #NUM! error in the cell where your function is located, it means that the start_date is larger
(later in the year) than the end_date.

45

6.1.4 WORKDAY FUNCTION:


Calculates a Project End Date in Excel
The WORKDAY function can be used to calculate the end date or start date of a project for a given
number of business days. The number of business days cannot include weekend days. Specific holidays
can also be omitted. The syntax for the WORKDAY function is:
= WORKDAY (Start_date, Days, Holidays)
Where Start_date: The start date of the project or time period in question.
Days:
The number of days work on the project occurred after the Start_date.
Holidays: Can be used to exclude one or more dates from the total number of working days
(optional).
Example:
If a 90-day project started on 13th August 2010, with holidays on 20th & 21st Aug. 2012 and also on 1st Oct
2012, use the WORKDAY function to calculate the end date of the project.
Note: The WORKDAY function can also be used to find a date in the past - such as the day work began on
a project. To do so enter a negative number for the Days argument and use the project's end date for the
start_date argument.

6.2
LOGICAL FUNCTIONS
These functions return only a true or false answer. They can be used individually or combined with one
or more other functions.
6.2.1 The AND Function
The AND function is one of Excels Logical functions. Like other logical functions, the AND function gives
only a TRUE or FALSE answer. To determine whether the output will be TRUE or FALSE, the AND function
evaluates at least one mathematical expression located in another cell in the spreadsheet.
The syntax for the AND function is:

= AND (logical-1, logical-2, ... logical-255),


Where logical - refers to the cell reference being checked

Example: The function


= AND (B1 < 100, B2 < 100, B3 < 100)
returned the value of TRUE in C1

Figure 6.2.1
46

6.2.2 The OR Function


The OR function gives only a TRUE or FALSE answer. To determine whether the output will be TRUE or
FALSE, the OR function evaluates at least one mathematical expression located in another cell in the
spreadsheet.
The syntax for the OR function is:

= OR (logical-1, logical-2,...logical-255 )
Where logical - refers to the cell reference being checked. Up to
255 logical values can be entered into the function.

Example:
The function
= OR (B1 > 100, B2 > 100, B3 > 100) returned
TRUE in C1 for the values in B1:B3 because at
least one value satisfies the condition.

Figure 6.2.2

6.3
The IF Function
The IF function, tests to see if a certain condition is true or false. If the condition is true, the function will
carry out one action. If the condition is false, it will carry out a different action.
The syntax for the IF function is:
=IF (logical_test, value_if_true, value_if_false)
Where; logical_test: is a value or expression that is tested to see if it is true or false.
value_if_true: is the value that is displayed if logical_test is true.
value_if_false: is the value that is displayed if logical_test is false.
Consider the following examples:
Example 1:
If for a bagging process, we have; IF (Weight<50, E1+1, D1+1)
It means, if weight is less than 50, add 1 to content of cell E1 else, add 1 to content of cell D1.
Example 2:
A payroll system with an input from the Welfare department built in that demands that when a staffs
total deduction exceeds half of his expected take-home salary, that the system should deduct only three
quarters (not all) of the total deduction. See the IF statement of the logic in cell E2 below:

47

Figure 6.3a IF Function Example

Exercise: 3
Now, get the Insert Function dialogue box, then the Function Arguments dialogue box and repeat the
above payroll exercise by yourself.

Figure 6.3b

48

Exercise 4: This exercise now uses the IF function and applies both relative and absolute cell referencing.
See table below:
Note that:
As the function is copied,
Excel updates the relative
cell references to reflect
the
function's
new
location while keeping the
absolute cell reference the
same.

Figure 6.3c

6.4
Combining the AND and OR Function with the IF Function in Excel
By themselves, the AND and OR function have limited usefulness. By combining them with another
function, such as the IF function, they can increase the capabilities of your spreadsheet.
Example

Figure 6.4a AND & OR


Function Example

Assuming this function is located in cell C1, if all three of these cells (B1, B2, and B3) contains a value
greater than 100, the IF function will show the statement Over Budget in cell C1.
If any of these three cells contain a number less than or equal to 100, the IF function will show the
statement Acceptable in cell C1.
Example Nesting an OR function inside an IF function; enter the following data into an Excel sheet:

Figure 6.4b OR and IF Function Example

Assuming this function is located in cell E1, if any of these three cells (D1, D2, or D3) contains a value
greater than 100, the IF function will show the statement Over Budget in cell E1. If all three cells have
numbers less than or equal to 100, the IF function will show the statement Acceptable in cell E1.
49

6.5

TEXT FUNCTIONS

6.5.1 String Concatenation


The CONCATENATE function is used to join two or more words or text strings together.
See cell F2 in figure 6.5.1 below, it is a
concatenation of cells D2 & E2. The
formula is shown on the formula bar.

Figure 6.5.1 String Concatenation Example

The syntax for the CONCATENATE function is: = CONCATENATE (text1, text2, ... text255 )
Text1, text2, ... text255 can be words, cell references, blank spaces, or numbers. Up to 255 text entries
can be added to the CONCATENATE function. Each entry must be separated by a comma.
6.5.1.1
LEFT FUNCTION
LEFT returns the first character or characters in a text string, based on the number of characters you
specify. It has the following syntax: LEFT(text, [num_chars])

For the formula


LEFT (A1,7) you can
see the formula
that will be
returned to you
here.

6.5.1.2
RIGHT FUNCTION:
RIGHT returns the last character or characters in a text string, based on the number of characters you
specify. It has the following syntax: RIGHT(text,[num_chars])
Now try out the RIGHT function by yourself.
50

6.5.1.3
MID FUNCTION:
MID returns a specific number of characters from a text string, starting at the position you specify, based
on the number of characters you specify.
It has the following syntax: MID(text, start_num, num_chars)
The MID function syntax has the following arguments:
text: Required. The text string containing the characters you want to extract.
start_num: Required. The position of the first character you want to extract in text. The first
character in text has start_num 1, and so on.
num_chars: Required. Specifies the number of characters you want MID to return from text.
Note:
1. If start_num is greater than the length of text, MID returns "" (empty text).
2. If start_num is less than the length of text, but start_num plus num_chars exceeds the length
of text, MID returns the characters up to the end of text.
3. If start_num is less than 1, MID returns the #VALUE! error value.
4. If num_chars is negative, MID returns the #VALUE! error value.
6.5.1.4
LEN FUNCTION:
LEN returns the number of characters in a text string. It has the following syntax: LEN(text)

6.6. LOOKUP FUNCTIONS


6.6.1 VLOOKUP
VLOOKUP stands for vertical lookup, the VLOOKUP function can help you find specific information in large
data tables such as an inventory list of parts or a large membership contact list.
The Lookup Value:
The lookup value is located in the first column of the table of data. After specifying a subject in the first
column, VLOOKUP will then allow you to search for specific information located in the same row as the
subject. The lookup value can be a text string, a logical value (TRUE or FALSE only), a number, or a cell
reference to a value. always use an absolute cell reference for the lookup value.
The Table Array:
The table array is the table of data that the function searches to find your information. The table array
must contain at least two columns of data. The first column contains the lookup values (see previous step).
These values can be text, numbers, or logical values. On this line in the VLOOKUP dialog box enter the
range of cells where the data is located.

51

The Column Index Number: The column index number indicates which column of the table array
contains the data you are after. For example:
If you enter a 1 into the column index number, VLOOKUP returns a value from the first column in
table_array;
If the column index number is 2, it returns a value from the second column in table_array.
The Range Lookup Value:
Note: For help with these instructions, see the image above. The range lookup value is a logical value
(TRUE or FALSE only) that indicates whether you want VLOOKUP to find an exact or an approximate
match to the lookup value.

If TRUE or if this argument is omitted, VLOOKUP will use an approximate match if it cannot find an
exact match to the lookup_value. If an exact match is not found, VLOOKUP uses the next largest
lookup value.
If FALSE, VLOOKUP will only use an exact match to the lookup_value. If there are two or more
values in the first column of table_array that match the lookup value, the first value found is used.
If an exact match is not found, an #N/A error is returned.

Enter the data as seen in the image above into cells D4 to E10. The first column of data (column D) contains
the part names. The second column (column E) the price of each part.
1.
2.
3.
4.
5.
6.

Click on cell D1 and type the title Part Name.


Click on cell E1 and type the title Price.
Click on cell E2 - the location where the results - in this case, the price of a Chain - will be displayed.
Click on the Formulas tab.
Choose Lookup & Reference from the ribbon to open the function drop down list.
Click on VLOOKUP in the list to bring up the function's dialog box.

6.6.1.1 The VLOOKUP Dialog Box


The dialog box has the
following parts: The Lookup
Value, the Table Array, the
Column Index Number, and
The Range Lookup Value.
The data that we enter into the
four blank rows of the dialog
box will form the arguments
for the VLOOKUP function.
These arguments tell the
function what information we
are after
Figure 6.6.1.1 VLOOKUP FUNCTION Arguments Dialog box
and where it should search to find it.
7. Click on the lookup_value line in the dialog box
52

8. Click on cell D2 to add this cell reference to the lookup_value line. This is the cell where we will
type the part name about which we are seeking information.
9. Press the F4 key on the keyboard to make the cell reference absolute.
10. Click on the table_array line in the dialog box.
11. Drag select cells D5 to E10 in the spreadsheet to add this range to the table_array line. This is the
range of data that VLOOKUP will search.
12. Press the F4 key on the keyboard to make the range absolute.
13. Click on the Col_index_num line in the dialog box
14. Type a 2 in this line to indicate that we want VLOOKUP to return information from the second
column of the table array.
15. Click on the Range_lookup line in the dialog box
16. Type the word False in this line to indicate that we want VLOOKUP to return an exact match for the
data we are seeking.
17. Click OK to close dialog box.
18. If you have followed all the steps of this tutorial you will have a complete VLOOKUP function in cell
E2:
=VLOOKUP($D$2,$D$5:$E$10,2,FALSE)
6.6.1.2 Excel VLOOKUP Error Messages
The following error messages are associated with VLOOKUP.
1. #N/A error :
This error is displayed if the lookup value is not found in the first column of the table array.
It will also be displayed if the range for the table array argument is inaccurate. If this argument includes
empty columns on the left of the table array.
2. #REF!: This error is displayed if the column index number argument is greater than the number of
columns in table array.

6.6.2 FINDING MULTIPLE FIELDS OF INFORMATION WITH THE VLOOKUP FUNCTION


VLOOKUP's usefulness can be extended, however, by using it in an array formula which allows you to find
multiple fields of information with one VLOOKUP function. The following steps walk you through creating
and retrieving data with a VLOOKUP array formula.
6.6.2.1
Entering the VLOOKUP Array
Enter the data as seen in Figure 6.6.2 above into cells D4 to G10. If entered correctly the data will be
sorted in ascending order by the first column.
The first column of data (column D) contains the part names. The remaining columns (columns
E to G) contain the information that we will retrieve with the VLOOKUP array formula.
1. Click on cell E2 to make it the active cell. This is where we will start the VLOOKUP array formula.
2. Click on the Formulas tab.
3. Choose Lookup & Reference from the ribbon to open the function drop down list.
4. Click on VLOOKUP in the list to bring up the function's dialog box.
The data that we enter into the four blank rows in the dialog box will form the arguments of the VLOOKUP
function. These arguments tell the function what information we are after and where it should search to
find it.
53

1. Click on the Lookup_value line in the dialog box


2. Click on cell D2 in the worksheet to add this cell reference to the Lookup_value line. This is the cell
where we will type the part name about which we are seeking information.
1. Click on the Table_array line in the dialog box.
2. Drag select cells D5 to G10 in the worksheet to add this range to the Table_array line. This is the range
of data that VLOOKUP will search.
The Column Index Number: The column index number argument (Col_index_num) indicates which
column of the Table_array contains the data you are after.
For example:
If Col_index_num is set to 2, it returns a value from the second column in Table_array.
If you enter a 3 into the Col_index_num, VLOOKUP returns a value from the third column in
Table_array;
The purpose of using VLOOKUP in an array formula is to get one VLOOKUP function to return data from
multiple columns in the database at the same time. To do this we enter a range of numbers for the
Col_index_num surrounded by curly braces: { }
1. Click on the Col_index_num line in the dialog box.
2. Type {2, 3, 4} in this line to indicate that we want VLOOKUP to return information from the second,
third, and fourth columns of the Table_array.
1. Click on the Range_lookup line in the dialog box
2. Type the word False in this line to indicate that we want VLOOKUP to return an exact match for the
data we are seeking.
3. DO NOT click OK to close the dialog box. Even though we have filled in all lines in the dialog box we
must complete the next step in the tutorial to turn VLOOKUP into an array formula.
6.6.3 Creating the VLOOKUP Array Formula
Turning VLOOKUP into an array formula needs to be done before closing the dialog box. Creating an array
formula in Excel is done by pressing the CTRL, SHIFT, and ENTER keys on the keyboard at the same time.
The effect of pressing these keys together is to surround the function - in this case VLOOKUP - with curly
braces: { } indicating that it is now an array formula.
6.6.4 Copying the VLOOKUP Array Formula:
The reason for turning VLOOKUP into an array formula was so we could have it retrieve data from multiple
columns of the database at one time. Even though it is now an array formula, VLOOKUP can still only enter
one item of data per cell. To get multiple pieces of data from the database at one time, the VLOOKUP array
formula must reside in multiple cells, and this is accomplished using copy and paste. In this tutorial we
want it to retrieve data from columns 2, 3, 4 of the database - that is the price, the part number, and the
supplier's name when we enter a part name as the Lookup_value.
1. Click on cell E2 where the VLOOKUP function is located to make it the active cell.
2. Use copy and paste or use the fill handle to copy the VLOOKUP function to cells F2 and G2.
3. If done correctly, cells F2 and G2 should now also contain the #N/A error that is present in cell E2.
1. With the completed dialog box still open from the previous step of this tutorial, press and hold down
the CTRL and SHIFT keys on the keyboard then press and release the ENTER key.
54

2. If done correctly, the dialog box will close and a #N/A error will appear in cell E2 - the cell where we
entered the VLOOKUP function.
3. The #N/A error appears in cell E2 because cell D2 is blank. Cell D2 is where we told VLOOKUP to find
the Lookup_value in step 3 of the tutorial. Once data is added to cell D2, the error will be replaced by
information from the database.
4. Click on any of the cells having the #N/A error, if you entered the VLookup formula correcting the
formula bar will read: {=VLOOKUP(E2,E5:G10,{2,3,4},FALSE)}

6.6.5 Retrieving Data with the VLOOKUP Array Formula


Once the VLOOKUP array formula has
been created and copied to the required
cells it can be used to retrieve information
from the database.
To do so, type the name of the item you
wish to retrieve into the Lookup_value
cell and press the ENTER key on the
keyboard. Once done, each cell
containing the VLOOKUP function should
contain a different piece of data about
the item you were searching for.
VLOOKUP uses the Column Index Number
to determine which item of data should go into each cell.
You should recall that in a VLOOKUP array formula the Column Index Number contains multiple numbers.
The first number in the Column Index Number tells VLOOKUP which column in the database to search for
the first item of data. This data is placed in the first cell where VLOOKUP is located. The next number in
the Column Index Number indicates the column where the second piece of data is located. This data is
placed in the second VLOOKUP cell. The process continues until all numbers in the Column Index Number
have been utilized.
1. Click on cell D2 in your spreadsheet.
2. Type Widget into cell D2 and press the ENTER key on the keyboard.
3. The following information should be displayed in cells E2 to G2:
E2 - 14.76 - the price of a widget
F2 - PN-98769 - the part number for a widget
G2 - Williams. - the name of the supplier for Jack
Exercise:
Test the VLOOKUP array formula further by typing the name of other parts into cell D2 and observing the
results in cells E2 to G2.
6.7
HLOOKUP
Excel's HLOOKUP function, short for horizontal lookup, can help you find specific information in large data
tables such as an inventory list of parts or a large membership contact list.
55

HLOOKUP works much the same Excel's VLOOKUP function. The only difference being that VLOOKUP
searches for data in columns while HLOOKUP searches for data in rows.

Figure 6.7 HLOOKUP Function Sample Data

1. Enter the data as seen in the image above into cells D4 to I5.
The first row of data (row 4) contains the part names.
The second row (row 5) the price of each part.
Cell D1 contains the text Part Name
Cell D2 contains the text Price
Cell E2 contains the HLOOKUP Function
2.
3.
4.
5.

Click on cell E1 in your spreadsheet.


Type Bolt into cell E1 and press the ENTER key on the keyboard.
The price of a bolt - 1.54 - should be displayed in cell E2.
Test the HLOOKUP function further by typing other parts names into cell E1 and comparing the
data returned in cell E2 with the prices listed in cells E5 to I5.

6.8
TROUBLESHOOTING FUNCTIONS
This section exposes students to Excels capabilities in determining the cause of error in the formula
entered into cells.

Figure 6.8A Troubleshooting Functions Sample Data

Given the expression in cell E2, =Mid(C2,3,50)*D2 results in the #VALUE! Error.
Class work: Can anyone in the class, quickly tell us the cause of the error?
You can use Excels Evaluate Formula command to determine the cause of the error as follows:
1. Click the cell containing the error, in this case cell E2
2. Click the Formula tab and from the Formula Ribbon, in the Formula Auditing area, click Evaluate
Formula. The Evaluate Formula dialog box is displayed.
56

Before beginning the formula


evaluation let us study the
Evaluate Formula dialog box.
Notice:
The Reference label, below it is
the cell reference whose
content we are evaluating.
Figure 6.8B Evaluate Formula Dialog Box

Next, is the Evaluation area, which gives you a


preview of
the contents of the cell being evaluated. This is followed below by a notice that reads, To show the result
of the underlined expression, click Evaluate
We now proceed with the evaluation as follows:
3. Click the Evaluate button, the preview area now reads
4. Click Evaluate again, this time it reads:
5. Click Evaluate again, we have
If you have been observant with the content of the preview area, you will notice the source of the error
at this stage. What we have in the preview area is D6,942.25*155.1. Multiplication can only be performed
on numbers, so D6,942.25 is not reChainnized as a number by Excel, hence the error.
6. Click the Evaluate button again and Excel gives the #VALUE! Error.
Using the Evaluate Formula command can help in troubleshooting the source of errors in the formulas
entered into Excel. It requires clicking the Evaluate button a number of times and carefully observing the
result given. Each click of the Evaluate button represents a step in performing the operation specified by
the formula being evaluated.

57

CHAPTER SEVEN
7.1

MACROS

MACROS

When you find yourself repeatedly performing the same actions or tasks in a spreadsheet,
then it is time for you to create a macro. A macro is a recording of each command and
action you perform to complete a task. Then, whenever you need to carry out that task in a
spreadsheet, you just run the macro instead.
Macros can be activated by a couple of keystrokes or by a worksheet button so they are
easy to execute, and, provided they were recorded correctly, they will always carry out the
same steps in the same order with no chance for operator error.
The macro recorder works by recording all keystrokes and clicks of the mouse.
In Excel, all macro - related commands are located under the Developer tab, in the Code
group of the ribbon; if it is not there, follow the steps below to add it.
7.1

7.2

1.
2.
3.
4.
5.
6.
7.

Adding the Developer Tab


Click on the File tab to open the Office Backstage.
Click Options to open the Excel Options dialog box.
Click Customize Ribbon on the Left pane
Form the Choose command from select Popular .
Select the Developer checkbox from Main Tabs area of the dialog box.
Click OK.
The Developer tab should now be visible in the ribbon.
Adding a Worksheet Title
Before we start recording our macro, we need to add the title of the worksheet that
we will be formatting.
Since the title of each worksheet is usually unique to that worksheet, we don't want
to include the title in the macro. Therefore we will add it to the worksheet, before
starting the macro recorder.
1. Click on cell A1 in the worksheet.
2. Type the title: Annual Report For 2012. Press the Enter key on the keyboard.

58

7.3

Recording a Macro
1. Click on the Developers tab.
2. Click on Record Macro in the ribbon
to open the Record Macro dialog box.

There are 4 options in this dialog box:


Macro name - give your macro a descriptive
name. The name must begin with a letter and
spaces are not allowed. Only letters, numbers
and the underscore character are permitted.
a. Shortcut key - (optional) fill in a
letter, number, or other character in
the available space. This will allow you
to run the macro by holding down the
CTRL key and pressing the chosen letter on the keyboard.
b. Store macro in the options are:
i.
This workbook i.e. the macro is available only in this file.
ii.
New workbook - this option opens a new Excel file. The macro is available only
in this new file.
iii.
Personal macro workbook - This option creates a hidden file Personal.xls
which stores your macros and makes them available to you in all Excel files.
c. Description - (optional) enter a description of the macro.
3. Click the OK button in the Record Macro dialog box to start the macro recorder.
4. Click on the Home tab of the ribbon.
5. Drag and select cells A1 to F1 in the worksheet to highlight them.
6. Click on the Merge and Center icon to center the title between cells A1 and F1.
7. Click on the Fill Color icon (looks like a paint can) to open the fill color drop down list.
8. Choose Blue, Accent 1 from the list to turn the background color of the selected cells to
blue.
9. Click on the Font Color icon (it is a large letter "A") to open the font color drop down
list.
10.Choose White from the list to turn the text in the selected cells to white.
11.Click on the Font Size icon (above the paint can icon) to open the font size drop down
list.
12.Choose 16 from the list to change the size the text in the selected cells to 16 point.
13.Click on the Developer tab of the ribbon.
14.Click the Stop Recording button on the ribbon to stop the macro recording.

7.4 To Run A Macro You Have Recorded:


1. Click on the Sheet2 tab at the bottom of the spreadsheet.
2. Click on cell A1 in the worksheet.
3. Type the title: Annual Report For 2012.
59

4. Press the Enter key on the keyboard.


5. Click on the Developer tab of the ribbon.
6. Click the Macros button on the ribbon to bring up the View Macro dialog box.
7. Click on the format titles macro in the Macro name window.
8. Click the Run button.
9. The steps of the macro should run automatically and apply the same formatting steps
applied to the title on sheet 1.
10.At this point, the title on worksheet 2 should resemble the title on worksheet 1.

When you find yourself


repeatedly performing the
same actions or tasks in a
spreadsheet, then it is time
for you to create a macro. A
macro is a recording of each
command and action you
perform to complete a task.
Then, whenever you need to
carry out that task in a
spreadsheet, you just run the
macro instead.
Macros can be activated by a
couple of keystrokes or by a
worksheet button so they are easy to execute, and, provided they were recorded correctly, they will
always carry out the same steps in the same order with no chance for operator error.
The macro recorder works by recording all keystrokes and clicks of the mouse.
In Excel, all macro - related commands are located under the Developer tab, in the Code group of the
ribbon; if it is not there, follow the steps below to add it.

60

CHAPTER EIGHT
8.1

TEMPLATE & SECURITY

Security and Templates

Hiding Spreadsheet Data in Excel 2010

The data that went in to our lists doesn't need to be on show for all to see. You can
hide this text quite easily.

Highlight the columns with your data in it (F, G and H for us)
Click on the Home tab from the top of Excel
Locate the Cells panel
On the Cells panel, click on Format. You'll see the following menu:

Move your mouse down to Hide & Unhide and you'll see a Sub Menu appear:
Click on Hide Columns from the Sub menu. Excel will hide the columns you
selected:
In the spreadsheet above, the columns F to H are no longer visible.
To get them back again, highlight the columns E and I. From the same sub menu,
click Unhide Columns.
8.2 WORKING WITH TEMPLATES
Change an Excel Template
After selection a template, you can change the template and save it for later use.
Make changes to the selected template

61

Figure 8.2 Excel Template

Save the edited template and another template.

Figure 8.2 Save As Dialog Box For Excel Template

1. Click File, Save As, the Save As dialog box is displayed.


2. Select Excel Template from the Save as Type.
3. Enter a File Name for the template
62

4. Click Save.

PUTTING A WATERMARK ON AN EXCEL DOCUMENT


To Insert a Picture as Watermark, follow the steps below.
1.
2.
3.
4.
5.

Click on Insert Tab on the Ribbon and click Header & Footer on the Text Group
Select Picture button on the Header & Footer Elements group
From the Insert Picture Dialog box, select a picture you want to add as water mark and click Insert button
Press the Enter key severally to center the image icon on the sheet
If you want the image to fade out, select the picture icon and click on Format Picture on the Header &
Footer Elements group
6. Then, from the Format Picture Dialog box, select Picture tab and choose Washout color under Image
control.

63

Vous aimerez peut-être aussi