Вы находитесь на странице: 1из 0

Microsoft Excel 2000

Level 4

Vicon Learning Systems Page i

ABOUT VICON
Vicon Learning Systems (VLS), the parent company of J axWorks.com, provides computer
training products and services with a focus on helping its customers improve productivity through
the successful implementation of technology.

The training materials are for the students' use both during the self-administered course and as a
reference guide.

For more information and a list of other available products, please visit us at our web site at
www.jaxworks.com.
COPYRIGHT & TRADEMARKS
Copyright

2004 by Vicon Learning Systems. All rights reserved. Information in this document
is subject to change without notice and does not represent a commitment on the part of Vicon
Learning Systems.

Trademarked names appear throughout this book. Rather than list the names and entities that own
the trademarks or insert a trademark symbol with each mention of the trademark name, Vicon
Learning Systems states that it is using the names for editorial purposes and to the benefit of the
trademark owner with no intention of infringing upon the trademark.
DISCLAIMER
Vicon Learning Systems made every effort to ensure the accuracy of this manual. If you should
discover any discrepancies, please notify us immediately at:

www.jaxworks.com/feedback




Vicon Learning Systems Page iii

EXCEL 2000 LEVEL 4

ABOUT VICON.......................................................................................................... I
COPYRIGHT & TRADEMARKS............................................................................ I
DISCLAIMER ............................................................................................................ I
LESSON 1 - USING OTHER FUNCTIONS...........................................................1
Using Function Arguments.......................................................................................2
Using Financial Functions........................................................................................2
Using Logical Functions...........................................................................................5
Using Date Functions...............................................................................................9
Formatting Dates....................................................................................................11
Revising Formulas..................................................................................................12
Exercise..................................................................................................................14
Using Other Functions.......................................................................................14
LESSON 2 - USING RANGE NAMES..................................................................17
Working with Range Names..................................................................................18
J umping to a Named Range....................................................................................18
Assigning Names....................................................................................................20
Using Range Names in Formulas...........................................................................21
Creating Range Names from Headings..................................................................22
Applying Range Names..........................................................................................24
Deleting Range Names...........................................................................................27
Using Range Names in 3-D Formulas....................................................................28
Creating 3-D Range Names....................................................................................30
Using 3-D Range Names in Formulas....................................................................32
Exercise..................................................................................................................35
Using Range Names...........................................................................................35
LESSON 3 - USING ADVANCED FUNCTIONS ................................................37
Using Lookup Functions........................................................................................38
Using the VLOOKUP Function.............................................................................38
Using the HLOOKUP Function.............................................................................41
Using the IF Function.............................................................................................44

Page iv Vicon Learning Systems

Using Nested IF Functions.....................................................................................47
Using the ISERROR Function................................................................................50
Using an AND Condition with IF...........................................................................53
Using an OR Condition with IF..............................................................................55
Using the ROUND Function..................................................................................57
Limiting the Precision of Numbers........................................................................59
Exercise..................................................................................................................61
Using Advanced Functions................................................................................61
LESSON 4 - USING DATA TABLES....................................................................63
Using Data Tables..................................................................................................64
Placing Formulas in Data Tables............................................................................64
Creating a One-Variable Table...............................................................................65
Creating a Two-Variable Table..............................................................................67
Exercise..................................................................................................................70
Using Data Tables..............................................................................................70
LESSON 5 - USING MACROS..............................................................................71
Defining Macros.....................................................................................................72
Opening a Workbook Containing Macros..............................................................72
Running a Macro....................................................................................................74
Using a Shortcut Key..............................................................................................76
Using the Visual Basic Toolbar..............................................................................77
Opening the Visual Basic Editor Window.............................................................78
Using the Visual Basic Editor Window..................................................................80
Exercise..................................................................................................................83
Using Macros.....................................................................................................83
LESSON 6 - RECORDING MACROS..................................................................85
Recording a Macro.................................................................................................86
Assigning a Shortcut Key.......................................................................................88
Using Relative References......................................................................................90
Assigning a Macro to a Menu................................................................................91
Deleting a Macro from a Menu..............................................................................94
Deleting a Macro....................................................................................................95
Exercise..................................................................................................................97
Recording Macros..............................................................................................97

Vicon Learning Systems Page v

LESSON 7 - EDITING MACROS .........................................................................99
Writing a New Macro...........................................................................................100
Entering Macro Comments...................................................................................101
Copying Macro Commands..................................................................................102
Editing Macro Commands....................................................................................105
Typing Macro Commands....................................................................................107
Running a Macro from the Code Window...........................................................109
Exercise................................................................................................................111
Editing Macros.................................................................................................111
LESSON 8 - USING CUSTOM TOOLBARS AND BUTTONS .......................113
Creating a Custom Toolbar ..................................................................................114
Adding a Button to a Toolbar...............................................................................115
Adding a Custom Button......................................................................................117
Assigning a Macro to a Button.............................................................................118
Changing a Button Image.....................................................................................119
Displaying Button Text and Images.....................................................................121
Attaching a Custom Toolbar ................................................................................122
Deleting a Custom Toolbar ..................................................................................124
Exercise................................................................................................................126
Using Custom Toolbars and Buttons................................................................126
LESSON 9 - CREATING A MACRO BUTTON................................................127
Using a Macro Button..........................................................................................128
Creating a Macro Button......................................................................................128
Copying a Macro Button......................................................................................130
Formatting a Macro Button..................................................................................132
Moving/Sizing a Macro Button............................................................................133
Deleting a Macro Button......................................................................................135
Exercise................................................................................................................137
Creating a Macro Button..................................................................................137
LESSON 10 - USING WORKSHEET PROTECTION......................................139
Unlocking Cells in a Worksheet...........................................................................140
Protecting a Worksheet.........................................................................................141
Unprotecting a Worksheet....................................................................................143
Protecting Workbook Windows...........................................................................144

Page vi Vicon Learning Systems

Unprotecting Workbook Windows.......................................................................146
Assigning a Password...........................................................................................147
Opening a Protected File......................................................................................149
Removing a Password..........................................................................................150
Setting Manual Calculation..................................................................................151
Setting Automatic Calculation..............................................................................153
Exercise................................................................................................................155
Using Worksheet Protection.............................................................................155
INDEX......................................................................................................................157


LESSON 1 -
USING OTHER FUNCTIONS
In this lesson, you will learn how to:
Use function arguments
Use financial functions
Use logical functions
Use date functions
Format dates
Revise formulas
Lesson 1 - Using Other Functions Microsoft Excel Level 4
Page 2 Vicon Learning Systems

USING FUNCTION ARGUMENTS
Discussion
Excel functions serve as shortcuts for worksheet computations. A function is a
prewritten formula that takes a value or set of values, performs some operation on
them, and returns a value. Functions simplify and shorten formula creation by
performing lengthy or complex calculations with a single command.

The values that a function uses to perform a calculation are called arguments.
Arguments can consist of cell addresses, values, text, cell names, or a combination of
these items. Other functions can also be used as arguments, which is known as nesting
functions. Functions may include a single set of parentheses containing the function
arguments, or arguments may appear in several sets of parentheses.

The syntax of a function is the procedure needed to create the calculation. The syntax
includes the function name and the arguments needed, in their proper order. The Paste
Function dialog box provides the most accurate method of creating a function that
contains several arguments. This dialog box allows you to browse functions and view
an explanation of each function. When you select the desired function, the Formula
Palette dialog box opens, which guides you through creating the arguments in their
proper order.



Functions can use text as an argument. When text is used in a
function, it is enclosed in quotation marks.


USING FINANCIAL FUNCTIONS
Discussion
Excel organizes its functions into categories. The Financial category includes a large
number of functions that can be used to create calculations such as the payment on a
loan, the interest rate on an investment or loan, the interest payment on an investment
over time, and the future value of an annuity or investment.

Financial functions include arguments that must be entered in the proper order. Most
financial functions include required arguments and additional optional arguments. The
definitions of some common financial functions and the syntax of their required
arguments are listed in the following table:

Microsoft Excel Level 4 Lesson 1 - Using Other Functions
Vicon Learning Systems Page 3

Function Syntax
PMT (Payment) calculates the payment on a
loan, such as a mortgage, based on a constant
interest rate payment.
=PMT(rate,nper,pv)
FV (Future Value) calculates the value an
annuity will be worth given a series of
payments invested at an interest rate over a
specified period.
=FV(rate,nper,pmt)
PV (Present Value) calculates the current value
of a series of payments.
=PV(rate,nper,pmt)
RATE calculates the interest rate of periodic
payments to an annuity or loan.
=RATE(nper,pmt,pv)

Some of the common arguments required by financial functions are defined in the
following table:

Arguments Definition
rate The amount of interest charged yearly for a loan or
investment. The interest can be entered as a decimal or
percentage. For example, 10% can be entered as 0.1 or
10%.
nper The number of payments it will take to repay the loan or
investment.
pv The value an annuity is worth at the present time if a
series of future payments are made. In the case of a loan,
this would be the full amount of the loan. You should be
careful not to include a comma in the amount.
fv The value that an annuity is worth in the future after the
last payment is made. You should be careful not to
include a comma in the amount.
pmt A fixed payment that is made each period.

The entries for rate and nper should be in consistent units. When calculating the
payment on a loan of $170,000 at 10% interest a year over 30 years, the result of the
function =PMT(10%,30,170000) would be payments of approximately $18,000 per
year. To calculate the monthly payments, divide the interest rate by 12 and multiply
the number of payment periods by 12. The result of the function
=PMT(10%/12,30*12,170000) would be payments of approximately $1,500 per
month.

Lesson 1 - Using Other Functions Microsoft Excel Level 4
Page 4 Vicon Learning Systems

Step-by-Step
From the Student Data directory, open ADVFNCT.XLS.
Use a Financial function.

If necessary, display the Financial worksheet.

Use the PMT function to calculate the annual payment for a loan.

Steps Practice Data
1. Select the cell into which you want to
enter the formula.
The active cell moves accordingly.
Click cell D15
2. Click the Paste Function button.
The Paste Function dialog box opens. Click
3. Select Financial from the Function
category list box.
The names of the financial functions
appear in the Function name list box.
Click Financial
4. Select the name of the function from
the Function name list box.
The financial function name is
selected.
Click PMT
5. Select OK.
The Formula Palette dialog box opens
with the insertion point in the text box
for the first argument.
Click OK
6. Move the Formula Palette dialog box
as needed.
The Formula Palette dialog box
appears in the new location.
Drag the Formula Palette
dialog box to the upper
right corner of the screen
7. Select the cell or type the value you
want to use for the first argument.
The cell address or value appears in
the first argument text box.
Click cell B14
8. Continue entering arguments as
necessary.
The cell addresses or values appear in
the appropriate argument text boxes.
Follow the instructions
shown below the table
before continuing on to
the next step
Microsoft Excel Level 4 Lesson 1 - Using Other Functions
Vicon Learning Systems Page 5

Steps Practice Data
9. Select OK.
The Formula Palette dialog box closes
and the result of the formula appears
in the cell.
Click OK

Press [Tab] to move to the next text box and click cell B15. Press [Tab] again and
click cell B13.

Return to the table and continue on to the next step.

The results should be a payment of $72,252 per year. The payment appears enclosed
in parentheses to indicate a negative value.

Practice the Concept: Scroll down to view rows 25 to 38. Select cell D37. Use the
FV function to calculate the future value of the investment. Your results should be
$543,042.
USING LOGICAL FUNCTIONS
Discussion
Logical functions make decisions based on criteria. If the criteria evaluates to false,
one action is taken, and if the criteria evaluates to true, a different action is taken. This
decision-making capability makes logical functions one of the most powerful groups
of functions in Excel.

Logical functions can be applied to many different situations. For example, if a
salesperson meets his or her quota, he or she can get a bonus on top of his or her
regular commission. You can use a logical function to test whether or not the sales are
greater than the quota. If the sales are greater, the function adds the bonus to the
commission; if not, the bonus is not added to the commission.

The IF function returns one value if a condition is true and another value if a
condition is false. For example, you can compare the values of goods shipped to a
customer. If a shipped value is greater than a set figure, the customer receives a
discount. If a shipped value is less than a set figure, the customer does not receive a
discount.

You can also use the IF function to display text as a result of a logical test, but you
must enclose the text in the formula in quotation marks.

The syntax of an IF function is:

=IF(logical test,value if true,value if false)

Lesson 1 - Using Other Functions Microsoft Excel Level 4
Page 6 Vicon Learning Systems

The components of the formula are described in the following table:

Component Description
logical test The test condition. It can contain cell references, text
in quotes, cell names, and numbers. The items are
compared using the following comparison operators:
= equal to
<> not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to
value if true The result produced if the logical test is true. It can
be a number, formula, cell reference, cell name, text
in quotes, or another function.
value if false The result produced if the logical test is false. It can
be a number, formula, cell reference, cell name, text
in quotes, or another function.

Some examples of the IF function are listed in the following table:

IF Function Result
=IF(B7>10,C7*.1,0) The function tests if the number in
cell B7 is greater than 10. If this is
true, the number in cell C7 is
multiplied by 0.1. If it is not true, a
zero is entered into the current cell.
=IF(B7<>10,"GOOD","NO
GOOD")
The function tests if the number in
cell B7 is not equal to 10. If this is
true, the text GOOD is entered into
the current cell. If the number in cell
B7 is equal to 10, the text NO GOOD
is entered into the current cell.

Microsoft Excel Level 4 Lesson 1 - Using Other Functions
Vicon Learning Systems Page 7


Using an IF function



If you want a function to display a blank cell as either the true
or false argument, you can enter two quotation marks together
with no intervening text (). Therefore, if you use the
function, =IF(B6>10,"GOOD",""), then no message will
display if cell B6 is not greater than 10.


Step-by-Step
Use a Logical function.

Display the Logical worksheet.

Customers receive a 10% discount on all orders above $400. Use the IF function to
determine if the order is greater than $400. If the order is greater than $400, calculate
10% of the order; if it is not, there is no discount.

Steps Practice Data
1. Select the cell where you want the
result of the IF function to appear.
The cell is selected.
Click cell F14
Lesson 1 - Using Other Functions Microsoft Excel Level 4
Page 8 Vicon Learning Systems

Steps Practice Data
2. Type =if.
The text =if appears in the cell and on
the formula bar.
Type =if
3. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
4. Type the logical test.
The text appears in the cell and on the
formula bar.
Type F13>400
5. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
6. Type the action to be taken if the
logical test is true.
The text appears in the cell and on the
formula bar.
Type F13*.1
7. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
8. Type the action to take if the logical
test is false.
The text appears in the cell and on the
formula bar.
Type 0
9. Type a closing parentheses ( ) ).
The closing parenthesis ( ) ) appears
in the cell and on the formula bar.
Type )
10. Press [Enter].
The result of the IF function appears
in the cell.
Press [Enter]

Since the order is over $400, the customer receives a discount of $41.95.

Practice the Concept: Select cell F18 and create an IF function that displays the
message You have earned a 10% discount if the order is over $400. Otherwise, no
message is displayed. Use the following IF function to create the message:
=IF(F13>400, "You have earned a 10% discount","").

In the QTY column, select cell C9 and change the quantity to 5. The order now falls
below $400. Notice that the customer does not receive a discount and a message does
Microsoft Excel Level 4 Lesson 1 - Using Other Functions
Vicon Learning Systems Page 9

not appear below the order form. Change the quantity in cell C10 to 20 and view the
changes.
USING DATE FUNCTIONS
Discussion
When you enter a date into a cell, Excel formats the date and stores it as a serial
number that represents that date on the calendar. Excel treats dates as numbers so that
it can perform calculations, such as determining how many days a bill is past due.

You can either type a specific date into a worksheet or use a date function to enter the
date. Therefore, you can create the same date by typing 2/20/99 or entering the
function =DATE(1999,2,20). The date function is often used when the year, day, and
month information already exists in separate cells in the worksheet.

Excel also provides date functions that insert todays date and automatically update to
the current date each time you open the workbook. Some formulas require an updated
current date to increment. If you are calculating a persons age, you will need two
dates, the persons birth date and the current date. The birthdate would be an absolute
date, since that date would not change. The current date, however, would have to
change each day for the formula to correctly calculate the results.

If you are calculating how many days a bill is past due, you will need two dates, the
date when the bill was due and the current date. The date when the bill was due would
be an absolute date, since that date would not change. The current date, however,
would have to change each day for the formula to correctly calculate the results.

Function Description
=DATE(year,month,day) The DATE function is used to enter a
specific date into a cell. You can enter the
number of the month, day, and year as the
arguments. You can also reference cell
addresses if each argument is stored in a
cell.
=TODAY() The TODAY function displays the current
date in a date format. This function does
not use arguments. The serial number for
this function is a whole number.
=NOW() The NOW function displays the current
date and time in a date format. This
function does not use arguments. The
serial number for this function will also
contain decimals to indicate the time.

Lesson 1 - Using Other Functions Microsoft Excel Level 4
Page 10 Vicon Learning Systems




If you only use two digits to enter a year between 1900 and
1929, Excel assumes that the date is in the 21st century.
Therefore, typing 2/13/25 returns the serial number for the
date 2/13/2025. You should type all four digits for any dates
between 1900 and 1929.


You can also enter and calculate times in a worksheet. Times
can be formatted using the Time category on the Number
page in the Format Cells dialog box.


Step-by-Step
Use a Date function.

Display the Dates worksheet.

Steps Practice Data
1. Select the cell into which you want to
enter the formula.
The active cell moves accordingly.
Click cell E17
2. Click the Paste Function button.
The Paste Function dialog box opens. Click
3. Select Date & Time from the
Function category list box.
The names of the date and time
functions appear in the Function
name list box.
Click Date & Time
4. Select the name of the function from
the Function name list box.
The date or time function name is
selected.
Click DATE, if necessary
5. Select OK.
The Formula Palette dialog box opens
with the insertion point in the text box
for the first argument.
Click OK
6. Type the value or select the cell for the
first argument.
The cell address or value appears in
the first argument text box.
Type 1997
Microsoft Excel Level 4 Lesson 1 - Using Other Functions
Vicon Learning Systems Page 11

Steps Practice Data
7. Continue entering arguments as
necessary.
The cell addresses or values appear in
the appropriate argument text boxes.
Follow the instructions
shown below the table
before continuing on to
the next step
8. Select OK.
The Formula Palette dialog box closes
and the result of the formula appears
in the cell.
Click OK

Press [Tab] to move to the next text box and type 6. Press [Tab] again and type 20.

Return to the table and continue on to the next step.

Practice the Concept: Type the =NOW() function into cell C3 to insert a function
that automatically updates to the current date each time the workbook recalculates.
There are no arguments for this function. Notice that this function also displays the
time.

Select cell F6 and create a formula that calculates the length of employment, in years,
for the first employee. The formula should read =($C$3-E6)/365. (Cell C3 is entered
as an absolute reference since all hire dates will be subtracted from the current date.
Since the answer provides the length of employment in days, the result is divided by
365 to calculate the number of years.)

Decrease the number of decimals to 1 and copy the formula down to cell F17.
FORMATTING DATES
Discussion
You can change the display of a date to another preset format. The default date format
is mm/dd/yy, although you can type a date with another format. By default, Excel
only displays the last two digits of the year. When you type 3/11/2001 into a cell or
use a DATE function =DATE(2001,3,11), the cell displays 3/11/01. You must format
dates to display all four digits of the year.

The default formatting that Excel uses for dates, times, currency, and numbers is a
Windows function controlled by the Regional Settings Properties dialog box. You can
change your default settings by opening the Control Panel and selecting the Regional
Settings icon.

Lesson 1 - Using Other Functions Microsoft Excel Level 4
Page 12 Vicon Learning Systems

Step-by-Step
Format dates.

If necessary, display the Dates worksheet.

Steps Practice Data
1. Select the cell you want to format.
The cell is selected.
Click cell C3
2. Select the Format menu.
The Format menu appears.
Click Format
3. Select the Cells command.
The Format Cell dialog box opens.
Click Cells...
4. Select the Number tab.
The Number page appears with the
Date category selected in the Category
list box.
Click the Number tab, if
necessary
5. From the Date category, select a
format in the Type list box.
The type is selected and a preview
appears in the Sample box.
Scroll as necessary and
click 3/14/1998
6. Select OK.
The Format Cells dialog box closes
and the selected date format is applied
to the range.
Click OK

REVISING FORMULAS
Discussion
You can revise a formula or function in the same manner you would edit any cell. You
can modify the cell addresses, arguments, operators, or even the name of the function
used. Formulas are often revised to create an absolute reference for one or more cell
addresses.

Revising a formula is usually more efficient than creating the formula again.

Microsoft Excel Level 4 Lesson 1 - Using Other Functions
Vicon Learning Systems Page 13

Step-by-Step
Revise a formula.

If necessary, display the Dates worksheet.

Steps Practice Data
1. Double-click the cell containing the
formula you want to revise.
The formula appears in the cell and on
the formula bar.
Double-click cell E6
2. Select the formula text you want to
revise.
The insertion point appears in the
formula.
Drag to select the 2 in
1992
3. Revise the text as desired.
The new revision appears in the cell
and on the formula bar.
Type 4
4. When you have finished revising the
formula, press [Enter].
The formula and result change
according to the revision.
Press [Enter]

Close ADVFNCT.XLS.
Lesson 1 - Using Other Functions Microsoft Excel Level 4
Page 14 Vicon Learning Systems

EXERCISE
USING OTHER FUNCTIONS
Task
Use financial, logical, and date functions to find answers.

1. Open Advfnex.
2. Display the Financial worksheet. Create an NPER function in cell
D16 to calculate the number of years it will take for the annuity to be
worth $500,000. (Hint: Use the Paste Function button to help you
with the order of the arguments.)
3. Scroll down to view rows 24 to 39.
4. Use the PMT function in cell D39 to determine the monthly
mortgage payments. (Hint: You need to divide the interest rate by 12
and multiple the number of years, nper, by 12.)
5. Display the Logical worksheet. Create an IF function in cell H6 to
calculate a bonus if the Qtr2 sales is greater than the Qtr1 sales.
Salespeople receive a bonus of 8% of their Qtr2 sales if they exceed
the Qtr1 sales; otherwise, they do not receive a bonus.
6. Copy the formula down to cell H12.

Microsoft Excel Level 4 Lesson 1 - Using Other Functions
Vicon Learning Systems Page 15



7. Display the Date worksheet. Use the DATE function to enter the
date J une 20, 2001 in cell B4.
8. Replace the current date in cell B6 with the NOW function. Widen
the column to view the date.
9. Select cell B10 and use the DATE function to enter yesterdays date.
10. Copy cell B10 to cell B11. Revise the month argument in cell B11 to
display last months date.
11. Change the format for the range B4:B12 to the 14-Mar-1998 format.
12. Select cell C10 and calculate the number of days worked on the
booth by subtracting the current date from the starting date. (Hint:
Make the current date in cell B6 an absolute reference so that you
can copy it.)
13. Format the answer in cell C10 with a number format with one
decimal place. Then, copy the formula to C11.
14. Close the workbook without saving it.



LESSON 2 -
USING RANGE NAMES
In this lesson, you will learn how to:
Work with range names
J ump to a named range
Assign names
Use range names in formulas
Create range names from headings
Apply range names
Delete range names
Use range names in 3-D formulas
Create 3-D range names
Use 3-D range names in formulas
Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 18 Vicon Learning Systems

WORKING WITH RANGE NAMES
Discussion
You can assign a name to a cell or a range in a worksheet. Once a name has been
assigned, the name can be used in any instance where you can use a cell address. For
example, you can use names for ranges in dialog boxes and formulas.

Advantages to using names instead of cell addresses include:

1. Names reduce the chance of error in formulas. It is easy to
recognize if the name EXPENSES is typed incorrectly. If a cell or
range address is typed incorrectly, it is harder to detect.
2. Names adapt to changes within a range (for example, when rows
and columns are added to or removed from the range).
3. Names are easy to recognize and maintain in formulas. For example,
the formula=TOTALSALES-EXPENSES is easier to understand
than the formula =E3-F3.
4. You can easily move the active cell to a named cell or range using
the Name box.
5. Names created in one worksheet are available to all other
worksheets in the workbook.
6. Names can refer to non-contiguous ranges or to ranges that contain
blank cells, columns, or rows.
7. Names are absolute. If you use a name in a formula, the formula
always refers to that range even if you copy or move the formula.

You can use names to refer to cells, ranges, multiple ranges, and ranges in other
worksheets.

J UMPING TO A NAMED RANGE
Discussion
You can use a name to move quickly to a cell or a range. Since a name assigned in a
worksheet is available in all worksheets in the workbook, you can use names to move
easily between the worksheets. For example, in a workbook containing worksheets for
different products, you can quickly jump to the desired product worksheet using the
name assigned to it.
Microsoft Excel Level 4 Lesson 2 - Using Range Names
Vicon Learning Systems Page 19


You use the Name box to jump to a named range. The Name box is located at the left
end of the formula bar and displays all the assigned names in a workbook. When you
choose a name from the Name box, the active cell appears in the first cell of the range
and the entire range is selected.

Jumping to a named range



If the formula bar is not displayed, you can use the View menu
to view it.


Step-by-Step
From the Student Data directory, open NAME1.XLS.
J ump to a named range.

Steps Practice Data
1. Click the arrow for the Name list on
the formula bar.
A list of named ranges appears.
Click Name
2. Select the name of the desired range.
The range appears.
Click Qtr4_NetProfits

Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 20 Vicon Learning Systems

Use the Qtr1_NetProfits name on the Name list to return to the Qtr 1 worksheet.
ASSIGNING NAMES
Discussion
You can use names instead of cell references in formulas and dialog boxes. For
example, if you are summing totals from several worksheets, you can assign names to
the totals in each worksheet and use the range names instead of the cell addresses.

You can use the Name box to assign range names. The following rules apply to
naming ranges:

1. Names must start with a letter or an underscore. The remainder of
the name can contain any character except a space or a hyphen.
Avoid using the dollar sign ($) since it may be confused with an
absolute reference.
2. Names can be up to 255 characters long. You should keep them
short to make them easy to use and to conserve space in formulas
(which also have a maximum length of 255 characters).
3. Names are not case-sensitive. They can be typed in either uppercase
or lowercase.
4. You should not use names that resemble cell references (such as
A1).


Step-by-Step
Assign a name to a range.

If necessary, go to the Qtr 1 worksheet.

Steps Practice Data
1. Select the cell or range you want to
name.
The range is selected.
Click cell E8
2. Click in the Name box on the formula
bar.
The text in the Name box is selected.
Click in the Name box
Microsoft Excel Level 4 Lesson 2 - Using Range Names
Vicon Learning Systems Page 21

Steps Practice Data
3. Type the desired name.
The text appears in the Name box.
Type Qtr1_Total
4. Press [Enter].
The name is saved and appears in the
Name box.
Press [Enter]

USING RANGE NAMES IN FORMULAS
Discussion
You can use a name rather than a cell address in a formula. Using a name in a formula
makes the formula easier to read and understand. For example, it is easy to understand
what information the following formula calculates; =INCOME-EXPENSES. If the
named cells change, the formula automatically updates.

Since names are absolute, you can use a name in place of an absolute cell reference in
a formula. For example, if you are calculating a percentage of Total, the formula
always refers to Total if you use the name rather than the cell address, no matter
where you move or copy the formula.

Using range names in a formula


Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 22 Vicon Learning Systems


You can also select a name from the Paste Name dialog box to
insert a name into a formula. To use the Paste Name dialog
box, begin the formula. When you need to reference the name
in the formula, press the [F3] key and double-click the desired
name.


Step-by-Step
Use a range namein a formula.

If necessary, go to the Qtr 1 worksheet.

Steps Practice Data
1. Select the cell in which you want the
result of the formula to appear.
The cell is selected.
Click cell I4
2. Start typing the formula or function.
The formula appears in the cell and on
the formula bar.
Type =E4/
3. Type the desired name at the
appropriate location in the formula.
The name appears in the cell and on
the formula bar.
Type Qtr1_Total
4. Press [Enter].
The result of the formula appears in
the cell.
Press [Enter]

Practice the Concept: Copy the formula to the range I5:I7. Click cells I5, I6, and I7.
Notice that the name did not change when you copied the cell.
CREATING RANGE NAMES FROM HEADINGS
Discussion
You can create names for rows and columns using text entered into the first or last cell
of the row or the top or bottom cell of the column. This option is a quick way to create
names that correspond directly to worksheet entries. For example, in a worksheet
containing the quantity of products sold each month, you can use the product names in
the row headings to name the rows of quantities sold.

Microsoft Excel Level 4 Lesson 2 - Using Range Names
Vicon Learning Systems Page 23

When Excel names rows and columns, it uses the text in the indicated location (i.e. the
top, bottom, right or left cell) to name the selected range. The cells containing the text
are not included in the named range. You can create multiple names at the same time
by selecting a range that spans several columns or rows.

Creating range names from headings



Although the text in the header columns and rows is not
included in the named range, it must be included in the range
you select prior to performing the command in order for Excel
to determine the range name.


Step-by-Step
Create range names from headings.

If necessary, go to the Qtr 1 worksheet.

Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 24 Vicon Learning Systems

Steps Practice Data
1. Drag to select both the range you want
to name and the row or column
heading containing the desired range
name.
The range is selected.
Scroll as necessary and
drag B3:G7
2. Select the Insert menu.
The Insert menu appears.
Click Insert
3. Point to the Name command.
The Name submenu appears.
Point to Name
4. Select the Create command.
The Create Names dialog box opens.
Click Create...
5. Under Create names in, select the
option corresponding to the location of
the desired name.
The option is selected.
Click Top row, if
necessary
6. Select OK.
The Create Names dialog box closes
and the names are created from the
row and/or column headings.
Click OK

Display the Name box and notice that a name was created for each heading in the
range. Select the Feb name. Click any cell to deselect the range.
APPLYING RANGE NAMES
Discussion
After you have named a range, you can use it in existing formulas. For example, after
you have created formulas in a worksheet, you may decide that using names in the
formulas will make it easier for others to analyze the worksheet. Since Excel does not
automatically replace cell references in existing formulas when you assign names, you
must replace the cell addresses in existing formulas with names as desired. This
technique is called applying names.
Microsoft Excel Level 4 Lesson 2 - Using Range Names
Vicon Learning Systems Page 25


Applying range names



If you want to apply names throughout a worksheet, you can
select a single cell in the worksheet.


Applied names work within a worksheet but not in multiple
worksheets.


Excel uses an underscore ( _ ) for blank spaces in a range
name. For example, the heading Total Sales will be assigned
the range name Total_Sales.


Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 26 Vicon Learning Systems

Step-by-Step
Apply range names to formulas.

If necessary, go to the Qtr 1 worksheet.

Steps Practice Data
1. Drag to select the range in which you
want to apply range names.
The range is selected.
Drag B8:G8
2. Select the Insert menu.
The Insert menu appears.
Click Insert
3. Point to the Name command.
The Name submenu appears.
Point to Name
4. Select the Apply command.
The Apply Names dialog box opens
and any suggested names are
highlighted.
Click Apply...
5. Under Apply names, select the names
you want to apply, if necessary.
The names are selected.
Follow the instructions
shown below the table
before continuing on to
the next step
6. Select OK.
The Apply Names dialog box closes
and the names replace the cell
addresses in all formulas in the
selected range.
Click OK

Select the following names in the Apply names list box.

Select Expenses, Feb, Jan, Mar, Net_Profits, and Total_Sales, if necessary.

Return to the table and continue on to the next step.

Select each cell in the range B8:G8. Notice that the cell addresses have been replaced
by names in each formula.
Microsoft Excel Level 4 Lesson 2 - Using Range Names
Vicon Learning Systems Page 27

DELETING RANGE NAMES
Discussion
You can delete names you no longer use. For example, if you change the name of a
range, you can delete the old name.

Deleting a name permanently removes it from the workbook. If you accidentally
delete a name that is still referred to in a formula, the formula can no longer calculate
correctly, and the error message #NAME? appears in the cell instead of the result of
the formula.

Deleting range names



If you inadvertently delete a name used in a formula, you can
redefine the name to make the formula accurate again.


Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 28 Vicon Learning Systems

Step-by-Step
Delete a range name.

If necessary, go to the Qtr 1 worksheet.

Steps Practice Data
1. Select the Insert menu.
The Insert menu appears.
Click Insert
2. Point to the Name command.
The Name submenu appears.
Point to Name
3. Select the Define command.
The Define Name dialog box opens.
Click Define...
4. Under Names in workbook, select the
range name you want to delete.
The range name is selected.
Click Net_Profits
5. Select Delete.
The range name is deleted from the
workbook.
Click Delete
6. Select Close.
The Define Name dialog box closes.
Click Close

Practice the Concept: Notice that the formula in cell G8 now displays an error
message, #NAME?. Recreate the range name Net_Profits for the range G4:G7.
Notice that the formula updates.
USING RANGE NAMES IN 3-D FORMULAS
Discussion
A 3-D formula is when cell references in a formula refer to cells in more than one
worksheet. In standard 3-D formulas, you must activate the worksheets and select the
cells you want to use while you are building the formula.

You can use range names as a simple and effective way to create 3-D formulas. Since
names are available to all worksheets in the workbook, you can select names from the
Name box or type them into the formula rather than going to each worksheet to select
cell references. This option can save you time and reduce confusion in creating 3-D
formulas.

Microsoft Excel Level 4 Lesson 2 - Using Range Names
Vicon Learning Systems Page 29

Names are often easier to remember than cell addresses, particularly in a large
worksheet or in multiple workbooks when you cannot see the desired cell.

When using names in formulas, you can either type the name into the formula or
select the name from the Paste Name dialog box. If range names are long, the Paste
Name dialog box avoids typing errors.

Using range names in a 3-D formula



If you make a typing error or misspell the name, the #NAME?
error appears in the cell.


Step-by-Step
Use range names in a 3-D formula.

Steps Practice Data
1. Select the worksheet in which you
want to create the formula.
The worksheet appears.
Click the Annual tab
2. Select the cell that in which you want
to create the formula.
The cell is selected.
Click cell D3
Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 30 Vicon Learning Systems

Steps Practice Data
3. Type= to start the formula.
An equal sign (=) appears in the cell
and on the formula bar.
Type=
4. Press [F3].
The Paste Name dialog box opens.
Press [F3]
5. Double-click the desired name.
The name appears in the cell and on
the formula bar.
Double-click
Qtr1_NetProfits
6. Type the desired mathematical
operator.
The mathematical operator appears.
Type +
7. Enter names and mathematical
operators as necessary to complete the
formula.
The formula appears on the formula
bar.
Follow the instructions
shown below the table
before continuing on to
the next step
8. Press [Enter].
The result of the formula appears in
the cell.
Press [Enter]

Press [F3] to open the Paste Names dialog box and double-click Qtr2_NetProfits to
insert the name. Continue creating the following formula by typing each operator and
using the Paste Name dialog box to insert each name:

=Qtr1_NetProfits+Qtr2_NetProfits+Qtr3_NetProfits+Qtr4_NetProfits

Return to the table and continue on to the next step.

The result of the formula should be $73,009.98.
CREATING 3-D RANGE NAMES
Discussion
You can create names that refer to the same range in multiple worksheets. For
example, you can define a name for the same cell address in four different worksheets.
Naming a 3-D range can simplify creating a formula.
Microsoft Excel Level 4 Lesson 2 - Using Range Names
Vicon Learning Systems Page 31


Creating a 3-D range name



Names that refer to 3-D ranges do not appear in the Name
box. They do appear in the Paste Name dialog box.


Step-by-Step
Create a 3-D range name.

Go to the Qtr 1 worksheet.

Steps Practice Data
1. Go to the first worksheet of the group
you want to name.
The worksheet appears.
Click the Qtr 1 tab
2. Select the Insert menu.
The Insert menu appears.
Click Insert
3. Point to the Name command.
The Name submenu appears.
Point to Name
4. Select the Define command.
The Define Name dialog box opens.
Click Define...
5. Under Refers to, click the Collapse
Dialog button.
The Define Name dialog box
collapses.
Click
Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 32 Vicon Learning Systems

Steps Practice Data
6. Hold [Shift] and click the tab of the
last worksheet you want to include in
the group.
The worksheets are grouped and the
range in each worksheet is selected.
Hold [Shift] and click the
Qtr 4 tab
7. Select the range you want to name.
The range is selected.
Click cell E8
8. Click the Expand Dialog button.
The Define Name dialog box expands
and the 3-D range is selected.
Click
9. Select the Names in workbook text
box.
The insertion point appears in the
Names in workbook text box.
Click the Names in
workbook text box
10. Type the desired range name.
The range name appears in the Names
in workbook text box.
Type All_Total
11. Select Add.
The range name is added to the Names
in workbook list box.
Click Add
12. Select OK.
The Define Name dialog box closes
and the 3-D range is named.
Click OK

USING 3-D RANGE NAMES IN FORMULAS
Discussion
You can use a named 3-D range in a function just as you would any other named
range. 3-D ranges can save you a significant amount of time. For example, if you
name each of the four cells containing quarterly totals in four worksheets, you can
sum all four cells using the range name.
Microsoft Excel Level 4 Lesson 2 - Using Range Names
Vicon Learning Systems Page 33


Using a 3-D range name in a formula

Step-by-Step
Use a 3-D range name in a formula.

Steps Practice Data
1. Select the worksheet in which you
want to create the formula.
The worksheet appears.
Click the Annual tab
2. Select the cell in which you want to
create the formula.
The cell is selected.
Click cell B3
3. Type=, the function name, and an
open parenthesis ( ( ).
An equal sign (=), the function name,
and an open parenthesis ( ( ) appear in
the cell and on the formula bar.
Type=sum(
4. Type the 3-D range name you want to
reference.
The range name appears in the cell
and on the formula bar.
Type All_Total
Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 34 Vicon Learning Systems

Steps Practice Data
5. Type any additional information
needed to complete the function and a
closing parenthesis ( ) ).
The completed function appears in the
cell and on the formula bar.
Type )
6. Press [Enter].
The result of the formula appears in
the cell.
Press [Enter]

The result of the formula should be $94,613.98.
Close NAME1.XLS.
Microsoft Excel Level 4 Lesson 2 - Using Range Names
Vicon Learning Systems Page 35

EXERCISE
USING RANGE NAMES
Task
Create and use names for ranges.

1. Open Region17.
2. On the Northeast worksheet, select the range B5:B8. Name the
range Jan_NE.
3. Select the range C5:C8 and name the range Feb_NE.
4. Select the range D5:D8 and name the range Mar_NE.
5. Create an =SUM formula in cell B9 that uses the Jan_NE range.
6. Apply the range names to the formulas in the range C9:D9.
7. Use the Name box to jump to the Mar_C range. Notice that the
Central worksheet now appears on the screen.
8. Display the Totals worksheet.
9. Select cell D5 on the Totals worksheet. Create an =SUM formula
that uses the Mar_C, Mar_NE, and Mar_SE names to add the
March sales in three separate worksheets. (Hint: Use commas to
separate the names in the sum function.
=SUM(Mar_C,Mar_NE,Mar_SE).)
10. Create a 3-D range name that includes cell E5 in all the regional
worksheets, i.e., Northeast, Southeast, and Central. Name the
range Week1.
11. Create 3-D range names for cells E6, E7, and E8 in all the regional
worksheets. Name the ranges Week2, Week3, and Week4,
respectively.
12. In cell B5 in the By Week sheet, create an =SUM function that totals
the 3-D range named Week1.
13. Sum the other 3-D range names on the By Week worksheet. Sum
Week2 in cell B6, Week3 in cell B7, and Week4 in cell B8.
14. Close the workbook without saving it.
Lesson 2 - Using Range Names Microsoft Excel Level 4
Page 36 Vicon Learning Systems




LESSON 3 -
USING ADVANCED FUNCTIONS
In this lesson, you will learn how to:
Use lookup functions
Use the VLOOKUP function
Use the HLOOKUP function
Use the IF function
Use nested IF functions
Use the ISERROR function
Use an AND condition with IF
Use an OR condition with IF
Use the ROUND function
Limit the precision of numbers
Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 38 Vicon Learning Systems

USING LOOKUP FUNCTIONS
Discussion
Lookup functions look up values in a table and return a result based on those values.
For example, you may want to look up the amount of a health insurance deduction
based on an employees salary and type of coverage. A lookup function looks up the
salary and the type of coverage in a table on the worksheet and then returns the
amount of the deduction based on the information in the table.

Before you can use a lookup function, you must create the table of reference data in
the worksheet. This table consists of a column or row of values called the compare
values. The compare values must be sorted in ascending order. The rest of the table
contains the corresponding data for each compare value.

There are two lookup functions: vertical and horizontal. The VLOOKUP function
expects the first value to be in the first column. The HLOOKUP function expects the
first value to be in the first row. The second value you look up determines the number
of columns or rows counted over from the first column or row.

USING THE VLOOKUP FUNCTION
Discussion
The VLOOKUP function has three arguments that appear in the following order:
lookup value, table array, and column index number. The lookup value is the value
you are looking up in the first column of the table. It can be a value, a text string, or a
cell reference. The table array is the range address of the table of information. The
column index number is the number of columns Excel counts over to the right from
the first column in the table. For example, you may want to look up prices for a
particular part in a parts table that contains three columns. The parts descriptions are
in column one and the parts prices are in column three. You would enter a column
index value of 3, which tells Excel to search in the third column of the table for the
price.

The VLOOKUP function searches for the lookup value in the left-most column of the
table array. If the lookup value is between two of the comparison values, Excel uses
the lower of the two values. If the lookup value is smaller than any comparison value,
Excel returns an error message. Once the lookup value has been located, Excel counts
to the right the number of columns specified in the column index number to find the
result of the function. The lookup table must be sorted by the items in the first column
of the table, in either alphabetical (strings) or numerical (values) ascending order.

Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 39

For example, you could create a table that looks up the percent of commission that is
paid for a salesperson, based on various sale levels. If the table shown below were
included in a worksheet and the sales number you want to look up is 5700, then the
commission is 5%. Since Excel determines that 5700 is located between the numbers
5000 and 6000 in the table, it refers to the lower number, which in this case is 5000.
Excel then uses the column index number (in this example, 2) to determine which
column in the table contains the value you want to find. Therefore, the correct percent
of commission (5%) is located in the second column to the right of the number 5000.

A B
1 SALES COMMISSION
2 1000 1%
3 2000 2%
4 3000 3%
5 4000 4%
6 5000 5%
7 6000 6%
8 7000 7%
9 8000 8%


Using the VLOOKUP function


Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 40 Vicon Learning Systems


If you intend to copy the VLOOKUP function to other cells,
the address of the lookup table must be an absolute reference.
To make the lookup table easy to refer to in a function, it is
helpful to assign it a range name. Also, if you use a range
name, the range address of the table does not change if the
formula is copied.


You should use the Paste Function dialog box to create a
VLOOKUP function if you are unsure of the order of the
arguments.


Step-by-Step
From the Student Data directory, open SALES72.XLS.
Use the VLOOKUP function.

If necessary, display the Orders worksheet.

Click the Name Box arrow and select prices. Notice that the price lookup table has
been named prices. You will use the prices lookup table to insert the correct price for
a part in the order record.

Steps Practice Data
1. Select the cell where you want the
result of the VLOOKUP function to
appear.
The cell is selected.
Click cell C5
2. Type =vlookup.
=vlookup appears in the cell and on
the formula bar.
Type =vlookup
3. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
4. Select the cell containing the lookup
value.
A blinking marquee appears around
the cell and the cell address appears in
the cell and on the formula bar.
Click cell B5
5. Type a comma ( , ) as an argument
separator.
The comma ( , ) appears in the cell
and on the formula bar.
Type,
Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 41

Steps Practice Data
6. Type the range address or name of the
lookup table.
The range address or name of the
lookup table appears in the cell and on
the formula bar.
Type prices
7. Type a comma ( , ) as an argument
separator.
The comma ( , ) appears in the cell
and on the formula bar.
Type,
8. Enter the number of the column you
want to search.
The column number appears in the cell
and on the formula bar.
Type2
9. Type a closing parenthesis ( ) ).
The closing parenthesis ( ) ) appears
in the cell and on the formula bar.
Type )
10. Press [Enter].
The result of the VLOOKUP function
appears in the cell.
Press [Enter]

The formula returns a price of $63.99. Notice that this price matches the price in the
lookup table for part ST-2472 (cell B21).

Copy the formula to the range C6:C13. Click anywhere in the worksheet to deselect
the range.
USING THE HLOOKUP FUNCTION
Discussion
The HLOOKUP function has three arguments that appear in the following order:
lookup value, table array, and row index number. The lookup value is the value you
are looking up in the first row of the table. It can be a value, a text string, or a cell
reference. The table array is the range address of the table of information. The row
index number is the number of rows Excel counts down from the first row in the table.
For example, you want to look up shipping charges based on a particular order value
in a shipping table that contains two rows. The sample order values are in row one and
the comparable shipping charges are in row two. You would enter a row index value
of 2, which tells Excel to search the second row of the table for the shipping charges.

The HLOOKUP function searches for the lookup value in the first row of the table
array. If the lookup value is between two of the comparison values, Excel uses the
lower of the two values. If the lookup value is smaller than any comparison value,
Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 42 Vicon Learning Systems

Excel returns an error message. Once the lookup value has been located, Excel then
counts down the number of rows specified in the row index number to find the result
of the function. The lookup table must be sorted by the items in the first row of the
table, in either alphabetical (strings) or numerical (values) ascending order.

For example, you could create a table that looks up the percent of commission paid to
a salesperson based on various sale levels. If the following table were included in a
worksheet and the sales number you want to look up is 5700, then the commission is
5%. Since Excel determines that 5700 is located between the numbers 5000 and 6000
in the table, it refers to the lower number, which in this case is 5000. Excel then uses
the row index number (in this example, 2) to determine which row in the table
contains the value you want to find. Therefore, the correct percentage of commission
(5%) is located in the second row below the number 5000.

A B C D E F G H
1 1000 2000 3000 4000 5000 6000 7000 8000
2 1% 2% 3% 4% 5% 6% 7% 8%


Using the HLOOKUP function



If you intend to copy the HLOOKUP function to other cells,
the address of the lookup table must be an absolute reference.
To make the lookup table easy to refer to in a function, it is
helpful to assign it a range name. Also, if you use a range
name, the range address of the table does not change if the
formula is copied.
Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 43



You should use the Paste Function dialog box to create an
HLOOKUP function if you are unsure of the order of the
arguments.


Step-by-Step
Use the HLOOKUP function.

If necessary, display the Orders worksheet.

Click the Name Box arrow and select shipping. Notice that the shipping charges
lookup table has been named shipping. You will use the shipping lookup table to
insert the correct shipping costs for a part in the order record.

Steps Practice Data
1. Select the cell where you want the
result of the HLOOKUP function to
appear.
The cell is selected.
Click cell F5
2. Type =hlookup.
=hlookup appears in the cell and on
the formula bar.
Type =hlookup
3. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
4. Select the cell containing the lookup
value.
A blinking marquee appears around
the cell and the cell address appears in
the cell and on the formula bar.
Click cell E5
5. Type a comma ( , ) as an argument
separator.
The comma ( , ) appears in the cell
and on the formula bar.
Type,
6. Type the range address or name of the
lookup table.
The range address or name of the
lookup table appears in the cell and on
the formula bar.
Type shipping
Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 44 Vicon Learning Systems

Steps Practice Data
7. Type a comma ( , ) as an argument
separator.
The comma ( , ) appears in the cell
and on the formula bar
Type,
8. Enter the number of the row you want
to search.
The number of the row appears in the
cell and on the formula bar.
Type 2
9. Type a closing parenthesis ( ) ).
The closing parenthesis ( ) ) appears
in the cell and on the formula bar.
Type )
10. Press [Enter].
The result of the HLOOKUP function
appears in the cell.
Press [Enter]

The formula returns a shipping cost of $50.00. Notice that this cost matches the cost in
the lookup table for totals between $400 and $799 (cell G18).

Copy the formula to the range F6:F13. Click anywhere in the worksheet to deselect
the range.
USING THE IF FUNCTION
Discussion
Logical functions make decisions based on criteria. If the criteria evaluates to true,
one action is taken; and, if the criteria evaluates to false, a different action is taken.

This decision-making capability of logical functions can be applied to many different
situations. You can use a logical function to decide if a customer receives a discount
for goods ordered. If a ordered value is greater than a set figure, the customer receives
a discount. If a ordered value is less than a set figure, the customer does not receive a
discount.

The IF function returns one value if a condition is true and another value if a
condition is false. In the example above, if the value of the goods shipped is greater
than a set figure, a true value would be returned. If the shipped value is less than the
set figure, a false value would be returned.

You can also use the IF function to display text as a result of a logical test, but you
must enclose the text in the formula in quotation marks.

The syntax of an IF function is:
Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 45


=IF(logical test,value if true,value if false)

The components of the formula are described in the following table:

Component Description
logical test The test condition. It can contain cell references, text in
quotes, cell names, and numbers. The items are
compared using the following comparison operators:
= equal to
<> not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to
value if true The result produced if the logical test is true. It can be a
number, formula, cell reference, cell name, text in
quotes, or another function.
value if false The result produced if the logical test is false. It can be
a number, formula, cell reference, cell name, text in
quotes, or another function.

Some examples of the IF function are listed in the following table:

IF Function Result
=IF(B7>10,C7*.1,0) If the number in cell B7 is greater
than 10, multiply the number in cell
C7 by .1. Otherwise, return the
number 0.
=IF(B7<=10,C7*.1,D7*.1) If the number in cell B7 is less than
or equal to 10, multiply the number
in cell C7 by .1. Otherwise, multiply
the number in cell D7 by .1.
=IF(B7<>10,"GOOD","") If the number in cell B7 is not equal
to 10, enter the text GOOD in the
current cell. If the number in cell B7
is equal to 10, display a blank cell.
=IF(B7="BONUS",C7+1000,C7) If cell B7 contains the text BONUS,
add 1000 to the number in cell C7.
If cell B7 does not contain the text
BONUS, use the number in cell C7.

Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 46 Vicon Learning Systems


Using the IF function

Step-by-Step
Use the IF function.

Display the Bonus worksheet.

Use the IF function to determine if salespeople made a specified quota. If they did,
they receive a 10% bonus. If they did not, they do not receive a bonus.

Steps Practice Data
1. Select the cell where you want the
result of the IF function to appear.
The cell is selected.
Click cell G8
2. Type =if.
=if appears in the cell and on the
formula bar.
Type =if
3. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 47

Steps Practice Data
4. Type the logical test.
The text appears in the cell and on the
formula bar.
Type E8>F8
5. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
6. Type the action to be taken if the
logical test is true.
The text appears in the cell and on the
formula bar.
Type E8*10%
7. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
8. Type the action to take if the logical
test is false.
The text appears in the cell and on the
formula bar.
Type 0
9. Type a closing parentheses ( ) ) .
The closing parenthesis ( ) ) appears
in the cell and on the formula bar.
Type )
10. Press [Enter].
The result of the IF function appears
in the cell.
Press [Enter]

Notice that since the first quarter sales total for Smith, S was below his quota, a zero
(0) was entered as his bonus.

Copy the formula to the range G9:G13. The total bonus amount in cell G14 should be
27,325. Click anywhere in the worksheet to deselect the range.
USING NESTED IF FUNCTIONS
Discussion
You can use an IF function within another IF function to create a nested IF function.
A nested IF function allows you to test for a second condition if the first condition is
found false. For example, an IF function could test whether or not a number is equal
to 1. If false, another IF function within the first could test whether or not the number
is equal to 2.
Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 48 Vicon Learning Systems


The syntax of a nested IF function is:

=IF(logical test,value if true,IF(logical test,value if true,value if false))

You can create up to seven nested IF functions within an IF function.

Using nested IF functions



You must close all parentheses in a nested IF function. That
is, the number of open parentheses must equal the number of
closed parentheses.


Step-by-Step
Use nested IF functions.

If necessary, display the Bonus worksheet.

Use a nested IF function to calculate the proper withholding amount based on the
status of an employee. The withholding for each sales representative is determined by
a different percentage, depending on the employee status.

Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 49

Steps Practice Data
1. Select the cell where you want the
result of the nested IF function to
appear.
The cell is selected.
Click cell J 8
2. Type =if.
=if appears in the cell and on the
formula bar.
Type=if
3. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
4. Type the first logical test.
The text appears in the cell and on the
formula bar.
TypeI8=1
5. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
6. Type the action to take if the first
logical test is true.
The text appears in the cell and on the
formula bar.
TypeH8*10%
7. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
8. Type if.
The text appears in the cell and on the
formula bar.
Typeif
9. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
10. Type the logical test for the second IF
function.
The text appears in the cell and on the
formula bar.
TypeI8=2
11. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 50 Vicon Learning Systems

Steps Practice Data
12. Type the action to take if the logical
test for the second IF function is true.
The text appears in the cell and on the
formula bar.
Type H8*8%
13. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
14. Type the action to take if the second
logical test is false.
The text appears in the cell and on the
formula bar.
Type H8*7%
15. Type two closing parentheses ( )) ).
The closing parentheses ( )) ) appear
in the cell and on the formula bar.
Type ))
16. Press [Enter].
The result of the nested IF function
appears in the cell.
Press [Enter]

The correct answer, $398.00, appears in cell J 8.

Copy the formula to the range J 9:J 13. Click anywhere in the worksheet to deselect the
range.
USING THE ISERROR FUNCTION
Discussion
Depending upon the circumstances, a formula or function may return an error message
in the cell instead of performing the calculation. For instance, a function that averaged
a range would display a #DIV/0! error message if the range contained no data. The
ISERROR function is commonly used in IF functions for handling errors in
formulas.

The ISERROR function tests whether the formula in a cell displays an error message.
It returns a logical TRUE if there is an error message or a logical FALSE if there is
not an error message. The function returns a logical TRUE if any of the error values
#N/A, #VALUE, #REF, #DIV/0!, #NUM, #NAME?, or #NULL appear in the cell.

The ISERR function is similar to the ISERROR function, except that it does not
respond to the error value #N/A.

Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 51

The syntax of these functions is as follows, where (value) is a cell reference or range
name:

ISERROR(value) and ISERR(value)

Using the ISERROR function in an IF function



If you are unsure of the contents of the cells on which the
calculations are being made, you can use the ISERROR
function because it provides a result regardless of the error
condition.


Step-by-Step
Use the ISERROR function in an IF function.

Display the Quota worksheet.

Use the ISERROR function combined with the IF function to clear a #DIV/0!
message.

Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 52 Vicon Learning Systems

Steps Practice Data
1. Select the cell where you want the
result of the ISERROR function to
appear.
The cell is selected.
Click cell F15
2. Type =if.
=if appears in the cell and on the
formula bar.
Type =if
3. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
4. Type the ISERROR function as the
logical test.
The text appears in the cell and on the
formula bar.
Type
ISERROR(AVERAGE
(F8:F13))
5. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
6. Type the action to take if the IF
function is true.
The text appears in the cell and on the
formula bar.
Type "no data"
7. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
8. Type the action to take if the IF
function is false.
The text appears in the cell and on the
formula bar.
Type AVERAGE
(F8:F13)
9. Type the closing parenthesis ( ) ).
The closing parenthesis ( ) ) appears
in the cell and on the formula bar.
Type )
10. Press [Enter].
The result of the ISERROR function
appears in the cell.
Press [Enter]

The formula returns the text no data instead of the error message. Copy the formula
to the range G15:I15. Type 50,000 in cell F8 and verify that the message in cell F15
changes.
Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 53

USING AN AND CONDITION WITH IF
Discussion
You can use AND conditions to test multiple criteria in IF functions. For example,
you may want to give a salesperson a $500 bonus if he or she produces $10,000 in
sales and has at least five years experience. This example is an AND condition. When
used in an IF function, an AND condition returns a TRUE value if both arguments
are true and a FALSE value if either argument is false.

The syntax of an AND condition is:

=IF(AND(logical test1,logical test2),value if true,value if false)

Using an AND condition in an IF function

Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 54 Vicon Learning Systems

Step-by-Step
Use an AND condition in an IF function.

Display the Raises worksheet.

Use an AND condition in an IF function to determine whether or not a person
qualifies for a raise.

Steps Practice Data
1. Select the cell where you want the
result of the IF function to appear.
The cell is selected.
Click cell D8
2. Type =if.
=if appears in the cell and on the
formula bar.
Type =if
3. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
4. Type the AND condition.
The text appears in the cell and on the
formula bar.
Type AND(B8>0,C8>1)
5. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
6. Type the action you want to take if
both conditions are true.
The text appears in the cell and on the
formula bar.
Type "Yes"
7. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
8. Type the action you want to take if
either condition is false.
The text appears in the cell and on the
formula bar.
Type "No"
9. Type a closing parenthesis ( ) ).
The closing parenthesis ( ) ) appears
in the cell and on the formula bar.
Type)
Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 55

Steps Practice Data
10. Press [Enter].
The result of the IF function with the
AND condition appears in the cell.
Press [Enter]

The correct answer is No since only one condition is true.

Copy the formula to the range D9:D13. Click anywhere in the worksheet to deselect
the range.
USING AN OR CONDITION WITH IF
Discussion
You can use OR conditions to test multiple criteria in IF functions. For example, you
may want to give a salesperson a $500 bonus if he or she produces $10,000 in sales, or
if he or she has at least five years experience. This example represents an OR
condition. When used in an IF function, the OR condition returns a TRUE value if
either argument is true and a FALSE value if both arguments are false.

The syntax of an OR condition is:

=IF(OR(logical test1,logical test2),value if true,value if false)

Using an OR condition in an IF function

Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 56 Vicon Learning Systems

Step-by-Step
Use an OR condition in an IF function.

If necessary, display the Raises worksheet.

Use an OR condition in an IF function to determine whether or not a salesperson
qualifies for an award.

Steps Practice Data
1. Select the cell where you want the
result of the IF function to appear.
The cell is selected.
Click cell E8
2. Type =if.
=if appears in the cell and on the
formula bar.
Type =if
3. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
4. Type the OR condition.
The text appears in the cell and on the
formula bar.
Type
OR(B8>10000,C8=3)
5. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
6. Type the action you want to take if one
of the conditions is true.
The text appears in the cell and on the
formula bar.
Type "Yes"
7. Type a comma ( , ) to separate the
arguments.
The comma ( , ) appears in the cell
and on the formula bar.
Type ,
8. Type the action you want to take if
both the conditions are false.
The text appears in the cell and on the
formula bar.
Type "No"
9. Type a closing parenthesis ( ) ).
The closing parenthesis ( ) ) appears
in the cell and on the formula bar.
Type)
Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 57

Steps Practice Data
10. Press [Enter].
The result of the IF function with the
OR condition appears in the cell.
Press [Enter]

The correct answer is No since neither condition is true.

Copy the formula to the range E9:E13. Click anywhere in the worksheet to deselect
the range.
USING THE ROUND FUNCTION
Discussion
When you enter a number into an Excel worksheet, Excel can store it with up to 15
digits. Although you can format numbers so that Excel rounds off extra decimal
places, Excel uses all decimal places in calculations. This feature can lead to some
calculations appearing incorrect.

Rounding a number is different than formatting a number. When you round a number
to a certain number of decimal places, the extra decimal places are removed and all
calculations are performed using the rounded value.

The ROUND function includes the following two arguments:

ROUND(number,number of digits)

The number can be a value or a cell address. The number of digits indicates to how
many digits you want to round. If the number of digits is a positive number, that
number indicates the desired number of decimal places. If the number of digits is 0,
Excel rounds to the next whole number. If the number of digits is a negative number,
Excel rounds to the next ten, hundred, thousand, etc., accordingly.

Some examples of the ROUND function are listed in the following table:

ROUND function Cell displays
=ROUND(4567.4567,1) 4567.5
=ROUND(4567.4567,2) 4567.46
=ROUND(4567.4567,0) 4567
=ROUND(4567.4567,-1) 4570
=ROUND(B7,2) The value in cell B7 rounded to two decimal
places
Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 58 Vicon Learning Systems

ROUND function Cell displays
=ROUND(B7*.1,2) The result of the number in cell B7 times .1,
rounded to two decimal places


Using the ROUND function

Step-by-Step
Use the ROUND function.

Display the Invest worksheet.

The formulas in columns E and G both calculate the same investment. The formula in
column E uses the full rate while the formula in column G uses the rounded rate.

Steps Practice Data
1. Select the cell where you want the
result of the ROUND function to
appear.
The cell is selected.
Click cell F7
Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 59

Steps Practice Data
2. Type =round.
=round appears in the cell and on the
formula bar.
Type =ROUND
3. Type an open parenthesis ( ( ).
The open parenthesis ( ( ) appears in
the cell and on the formula bar.
Type (
4. Type the value, formula, cell address,
or function you want to round.
The text appears in the cell and on the
formula bar.
TypeD7,
5. Type the desired number of decimal
places.
The text appears in the cell and on the
formula bar.
Type4
6. Type a closing parenthesis ( ) ).
The closing parenthesis ( ) ) appears
in the cell and on the formula bar.
Type )
7. Press [Enter].
The result of the ROUND function
appears in the cell.
Press [Enter]

The result is .0114. Notice that the number in cell G7 differs from the number in cell
E7 due to using the rounded value in F7. Copy the formula to the range F8:F12.

Select the range D7:D12 and click the Decrease Decimal button on the Formatting
toolbar two times to format the numbers for 4 decimal places. Notice that the values in
column E not change; the calculations still use the full number of decimal places. Use
the Undo feature to remove the formatting.
LIMITING THE PRECISION OF NUMBERS
Discussion
In order to calculate a worksheet using the numbers as they appear, you can limit the
precision of formatted numbers. Limiting the precision changes the original numbers
in the worksheet to their formatted versions. For example, a cell may contain the value
123.4567, but the formatted value in the cell is 123. In a calculation, Excel uses the
entire number, including all decimals. If you limit the precision of the cell to the value
displayed, however, the decimals are removed from the number and only 123 is used
in calculations.


Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 60 Vicon Learning Systems


Be careful when limiting the precision of numbers because
you permanently change the original values and you cannot
use the Undo feature to reverse the action. You can, however,
restore your original numbers if you immediately exit the
worksheet without saving your changes and then reopen it.


Step-by-Step
Limit the precision of numbers.

If necessary, display the Invest worksheet.

Select cell C7. Notice that, although the salary displayed on the worksheet is 4975, the
actual value in the cell is 4974.554. All salaries in column C contain decimal places,
even though they do not appear because of the formatting. Limit the precision for
calculations to the formatted values.

Steps Practice Data
1. Select the Tools menu.
The Tools menu appears.
Click Tools
2. Select the Options command.
The Options dialog box opens.
Click Options...
3. Select the Calculation tab.
The Calculation page appears.
Click the Calculation tab
4. Select the Precision as displayed
option.
The Precision as displayed option is
selected.
Click Precision as
displayed
5. Select OK.
A Microsoft Excel warning box opens,
warning you that the data will
permanently lose accuracy.
Click OK
6. Select OK.
The Microsoft Excel warning box
closes and the numbers in the
worksheet are recalculated using
limited precision.
Click OK

Select each of the cells in column C, one at a time. Notice that the decimal places have
been removed from the values.
Close SALES72.XLS.
Microsoft Excel Level 4 Lesson 3 - Using Advanced Functions
Vicon Learning Systems Page 61

EXERCISE
USING ADVANCED FUNCTIONS
Task
Use advanced functions to find worksheet solutions.

1. Open Functex.
2. Display the Hours worksheet.
3. In cell F6, use the VLOOKUP function to calculate the appropriate
pay rate for full-time, part-time, or overtime work according to job
type. (Hint: The lookup value is the Job Type in column C, the
lookup table is named table, and the column index number is the
Type of Time in column E.)
4. Copy the formula to the range F7:F12.
5. Display the Sales-Previous worksheet.
6. Customers get free shipping if their average sales are more than
20,000. In cell I5, use an IF function to test the average sales. If the
average is greater than or equal to 20,000, Yes should appear in the
cell. Otherwise, No should appear in the cell.
7. Copy the formula to the range I6:I13.
8. The customer discount depends on the customer status. In cell J 5, use
nested IF function to determine the correct discount for each
customer according to the following table. (Hint: Test to see if the
status in cell B5 is a 1, 2 or 3; otherwise, a discount of 10% is
entered.)

Status Discount
1 0%
2 5%
3 7.5%
4 10%

9. Copy the formula to the range J 6:J 13.
Lesson 3 - Using Advanced Functions Microsoft Excel Level 4
Page 62 Vicon Learning Systems



10. Display the Sales-Current worksheet.
11. In cell C16, use an ISERROR function in an IF function to change
the #DIV/0! message to No data. Copy the formula to the range
D16:F16.
12. Display the Commissions worksheet.
13. Use the ROUND function to round the results of the commission
formula in cell C5 to two decimal places. Copy the formula to the
range C6:C13.
14. Format the numbers in the range B5:B13 so that no decimal places
appear.
15. Limit the precision of numbers. Notice that the commission values
change accordingly.
16. Close the workbook without saving it.



LESSON 4 -
USING DATA TABLES
In this lesson, you will learn how to:
Use data tables
Place formulas in data tables
Create a one-variable table
Create a two-variable table
Lesson 4 - Using Data Tables Microsoft Excel Level 4
Page 64 Vicon Learning Systems

USING DATA TABLES
Discussion
You can use a data table to vary one or two values in a formula and display all the
possible results. For example, you can create a data table that displays all the possible
projected sales based on total sales and various growth percentages.

To create a data table, you must first indicate the input cells (the cells containing the
variable values in the formula). In the previous sales growth example, the input cells
are the cells containing the total sales and the percentage growth figures. The input
values in the data table are then substituted in the formula and the result of each
calculation is placed into the output cells of the data table.

PLACING FORMULAS IN DATA TABLES
Discussion
When you create a data table, the placement of the formula used in the calculation
varies, depending on the type of table you are creating.

If a one-variable data table is arranged in columns, the formula is placed in the cell at
the top of the output column. For example, in the following diagram, column B is the
output column and the formula to be used in the calculation must be placed in cell B1.

A B
1 FORMULA
2 25.67
3 12.50
4 35.42
5 97.16
A one-variable data table arranged in columns

If a one-variable data table is arranged in rows, the formula is placed in the cell to the
left of the output row. For example, in the following diagram, row 2 will contain the
output calculations and the formula to be used in the calculations must be placed in
cell A2.

A B C D E
1 25.67 12.50 35.42 97.16
2 FORMULA
A one-variable data table arranged in rows

Microsoft Excel Level 4 Lesson 4 - Using Data Tables
Vicon Learning Systems Page 65

In a two-variable table, both rows and column are used for input data and the formula
is placed above the column input cells and to the left of the row input cells. For
example, in the following diagram, column A contains one set of variable input values
and row 1 contains the other set of input values. Therefore, the formula to be used in
the calculations must be placed in cell A1.

A B C D E
1 FORMULA 25.67 12.50 35.42 97.16
2 5
3 10
4 15
5 20
A two-variable data table

CREATING A ONE-VARIABLE TABLE
Discussion
When you create a one-variable data table, you can type the input values either across
a row or down a column.

If the one-variable data table consists of two columns, the first column is the input
column and contains all the possible values for the variable. The second column is the
output column. In addition, the cell directly above the output column must contain the
formula (or a reference to the formula) that is to be used to calculate the data table.

If the one-variable data table consists of two rows, the top row is the input row and
contains all the possible values for the variable. The second row is the output row. The
cell to the left of the output row must contain the formula.

The input cell is critical when creating a data table. It is the cell containing the
variable value and must be included in the formula. As the variable values are entered
into the data table, the results of the calculation appear in the corresponding cell in the
output column.
Lesson 4 - Using Data Tables Microsoft Excel Level 4
Page 66 Vicon Learning Systems


A one-variable data table

Step-by-Step
From the Student Data directory, open WHATIF1.XLS.
Create a one-variable data table.

If necessary, display the One Variable worksheet.

Create a data table arranged in columns that calculates the price of multiple quantities
of an item.

Steps Practice Data
1. Select the cell immediately above the
output column.
The cell is selected.
Click cell B5
2. Type the formula you want to
evaluate.
The text appears in the cell and on the
formula bar.
Type =A2*B2
3. Press [Enter].
The result of the formula appears in
the cell.
Press [Enter]
Microsoft Excel Level 4 Lesson 4 - Using Data Tables
Vicon Learning Systems Page 67

Steps Practice Data
4. Select the range containing the
formula, the input column, and the
output column.
The range is selected.
Drag A5:B16
5. Select the Data menu.
The Data menu appears.
Click Data
6. Select the Table command.
The Table dialog box opens.
Click Table...
7. Select the Column input cell text box.
The insertion point appears in the
Column input cell text box.
Click in the Column
input cell text box
8. Select the input cell.
A blinking marquee appears around
the cell and the cell reference appears
in the Column input cell text box.
Click cell B2
9. Select OK.
The Table dialog box closes, and Excel
calculates the formula using each of
the values in the input column and
places the results in the data table
output column.
Click OK

Practice the Concept: Select cell A2 and type 159.99. Notice that the data table
recalculates.
CREATING A TWO-VARIABLE TABLE
Discussion
You can create a data table that varies two values in a formula. A two-variable data
table uses both an input column and an input row. The input row is the first row in the
data table and the input column is the first column at the left of the data table. You
enter the formula you want to calculate in the cell above the input column and to the
left of the input row.

A two-variable data table contains two input cells: one for column input data and one
for row input data. The input cells must be included in the formula. The formula
calculates each of the possible combinations of the row and column input cells and
places the results in the corresponding, intersecting cell in the data table.
Lesson 4 - Using Data Tables Microsoft Excel Level 4
Page 68 Vicon Learning Systems


A two-variable data table

Step-by-Step
Create a two-variable data table.

Display the Two Variables worksheet. Notice that the unit prices of several items are
listed across row 5.

Use a two-variable data table to calculate the price of multiple quantities of several
items.

Steps Practice Data
1. Select the cell above the column input
values and to the left of the row input
values.
The cell is selected.
Click cell A5
2. Type the formula you want to
evaluate.
The text appears in the cell and on the
formula bar.
Type =A2*B2
3. Press [Enter].
The result of the formula appears in
the cell.
Press [Enter]
Microsoft Excel Level 4 Lesson 4 - Using Data Tables
Vicon Learning Systems Page 69

Steps Practice Data
4. Select the data table.
The range is selected.
Drag A5:H16
5. Select the Data menu.
The Data menu appears.
Click Data
6. Select the Table command.
The Table dialog box opens.
Click Table...
7. Select the row input cell.
A blinking marquee appears around
the cell and the cell reference appears
in the Row input cell text box.
Click cell A2
8. Select the Column input cell text box.
The insertion point appears in the
Column input cell text box.
Press [Tab]
9. Select the column input cell.
A blinking marquee appears around
the cell and the cell reference appears
in the Column input cell text box.
Click cell B2
10. Select OK.
The Table dialog box closes, and Excel
calculates the formula using each of
the values in the input row and the
input column and places the results in
the data table.
Click OK

Practice the Concept: In cell D5, type 85.12 and press [Enter]. Notice that Excel
recalculates the values in the column based on the new input value. Adjust the column
width as necessary to view the new values.
Close WHATIF1.XLS.
Lesson 4 - Using Data Tables Microsoft Excel Level 4
Page 70 Vicon Learning Systems

EXERCISE
USING DATA TABLES
Task
Use data tables to create quantity and commission tables with varying inputs.

1. Open Commrate.
2. In cell B5, enter a formula to multiply the Unit Price value in cell
A2 by the Quantity in cell B2.
3. Select the range B4:G5 for the data table.
4. Create a one-variable data table. The row input cell is the quantity in
cell B2.
5. In cell A11, enter a formula that multiplies the sales figure in cell A8
by the commission rate in cell B8.
6. Select the range A11:G16 for the data table.
7. Create a two-variable data table. The row input cell is the
commission rate in cell B8 and the column input cell is the sales total
in cell A8.
8. Close the workbook without saving it.



LESSON 5 -
USING MACROS
In this lesson, you will learn how to:
Define macros
Open a workbook containing macros
Run a macro
Use a shortcut key
Use the Visual Basic toolbar
Open the Visual Basic Editor window
Use the Visual Basic Editor window
Lesson 5 - Using Macros Microsoft Excel Level 4
Page 72 Vicon Learning Systems

DEFINING MACROS
Discussion
A macro is a small program you can use to automatically perform frequently used
operations. It contains all the commands, mouse movements, and user actions
necessary to complete a task. Macros can save you considerable time because you can
use them to automate many repetitive, time-consuming tasks. You can use macros for
simple tasks you perform frequently or for complex tasks that require consistency.

Excel macros are written in the Visual Basic for Applications programming language.
The series of commands used in a macro are known as a procedure. Each procedure is
given a name that is used to execute the macro.

Each procedure is saved in a device called a module. This module is attached to the
worksheet in which the macro was stored. A module cannot be seen in the normal
window view because it is hidden. You must use the Visual Basic Editor window to
select a module and view and edit the macro commands.

All procedures begin with the word Sub, followed by the name of the macro and a left
and right parenthesis, and end with the words End Sub. Commands entered between
these two lines are macro statements. When you record a procedure, Visual Basic
translates the menu choices and keystrokes into the macro statements. Comments may
also be inserted into a procedure to add clarity. If you know Visual Basic, you can
write a procedure yourself instead of using the macro recorder.



A macro can be stored in a specific workbook or in the
Personal Macro Workbook. Macros stored in a specific
workbook can only be used when that workbook is open. The
Personal Macro Workbook automatically opens when you
start Excel; therefore, macros stored in this workbook are
available to all files.


OPENING A WORKBOOK CONTAINING MACROS
Discussion
It is possible that when you open a workbook containing macros, you could
unknowingly install a virus on your computer. A virus is a type of macro that is self-
activated when a workbook is opened. It can invade your computer and be stored in
Microsoft Excel Level 4 Lesson 5 - Using Macros
Vicon Learning Systems Page 73

hidden fashion in one or all of your worksheets. Therefore, it is very beneficial to have
the ability to enable or disable macros as you open a workbook.

Excel provides protection against such incidents. A Microsoft Excel warning box
opens if a workbook containing macros is opened. This warning box gives you a
number of choices. If you can verify the source of the macros, you can enable the
macros and open the workbook without risking exposure to a virus. If you are not sure
of the source of the macros, you can disable the macros before you open the
workbook and then verify the action of the macros later.

Opening a workbook containing macros

Step-by-Step
Open a workbook containing macros.

Steps Practice Data
1. Click the Open button.
The Open dialog box opens.
Click
2. Select the Look in list.
A list of available drives appears.
Click Look in
3. Select the drive where the macro
workbook you want to open is stored.
A list of available folders appears.
Click the student data
drive
Lesson 5 - Using Macros Microsoft Excel Level 4
Page 74 Vicon Learning Systems

Steps Practice Data
4. Select the folder where the macro
workbook you want to open is stored.
A list of available files appears.
Double-click to select the
student data folder
5. Select the macro workbook you want
to open.
The macro workbook is selected.
Click city56
6. Select Open.
A Microsoft Excel warning box opens,
prompting you to disable, enable, or
not open the macros.
Click Open
7. Select Enable Macros.
The Microsoft Excel warning box
closes, the workbook opens, and the
macros are enabled.
Click Enable Macros

RUNNING A MACRO
Discussion
Macros are saved in modules with the workbooks in which they were written. Before
you can run a macro, the workbook with the module containing the macro must be
opened. When you select a macro name in the Macro dialog box, Excel performs the
commands listed under the macro name in the module in sequence.

Macros in any open workbook can be run from any other open workbook.
Microsoft Excel Level 4 Lesson 5 - Using Macros
Vicon Learning Systems Page 75


Running a macro



You can also run macros by clicking the Run Macro button
on the Visual Basic toolbar.


Step-by-Step
Run a macro.

If necessary, enable the macros.

The macro used in the following step-by-step does not contain file paths for the
workbooks. The macro uses the same folder that contains the City56.xls data file.
Make sure that your current folder is set for the path containing the student data files.

Steps Practice Data
1. Select the Tools menu.
The Tools menu appears.
Click Tools
2. Point to the Macro command.
The Macro submenu appears.
Point to Macro
3. Select the Macros command.
The Macros dialog box opens.
Click Macros...
Lesson 5 - Using Macros Microsoft Excel Level 4
Page 76 Vicon Learning Systems

Steps Practice Data
4. Select the macro you want to run.
The macro name is selected.
Click NewYork
5. Select Run.
The Macros dialog box closes and the
macro runs.
Click Run

Close the NewYork workbook.
USING A SHORTCUT KEY
Discussion
Excel performs the commands listed under the macro name in the module in
sequence. If the macro has a shortcut key combination assigned to it, you can use it to
run the macro by pressing the assigned shortcut keys. The combination consists of
pressing the [Ctrl] key and the key assigned to the macro. If an uppercase letter has
been assigned, you need to press the [Ctrl] key, the [Shift] key, and the letter
assigned to the macro. You should also make sure that the workbook with the module
containing the macro is open.



Macro shortcut key combinations are case-sensitive. If the
shortcut key is the [Ctrl] key plus the uppercase letter N, you
must press the [Ctrl+Shift+N] key combination or the macro
will not run.


Step-by-Step
Use a shortcut key to run a macro.

If necessary, enable the macros.

The macro used in the following step-by-step does not contain file paths for the
workbooks. The macro uses the same folder that contains the City56.xls data file.
Make sure that your current folder is set for the path containing the student data files.

The shortcut key for this macro is the lower case letter n.

Microsoft Excel Level 4 Lesson 5 - Using Macros
Vicon Learning Systems Page 77

Steps Practice Data
1. Press the shortcut key combination for
the macro.
The macro runs.
Hold [Ctrl] and type n

Close the NewYork workbook.
USING THE VISUAL BASIC TOOLBAR
Discussion
The Visual Basic toolbar contains a variety of buttons that can be used when creating,
editing, or running macros.

You can use the Run Macro button to open the Macro dialog box and run a macro.
The Record Macro button allows you to record your own macros by recording the
steps you perform. The Visual Basic Editor button opens the Visual Basic Editor
window where you can edit the commands of an existing macro.

Since macros can transmit viruses, you can use the Security button to set the security
level you want to employ when opening workbooks containing macros.

Other buttons are used for automating forms and working with HTML tags and scripts
for workbooks saved as Web pages.



A Medium security setting is the default setting on the
Security Level page in the Security dialog box. If you set a
Low security setting, workbooks containing macros will open,
without prompting you to enable or disable the macros. A
High setting will only enable macros from a list of trusted
sources. You can open the Security dialog box by clicking the
Security button on the Visual Basic toolbar.


Lesson 5 - Using Macros Microsoft Excel Level 4
Page 78 Vicon Learning Systems

Step-by-Step
Use the Visual Basic toolbar.

Steps Practice Data
1. Right-click any toolbar.
The toolbar shortcut menu appears.
Right-click any toolbar
2. Select the Visual Basic command.
The Visual Basic toolbar appears.
Click Visual Basic
3. Click the desired button.
The selected action occurs.
Click

Select the Atlanta macro and run it. Close the Atlanta workbook.
OPENING THE VISUAL BASIC EDITOR WINDOW
Discussion
Excel macros are written in the Visual Basic for Applications (VBA) programming
language. They are saved in modules that are attached to the worksheets in which the
macros were written. These modules are hidden in the normal window view. They
can, however, be displayed in the Visual Basic Editor window. You can view, edit,
and run macros from this window.

TheVisual Basic Editor window is divided into three smaller windows. The upper left
window is called the Project Explorer window. It displays the various worksheets and
modules of a workbook in folder and file format. The various folders, worksheets, and
modules can be displayed or hidden similar to the way files and folders are displayed
or hidden in Windows Explorer.

The lower left window is called the Properties window. It displays the properties of
the worksheets or modules selected in the Project Explorer window. It is used in other
applications of Visual Basic but will not be used in this macro section of the course.

The large window on the right of the screen is called the Codewindow. It displays the
contents of the worksheets or modules selected in the Project Explorer window. For
example, when a moduleis selected, the entire procedure, including the header, footer,
macro name, macro code, and comments, appear in the Code window. You use the
Code window to display, edit, and run macros.
Microsoft Excel Level 4 Lesson 5 - Using Macros
Vicon Learning Systems Page 79


The Visual Basic Editor window



If the Project Explorer and Properties windows do not appear
in the Visual Basic Editor window, you can click the Project
Explorer and Properties Window buttons on the Standard
toolbar to open them.


If the Code window does not appear, you can select the View
menu and then select the Code command in the Visual Basic
Editor window to open it.


The Visual Basic Editor window can also be opened by
pressing the [Alt+F11] key combination or by selecting the
Tools menu, selecting the Macro command, and then
selecting the Visual Basic Editor command. You can also
press the [Alt+F11] key combination to toggle between Excel
and the Visual Basic Editor.


Lesson 5 - Using Macros Microsoft Excel Level 4
Page 80 Vicon Learning Systems

Step-by-Step
Open theVisual Basic Editor window.

If necessary, enable the macros and display the Visual Basic toolbar.

Steps Practice Data
1. Select the Visual Basic Editor button
on the Visual Basic toolbar.
The Visual Basic Editor window
opens.
Click

Practice the Concept: If necessary, click the Project Explorer and Properties
Window buttons, select the View menu, select the Code command to open all the
windows, and then maximize the Code window. Press [Alt+F11] twice to toggle
between Excel and the Visual Basic Editor. Display the Visual Basic Editor window.
USING THE VISUAL BASIC EDITOR WINDOW
Discussion
The Visual Basic Editor window contains the Project Explorer window, the Properties
window, and the Codewindow. Each of these windows can be opened and closed. If a
window is closed, the other windows may expand over the area of the closed
windows. When the closed window is reopened, it appears in its original location.
Microsoft Excel Level 4 Lesson 5 - Using Macros
Vicon Learning Systems Page 81


Using the Visual Basic Editor window



You can also hold the [Ctrl] key and type the letter R to open
the Project Explorer window and press the [F4] key to open
the Properties window.


Step-by-Step
Use theVisual Basic Editor window.

If necessary, enable the macros and open the Visual Basic Editor window.

Steps Practice Data
1. Click the Close button on the Project
Explorer window to close it.
The Project Explorer window closes
and the Properties window expands
accordingly.
Click on the Project -
ProjectVBA window title
bar
2. Click the Project Explorer button.
The Project Explorer window opens.
Click
Lesson 5 - Using Macros Microsoft Excel Level 4
Page 82 Vicon Learning Systems

Steps Practice Data
3. Click the Close button on the
Properties window to close it.
The Properties window closes and the
Project Explorer window expands
accordingly.
Click on the Properties
- Sheet1 window title bar
4. Click the Properties Window button.
The Properties window opens.
Click
5. Click the Close button in the Code
window to close it.
The Code window closes.
Click on the Code
window title bar
6. Expand the Modules folder in the
Project Explorer window.
The folder expands to display its
contents.
Click the next to
Modules, if necessary
7. Double-click the appropriate module
to display the macro code.
The Code window opens with the
contents of the module displayed.
Double-click Module 1, if
necessary

Notice the Workbooks.Open commands that open the NEWYORK.XLS and
ATLANTA.XLS files.

Click the Close button on the Visual Basic Editor window title bar to close it.
Close CITY56.XLS.
Microsoft Excel Level 4 Lesson 5 - Using Macros
Vicon Learning Systems Page 83

EXERCISE
USING MACROS
Task
Use macros in a workbook.

1. Open Exer81 and enable the macros.
2. Use the Tools menu to run the Sort_RegionSales macro. Notice that
the macro sorts the data by region, and then by annual sales in
descending order.
3. Use the Visual Basic toolbar to run the Sort_LastName macro.
Notice that the macro sorts the data by last name.
4. Use the shortcut key [Ctrl+r] to run the Subtotals_Region macro.
5. Open the Visual Basic Editor window.
6. Open Module1 to display the macro code in the Codewindow. Press
[Down] to view the Subtotals_Remove macro.
7. Close the Visual Basic Editor window and run the
Subtotals_Remove macro.
8. Close theworkbook without saving it.



LESSON 6 -
RECORDING MACROS
In this lesson, you will learn how to:
Record a macro
Assign a shortcut key
Use relative references
Assign a macro to a menu
Delete a macro from a menu
Delete a macro
Lesson 6 - Recording Macros Microsoft Excel Level 4
Page 86 Vicon Learning Systems

RECORDING A MACRO
Discussion
A macro can be created using the macro recorder. You perform the steps you want to
include in the macro and Excel records them into a macro procedure. The steps you
perform are not recorded as simple keystrokes. They are translated into the Visual
Basic for Application programming language, which uses macro statements to replace
your steps.

When you record a macro, Excel opens a module that is attached to a worksheet. As
you perform the keystrokes for the macro, they are saved as Visual Basic language
statements in the module. A module can contain more than one macro.

During the macro recording process, you give the macro a name and provide
descriptive information about the tasks the macro performs. This information is
entered in the Record Macro dialog box and appears as a comment in the module.

In addition to naming the macro, you select a location where the macro is stored.
Macros can be stored in the current workbook, a new workbook, or in the Personal
Macro Workbook. Macros stored in a normal workbook are only available when the
workbook is open. If you store a macro in the Personal Macro Workbook, it will be
available to all workbooks.

Recording a macro



If you record a macro to the Personal Macro Workbook, Excel
prompts you to save the changes to the Personal Macro
Workbook when you exit the program.

Microsoft Excel Level 4 Lesson 6 - Recording Macros
Vicon Learning Systems Page 87


You can also record a macro by selecting the Tools menu,
pointing to the Macro submenu, and then selecting the
Record New Macro command.




There are reserved names that you cannot use for naming a
macro. When you select OK to start recording the macro, an
Excel message box opens, indicating that your name is not
valid. Invalid names are usually macro command names such
as Date, If, or Next.


Step-by-Step
From the Student Data directory, open CITY57.XLS.
Record a macro.

If necessary, enable the macros and display the Visual Basic toolbar.

The macro used in the following step-by-step does not contain file paths for the
workbooks. The macro uses the same folder that contains the City57.xls data file.
Make sure that your current folder is set for the path containing the student data files.

Steps Practice Data
1. Click the Record Macro button on the
Visual Basic toolbar.
The Record Macro dialog box opens
with the text in the Macro name text
box selected.
Click
2. Type a name for the macro.
The text appears in the Macro name
text box.
Type Chicago
3. To create a shortcut key, select the
Shortcut key text box.
The insertion point appears in the
Shortcut key text box.
Press [Tab]
4. Type the character you want to use as
the shortcut key.
The character appears in the Shortcut
key text box.
Type e
5. Select the Store macro in list.
A list of options appears.
Click the Store macro in

Lesson 6 - Recording Macros Microsoft Excel Level 4
Page 88 Vicon Learning Systems

Steps Practice Data
6. Select the desired location.
The location appears in the Store
macro in text box.
Click This Workbook
7. Select the text in the Description text
box.
The text in the Description text box is
selected.
Press [Tab]
8. Type a macro description.
The text appears in the Description
text box.
Type Opens the Chicago
workbook
9. Select OK.
The Record Macro dialog box closes,
the word Recording appears on the
status bar, and the Stop Recording
toolbar appears.
Click OK
10. Record the first step of the macro.
The first step of the macro is recorded.
Click
11. Continue recording the steps of the
macro.
The steps of the macro are recorded.
Double-click Chicago
12. Click the Stop Recording button on
the Stop Recording toolbar.
The Stop Recording toolbar
disappears, the macro stops recording,
and the steps are saved in a module
attached to the workbook.
Click

Close the Chicago workbook. Open the Visual Basic Editor window and view the
macro by clicking the Modules folder and double-clicking Module2 in the Project
Explorer window. Press [Alt+F11] to view the workbook.

Run the Chicago macro to test it by clicking the Run Macro button on the Visual
Basic toolbar, selecting Chicago, and then selecting the Run command. Close the
Chicago workbook.
ASSIGNING A SHORTCUT KEY
Discussion
You can assign a shortcut key, which is a combination of keystrokes, to a macro either
when you create a macro or after the macro has been created. If a shortcut key has
Microsoft Excel Level 4 Lesson 6 - Recording Macros
Vicon Learning Systems Page 89

been assigned to a macro, the macro runs when the keystrokes are pressed. All macro
keyboard shortcuts must begin with the [Ctrl] key followed by a character or the
[Ctrl+Shift] key combination followed by a character.

When a shortcut key is assigned while a macro is created, it appears as a comment in
the macro. When a shortcut key is assigned to an existing macro, a comment is not
automatically created. You can edit the macro text and manually add the comment, if
desired.



Shortcut keys can be assigned before you record a macro by
entering a shortcut key in theRecord Macro dialog box.




You should avoid assigning shortcut keys to macros that are
the same as the standard Excel shortcuts (e.g., [Ctrl+B],
[Ctrl+S]) because the standard Excel shortcuts will be
overridden by the macro shortcuts.


Step-by-Step
Assign a shortcut key to a macro.

If necessary, enable the macros and display the Visual Basic toolbar.

Steps Practice Data
1. Click the Run Macro button.
The Macro dialog box opens.
Click
2. Select the name of the macro to which
you want to assign the shortcut key.
The macro name is selected.
Click Atlanta, if
necessary
3. Select Options.
The Macro Options dialog box opens
with the insertion point in the Shortcut
key text box.
Click Options...
4. Type a letter.
The letter appears in the Shortcut key
text box.
Type a
5. Select OK.
The Macro Options dialog box closes.
Click OK
Lesson 6 - Recording Macros Microsoft Excel Level 4
Page 90 Vicon Learning Systems

Steps Practice Data
6. Select the Close button in the Macro
dialog box.
The Macro dialog box closes and the
shortcut key is assigned to the macro.
Click in the Macro
dialog box

Use the [Ctrl+a] shortcut key combination to test the Atlanta macro. Close the
Atlanta workbook.
USING RELATIVE REFERENCES
Discussion
Absolute and relative references describe how the macro records the cell locations you
are using in the worksheet. If you are using absolute references, Excel records the
absolute or exact locations of cells. For example, if, while recording, you enter the
label Annual Sales Report in cell A4, this label will always appears in cell A4 in a
worksheet when you execute the macro. If you are using relative references, Excel
records cell locations relative to the cell from which you start the macro. For example,
if you enter the label Annual Sales Report with relative referencing, you can
reproduce this label in any cell of any worksheet by activating a cell and running the
macro. Relative references give the macro more flexibility.

Step-by-Step
Use relative references to create a macro.

If necessary, enable the macros and display the Visual Basic toolbar.

Select cell A14.

Steps Practice Data
1. Click the Record Macro button on the
Visual Basic toolbar.
The Record Macro dialog box opens
with the text in the Macro name text
box selected.
Click
2. Type a name for the macro.
The text appears in the Macro name
text box.
Type Company
Microsoft Excel Level 4 Lesson 6 - Recording Macros
Vicon Learning Systems Page 91

Steps Practice Data
3. Select OK.
The Record Macro dialog box closes,
the word Recording appears on the
status bar, and the Stop Recording
toolbar appears.
Click OK
4. Click the Relative Reference button
on the Stop Recording toolbar.
The Relative References button is
activated.
Click
5. Record the first step of the macro.
The first step of the macro is recorded.
Click
6. Continue recording the steps of the
macro.
The steps of the macro are recorded.
Follow the instructions
shown below the table
before continuing on to
the next step
7. Click the Stop Recording button on
the Visual Basic toolbar.
The Stop Recording toolbar
disappears, the macro stops recording,
and the steps are saved in a module
attached to the workbook.
Click

Use the Formatting toolbar to format the current cell with a bold and italic style, and
change the font size to 14 points. Type Worldwide Sporting Goods into the current
cell and press [Enter].

Return to the table and continue on with the next step.

Delete row 14 to remove the text and formatting. Select cell A2 and run the Company
macro to test it.

Switch to the Visual Basic Editor window to view the Company macro and the macro
code. Switch to the worksheet.
ASSIGNING A MACRO TO A MENU
Discussion
You can assign a macro to a menu. You can choose in which menu you want the
macro to appear. The macro appears as a menu command item to which you can give
a specific name.

Lesson 6 - Recording Macros Microsoft Excel Level 4
Page 92 Vicon Learning Systems

The command appears on the menu whether the workbook containing the macro is
open or closed. You can execute the macro with any workbook, just as you would
execute any standard menu command. The workbook containing the macro needs to
be open for the macro to execute. If the workbook is not open when you execute the
command, Excel automatically opens the workbook and then executes the command.

If you want to be able to select a custom menu item from the menu, using the
keyboard, you type an ampersand (&) before the letter you want to appear underlined.
For example, &Report appears as Report in the menu, while Re&port appears as
Report.

Assigning a macro to a menu



It may be necessary to move the Customize dialog box in
order to drag the Custom Menu Item command from the
Commands list box to the desired location on the menu.


Step-by-Step
Assign a macro to a menu.

If necessary, enable the macros.

Microsoft Excel Level 4 Lesson 6 - Recording Macros
Vicon Learning Systems Page 93

Steps Practice Data
1. Right-click any toolbar.
The toolbar shortcut menu appears.
Right-click any toolbar
2. Select the Customize command.
The Customize dialog box opens.
Click Customize...
3. Select the Commands tab.
The Commands page appears.
Click the Commands tab
4. Select Macros from the Categories
list box.
The contents in the Commands list box
change accordingly.
Scroll as necessary and
click Macros
5. Select the Tools menu.
The Tools menu appears.
Click Tools
6. Drag Custom Menu Item from the
Commands list box to the desired
position on the Tools menu.
The mouse pointer changes into a
rectangle and a box with a plus sign
(+) next to it, a horizontal bar appears
on the menu indicating the position of
the item, and then the custom menu
item appears on the Tools menu.
Drag Custom Menu Item
between Macro and Add-
Ins...
7. Select Modify Selection in the
Customize dialog box.
The Modify Selection menu appears.
Click Modify Selection
8. Click the Name text box label to select
the text.
The text in the Name text box is
selected.
Click the Name text box
label
9. Type the new name for the custom
item.
The name appears in the Name text
box.
Type &Company Name
10. Select the Assign Macro command on
the Modify Selection menu.
The Assign Macro dialog box opens.
Click Assign Macro...
11. Select the macro you want to assign to
the custom item from the Assign
Macro dialog box.
The macro name is selected.
Click Company
Lesson 6 - Recording Macros Microsoft Excel Level 4
Page 94 Vicon Learning Systems

Steps Practice Data
12. Select OK to close the Assign Macro
dialog box.
The Assign Macro dialog box closes.
Click OK
13. Select Close to close the Customize
dialog box.
The Customize dialog box closes and
the macro is assigned to the menu.
Click Close

Save the City57 workbook and close it. Create a new blank workbook. Select any cell
and test the Company macro by selecting theCompany Name command from the
Tools menu. Enable macros when Excel opens the City57 workbook.

Close the blank workbook without saving it.
DELETING A MACRO FROM A MENU
Discussion
Once you assign a macro to a menu item, the macro is available for all worksheets. If
you no longer want to access the macro from the menu, the menu item can be deleted.



You can also remove a macro by right-clicking the Tools
menu, selecting the Customize command, selecting the
desired menu, and then dragging the macro off the menu.


You do not have to have any workbook open to delete a menu
item.


Step-by-Step
Delete a macro from a menu.

Steps Practice Data
1. Right-click any toolbar.
The toolbar shortcut menu appears.
Right-click any toolbar
2. Select the Customize command.
The Customize dialog box opens.
Click Customize
Microsoft Excel Level 4 Lesson 6 - Recording Macros
Vicon Learning Systems Page 95

Steps Practice Data
3. From the menu bar, select the menu
containing the macro you want to
delete.
The menu is selected.
Click Tools
4. Right-click the macro you want to
delete.
The macro is selected and a shortcut
menu appears.
Right-click Company
Name
5. Select the Delete command.
The macro is deleted from the menu.
Click Delete
6. Select Close.
The Customize dialog box closes.
Click Close

DELETING A MACRO
Discussion
If you no longer use a macro, you can delete it. Since macros can invoke other
macros, you should make sure that the macro you are deleting is not used by another
macro.

If a macro is stored in a workbook, the workbook must be open in order to delete the
macro. If the macro is stored in the Personal Macro Workbook, which automatically
loads as a hidden window each time you open Excel, the window must be unhidden
before the macro can be deleted.



You can unhide the Personal Macro Workbook by selecting
the Window menu and then selecting the Unhide command.
In the Unhide dialog box, select Personal.xls and then select
OK. The Personal.xls workbook will appear in the worksheet
window. After unhiding the workbook, you can use the Macro
dialog box to delete unwanted macros. When you have
finished deleting macros, you should hide the Personal.xls
window.


If you delete a macro from the Personal Macro Workbook,
Excel prompts you to save the changes to the Personal Macro
Workbook when you exit the application.

Lesson 6 - Recording Macros Microsoft Excel Level 4
Page 96 Vicon Learning Systems


You can also open the Macro dialog box by selecting the
Tools menu, pointing to the Macro submenu, and then
selecting the Macros command.


Step-by-Step
Delete a macro.

If necessary, enable the macros and display the Visual Basic toolbar.

Steps Practice Data
1. Click the Run Macro button.
The Macro dialog box opens.
Click
2. Select the macro you want to delete.
The macro name is selected.
Click Company
3. Select Delete.
The Macro dialog box closes and a
warning box opens, asking you to
confirm the deletion.
Click Delete
4. Select Yes.
The warning box closes and the macro
is deleted from the workbook.
Click Yes

Close CITY57.XLS.
Microsoft Excel Level 4 Lesson 6 - Recording Macros
Vicon Learning Systems Page 97

EXERCISE
RECORDING MACROS
Task
Record macros.

1. Open Exer82 and enable the macros.
2. Display the Last Year worksheet.
3. Record a macro to be stored in the workbook. Call it
Report_Landscape. Assign a shortcut key of [Ctrl+l] (lowercase
letter l). Add the description Formats landscaped report.
4. Open the Page Setup dialog box. On the Page page, select the
Landscape option and change the Fit to page(s) to 2 pages tall. On
the Margins page, change the top and bottom margins to .75, and
center the page horizontally. On the Header/Footer page, enter the
right aligned custom header Regional Report. On the Sheet page,
enter 2:5 in the Rows to repeat at top text box and then select OK.
5. Stop recording the macro. Open the Visual Basic Editor window to
view the macro. Open the Code window and display Module3, if
necessary.


Lesson 6 - Recording Macros Microsoft Excel Level 4
Page 98 Vicon Learning Systems

6. Close the Visual Basic Editor window.
7. Assign the Report_Landscape macro to the Tools menu, below the
Macro command. Call it Regional Report.
8. Switch to the Projections worksheet. Preview the worksheet. Close
the Preview window.
9. Use the new Regional Report command on the Tools menu to run
the Report_Landscape macro on the Projections worksheet.
Preview the worksheet again. Notice that the macro has been
executed. Close the Preview window.
10. Switch to the Last Year worksheet. Select cell A1, if necessary.
Begin recording a macro called Today. Store the macro in the
workbook.
11. Apply a relative reference condition to the Today macro.
12. Format cell A1 for bold text and a red font color. Type =today() in
cell A1 and press [Enter].
13. Stop recording the macro.
14. Switch to the Projections worksheet. Select cell A2. Run the Today
macro.
15. Clear the format and contents from cell A2. (Hint: Select the All
command from the Clear submenu.)
16. Assign the [Ctrl+Shift+D] shortcut key to the Today macro.
17. Use the shortcut key to run the Today macro in cell A1 in the
Projections worksheet.
18. Open the Customize dialog box. Delete the Regional Report
command from the Tools menu. Close the Customize dialog box.
19. Delete the Today macro.
20. Close the workbook without saving it.



LESSON 7 -
EDITING MACROS
In this lesson, you will learn how to:
Write a new macro
Enter macro comments
Copy macro commands
Edit macro commands
Type macro commands
Run a macro from the Code window
Lesson 7 - Editing Macros Microsoft Excel Level 4
Page 100 Vicon Learning Systems

WRITING A NEW MACRO
Discussion
New macros can be created by recording the steps or by typing the commands directly
into the Visual Basic Editor window. A new macro is created when you type the word
Sub, followed by the macro name and a left and right parenthesis ( () ) into a
modules Code window. Excel automatically supplies the End Sub command. All
steps in the procedure are entered between the Sub and End Sub commands.

New macros can be placed at the end of the last macro in an existing module, or you
can insert a new module. You can also insert a new macro between two existing
macros. The position of the macro in the module does not affect its performance.



You can insert a new module into a Visual Basic project by
selecting the Insert menu and then selecting the Module
command. A new module with an incremental number, such
as Module 3, will be inserted into the current project or
workbook.


When you create a new macro under an existing one, the
Visual Basic Editor automatically inserts a horizontal line
between the macros to separate them.


Step-by-Step
From the Student Data directory, open CITY58.XLS.
Write a new macro.

If necessary, enable the macros.

Display the Visual Basic toolbar and click the Visual Basic Editor button. Expand
the Modules, and display the Code window for Module 1.

Steps Practice Data
1. Position the insertion point under any
existing macros.
The insertion point appears in the
desired position in the Code window.
Press [Ctrl+End]
Microsoft Excel Level 4 Lesson 7 - Editing Macros
Vicon Learning Systems Page 101

Steps Practice Data
2. Type the command Sub.
The text Sub appears in the Code
window.
Type Sub
3. Press [Spacebar] as necessary to
continue any previous line spacing.
Spaces appear in the line as
appropriate.
Press [Spacebar]
4. Type the name of the macro followed
by a left and right parenthesis.
The text appears in the Code window.
Type Open_Cities()
5. Press [Enter].
A horizontal line appears above the
Sub command and the End Sub
command is inserted below the Sub
command.
Press [Enter]

Press [Down] as necessary to view the End Sub command.
ENTERING MACRO COMMENTS
Discussion
When macros are first recorded, the recording process creates lines in the macro that
document the name, date, and other macro descriptions. This information appears
before the actual macro statements. If you make a change to a macro, you should go
into the documentation area of the macro and add information explaining the change.
For example, if you add a shortcut key to a macro after the macro has been recorded,
this information is not automatically added to the macro documentation. You must
add a line manually to explain the change.

In longer and more complex macros, you should add comments to the macros.
Comments can explain what a step or series of steps does. This knowledge can be
helpful in the future if someone else must change or debug the macro.

Comments begin with a single apostrophe ('). Excel treats any line that begins with an
apostrophe as a comment. Comments can appear on their own line or next to a
statement in the macro. Comments display in black text when they are entered and
change to green text when you proceed to another line.

Lesson 7 - Editing Macros Microsoft Excel Level 4
Page 102 Vicon Learning Systems

Step-by-Step
Enter macro comments.

If necessary, enable the macros, open the Visual Basic Editor window, expand the
Modules, and display the Code window for Module 1.

Steps Practice Data
1. Position the insertion point at the line
where you want to insert a comment.
The insertion point appears in the
desired location.
Click in the blank line
above the End Sub
command
2. Press [Enter] to insert a blank line.
A blank line appears in the macro.
Press [Enter]
3. Type an apostrophe ().
The apostrophe () appears on the line.
Type '
4. Press [Spacebar] as necessary to
continue any previous line spacing.
Spaces appear in the line as
appropriate.
Press [Spacebar]
5. Type the text for the comment.
The comment text appears in the
macro.
Type This macro opens
three city files

Press [Enter] to insert another line in the macro. Notice that the comment text
becomes green.

Practice the Concept: Display the Code window for Module 2. In the Company
macro, click in the blank line above the command Selection.Font.Bold = True. Type
the comment ' Formats the current cell.

Press [Down] as necessary and click at the end of the End With command in the
same macro and press [Enter] to create a new line. Press [Home] to move to the left
margin and enter the comment ' Inserts the company name. Click another line to
view the text color change.
COPYING MACRO COMMANDS
Discussion
There may be times when you want to combine macros for a more efficient operation.
For example, you recorded three macros to open three separate workbooks. You can
Microsoft Excel Level 4 Lesson 7 - Editing Macros
Vicon Learning Systems Page 103

combine the steps of these macros to open all three workbooks using one macro by
copying and pasting the command statements from one macro to another. Macro
commands can be copied from other macros, modules, or from other workbooks.

Copying macro commands saves the time it takes to re-record or write the macro
command again.

Copying macro text between modules



If an error occurs while running a macro, a Microsoft Visual
Basic dialog box opens. You can select the End button to
discontinue running the macro. If you select the Debug button,
the Visual Basic Editor window opens with the command that
created the error highlighted. You can fix the error and click
the Continue button on the Standard toolbar to continue the
macro, or you can click the Reset button on the Standard
toolbar to end the debug function.


Lesson 7 - Editing Macros Microsoft Excel Level 4
Page 104 Vicon Learning Systems

Step-by-Step
Copy macro text between modules.

If necessary, enable macros, open the Visual Basic Editor and expand the Modules.

Display the Code window for Module 1.

Steps Practice Data
1. Select the macro steps you want to add
to another macro.
The macro steps are selected.
Drag to select the macro
step Workbooks.Open
Filename:=
NEWYORK.XLS in
the NewYork macro
2. Click the Copy button.
The text is copied to the Windows
Clipboard.
Click
3. Position the insertion point as
necessary in the macro text in the
Code window.
The insertion point appears in the
desired location.
Click in the Open_cities
macro above the End Sub
command
4. Add blank lines, as necessary.
Blank lines are added to the macro.
Press [Enter] to add a
blank line
5. Click the Paste button.
The new macro lines are copied to the
macro.
Click

Practice the Concept: Copy the macro step which opens the Atlanta workbook from
the Atlanta macro and paste it to the Open_Cities macro below the New York step.
Display the Code window for Module 2 and copy the macro step which opens the
Chicago workbook from the Chicago macro and paste it to the Open_Cities macro in
Module 1 below the Atlanta step.

Close the Visual Basic Editor window. Run the Open_Cities macro. Run the
Close_Cities macro to close the Newyork, Atlanta, and Chicago workbooks.
Microsoft Excel Level 4 Lesson 7 - Editing Macros
Vicon Learning Systems Page 105

EDITING MACRO COMMANDS
Discussion
Depending on the changes you need to make, it may be easier to make minor changes
to a module using standard editing techniques rather than deleting the entire macro
and recording it again. Using these standard editing techniques, you can make changes
to text that is entered as part of a macro.

You can edit a macro manually, just as you would edit any other document text. You
simply locate the macro in the module and add, change, or delete the individual macro
step or portions of the macro steps as desired.

Editing a macro manually



You can rename a macro by changing the macro name in the
Sub command. The new name will appear in the Macro dialog
box. You may want to change any associated comments,
descriptions, or shortcut keys. Changing the comment lines
that include descriptions or shortcut keys in the Code window
will not change the actual description or shortcut key for the
macro. You must use the Options button in the Macro dialog
box to make those changes.

Lesson 7 - Editing Macros Microsoft Excel Level 4
Page 106 Vicon Learning Systems


You can change the name of a module in the Visual Basic
Editor window by selecting the module name in the Project
Explorer window and replacing the (Name) field text in the
Properties window.




It is important that you edit only the portions of the macro
with which you are familiar. If you do not use the correct
syntax and punctuation for the command statements, the
macro may work incorrectly or not at all.

Step-by-Step
Edit macro commands manually.

If necessary, enable the macros and display the Visual Basic toolbar.

Steps Practice Data
1. Select the Run Macro button.
The Macro dialog box opens.
Click
2. Select the macro you want to edit.
The macro name is selected.
Click Open_Cities
3. Select Edit.
The Macro dialog box closes, the
Visual Basic Editor window opens, the
appropriate module appears, and the
insertion point appears next to the
macro you want to edit.
Click Edit
4. Select the text you want to change.
The text is selected.
Double-click
NEWYORK in the
Open_Cities macro
5. Type the new text.
The new text appears in the macro.
TypeTAMPA

Practice the Concept: Display Module 2 and press [Down] as necessary to view the
Close_Cities macro. Replace NEWYORK with TAMPA in the first
Workbooks().Close command.

Switch to the workbook window and run the Open_Cities macro. The macro should
now open the Tampa workbook instead of the Newyork workbook. Use the
Close_Cities macro to close the Tampa, Atlanta, and Chicago workbooks.
Close CITY58.XLS.
Microsoft Excel Level 4 Lesson 7 - Editing Macros
Vicon Learning Systems Page 107

TYPING MACRO COMMANDS
Discussion
In addition to recording macro commands, you can also type them directly into a
macro procedure. Macro procedures work with statements and objects. Some macro
steps, such as statements, are not recordable. For example, you may want to create a
condition that executes specific macro commands if the condition is true and other
commands if the condition is false.

Objects are the elements that a macro acts upon, such as a workbook, worksheet,
range, cell, or chart. A collection is a set of multiple objects. The worksheets in a
workbook are part of a collection. You use VBA (Visual Basic for Applications)
commands to change the properties of an object or collection, and apply a method
(action) to the object. The properties and methods differ depending upon the object.

When entering a command, you must use the proper syntax. The syntax of a command
is the structure of the command elements. As you type commands in the Visual Basic
Editor window, lists may pop-up indicating available properties or methods.

There is often more than one way to perform the same action. You can record a macro
that deletes the contents in the range A6:F12 in the Sales worksheet. The steps would
be recorded using selection methods, since you would be manually selecting the
worksheet and range.

Sheets(SALES).Select
Range(A6:F12).Select
Selection.ClearContents

You can accomplish the same results by writing a command that applies a method to
the specified object. The object is the range A6:F12 in the Sales worksheet. The
command assumes that the correct workbook is open. The command can be written
without the Worksheets property if the command to activate that worksheet was
issued in a previous step.

Worksheets(SALES).Range(A6:F12).ClearContents

If a group of commands are recordable, it is easier to record the steps in a separate
macro and then copy and paste the steps into the larger macro than to write them
directly into the macro in the Code window.
Lesson 7 - Editing Macros Microsoft Excel Level 4
Page 108 Vicon Learning Systems


Inserting a macro line



The Visual Basic Editor provides a variety of help features. As
you type a command, pop-up help may appear. The Auto
Quick Info box and the Auto List Member list both provide
help with either parameters or available methods and
properties. The syntax of your command is automatically
verified when you finish the command and move to another
line.


Step-by-Step
From the Student Data directory, open CITY59.XLS.
Write a macro command.

If necessary, enable macros.

Open the Open_Cities macro.

Microsoft Excel Level 4 Lesson 7 - Editing Macros
Vicon Learning Systems Page 109

Steps Practice Data
1. Position the insertion point at the line
where you want to insert a command.
The insertion point appears in the
desired location.
Click at the end of the
Workbooks.Open
Filename:=
CHICAGO.XLS
2. Press [Enter] to insert a blank line.
A blank line appears in the macro.
Press [Enter]
3. Type the desired command.
The command appears in the Code
window and an Auto Quick Info box
may appear.
Type
workbooks(city59.xls)
4. To enter a property or method, type a
period (.).
An Auto List Member list appears
with a list of the available properties
or methods displayed.
Type .
5. Type the desired property or method
or select it from the Auto List
Member list.
The property or method appears in the
command.
Double-click Activate
6. Move to another line to allow
automatic verification of the syntax.
The command syntax is verified.
Press [Enter]

Press [Alt+F11] to switch to the worksheet window. Run the Open_Cities macro.
When the macro ends, the City59 workbook should be the active workbook. Run the
Close_Cities macro to close the city workbooks.
RUNNING A MACRO FROM THE CODE WINDOW
Discussion
During the editing process, a macro can be run directly from within the Visual Basic
Editor window using the Run Sub/UserForm button or the Run Sub/UserForm
command on the Run menu. If you use the Run menu, you must position the insertion
point in the Code window within the text of the macro you want to run. If the insertion
point is not located within the text of the macro, the Macro dialog box opens, from
which you can select and run the desired macro.



You can also run a macro directly from within the Visual
Basic Editor window by pressing the [F5] key.
Lesson 7 - Editing Macros Microsoft Excel Level 4
Page 110 Vicon Learning Systems



Step-by-Step
Run a macro from the Code window.

If necessary, enable macros.

Open the Visual Basic Editor window, display Module 3 and click in the
Urban_Update macro in the Code window. View the macro commands. The macro
opens the Tampa, Atlanta, and Chicago workbooks, consolidates the data in the
City59 workbook. The macro also runs the CleanUp, Company, and Close_Cities
macros.

Steps Practice Data
1. Click the Run Sub/UserForm button
on the Standard toolbar.
The macro processes the visual basic
commands and then it runs.
Click on the
Standard toolbar

Close the Visual Basic Editor window. The macro opened the Tampa, Atlanta, and
Chicago workbooks, consolidated the data in the City59 workbook, formatted the
data, and closed the city workbooks.

Notice that the sales for week 1 in cell C6 is $10,703. Open the Atlanta workbook
and change cell C7 from 3250 to 9250. Close and save the workbook. Run the
Urban_Update macro from the workbook window. Notice that the new consolidated
value in cell C6 is $16,703.
Close CITY59.XLS.
Microsoft Excel Level 4 Lesson 7 - Editing Macros
Vicon Learning Systems Page 111

EXERCISE
EDITING MACROS
Task
Edit macros with the Visual Basic Editor.

1. Open Exer83 and enable the macros.
2. Display the Visual Basic toolbar.
3. Open the Visual Basic Editor window and display the contents of
Module2 in the Codewindow.
4. In the Report_Landscape macro, locate the command
.LeftHeader = and insert the text Subtotals inside the quotation
marks. The edited text should read Subtotals.
5. Display the contents of Module1 in the Code window.
6. Go to the top of the Code window and press [Enter] twice to move
the Sub Sort_RegionSales() command down.
7. Go to the top of the Code window, enter the procedure command
Sub Sort_RegionLastN() and press [Enter].
8. Enter the comment Sorts regions by sales reps last name and press
[Enter] twice.
9. Copy the all the macro steps in the Sort_RegionSales macro to the
Sort_RegionLastN. (Hint: Make sure that you include the Range
command and the three lines of the Selection command.)
10. In the Sort_RegionLastN macro, change the cell reference in
Key2:=Range(J6) to A6. The command should read
Key2:=Range(A6). Change the Order2:=xlDescending argument
to Order2:=xlAscending.
Lesson 7 - Editing Macros Microsoft Excel Level 4
Page 112 Vicon Learning Systems



11. Switch to the worksheet window and run the Sort_RegionLastN
macro.
12. Run the Report_Landscape macro. Preview the worksheet to see if
Subtotals is included in the header. Close the Preview window.
13. Switch to the Visual Basic Editor window and display the Code
window for Module2.
14. In the Report_Landscape macro, place the insertion point in the
blank line above the first command With ActiveSheet.PageSetup.
15. Type SubTotals_Region to insert the name of the macro that creates
subtotals for the regions.
16. Run the macro (the Report_Landscape macro) from within the
Visual Basic Editor window using the Run Sub/UserForm button.
17. Switch to the worksheet window and preview the worksheet. Close
the Preview window.
18. Hide the Visual Basic toolbar.
19. Close the workbook without saving it.



LESSON 8 -
USING CUSTOM TOOLBARS AND BUTTONS
In this lesson, you will learn how to:
Create a custom toolbar
Add a button to a toolbar
Add a custom button
Assign a macro to a button
Change a button image
Display button text and images
Attach a custom toolbar
Delete a custom toolbar
Lesson 8 - Using Custom Toolbars and Buttons Microsoft Excel Level 4
Page 114 Vicon Learning Systems

CREATING A CUSTOM TOOLBAR
Discussion
You can create a custom toolbar in Excel. This option allows you to group buttons
you use together on one toolbar, rather than displaying several toolbars at once.

Custom toolbars are not saved with a workbook. They are added to the structure of the
Excel program. Therefore, custom toolbars are available for use with any workbook.
The toolbar name appears on the toolbar shortcut menu and on the Toolbars page in
the Customize dialog box.

Creating a custom toolbar

Step-by-Step
From the Student Data directory, open MAC8.XLS.
Create a custom toolbar.

Microsoft Excel Level 4 Lesson 8 - Using Custom Toolbars and Buttons
Vicon Learning Systems Page 115

Steps Practice Data
1. Right-click any toolbar.
The toolbar shortcut menu appears.
Right-click any toolbar
2. Select the Customize command.
The Customize dialog box opens.
Click Customize
3. Select the Toolbars tab.
The Toolbars page appears.
Click the Toolbars tab
4. Select New.
The New Toolbar dialog box opens
with the text in the Toolbar name text
box selected.
Click New...
5. Type the name of the new toolbar.
The name appears in the Toolbar
name text box.
Type Toolbar1
6. Select OK.
The New Toolbar dialog box closes,
the new toolbar name appears in the
Toolbars list box in the Customize
dialog box, and a blank toolbar
appears on the screen.
Click OK
7. Select Close.
The Customize dialog box closes.
Click Close

Drag the newly customized toolbar to the left corner of the worksheet so that it will
not be covered by the Customize dialog box when it is opened in the future.
ADDING A BUTTON TO A TOOLBAR
Discussion
Once you have created a custom toolbar, you can add buttons to it. Excel provides
many more buttons than those that are available on the built-in toolbars that come
standard with Excel. These additional buttons are listed in the Customize dialog box.
To display a description of the selected button, you can use the Description button at
the bottom of the Commands tab. These buttons can be added, changed, deleted, or
moved when the Customize dialog box is open. In order to customize a toolbar,
however, it must be visible.
Lesson 8 - Using Custom Toolbars and Buttons Microsoft Excel Level 4
Page 116 Vicon Learning Systems


Adding a button to a toolbar

Step-by-Step
Add a button to a toolbar.

If necessary, display the Toolbar1 custom toolbar.

Steps Practice Data
1. Right-click any toolbar.
The toolbar shortcut menu appears.
Right-click any toolbar
2. Select the Customize command.
The Customize dialog box opens.
Click Customize
3. Select the Commands tab.
The Commands page appears.
Click the Commands tab
4. Select the desired category from the
Categories list box.
The corresponding commands and
buttons appear in the Commands list
box.
Click File in the
Categories list box, if
necessary
Microsoft Excel Level 4 Lesson 8 - Using Custom Toolbars and Buttons
Vicon Learning Systems Page 117

Steps Practice Data
5. Select the desired command and
button you want to appear on the
toolbar from theCommands list box.
The command and button are selected.
Scroll as necessary and
click Print... in the
Commands list box
6. Drag the desired button onto the
custom toolbar.
The mouse pointer changes into a
white arrow attached to a rectangle
with a box next to it; a vertical bar
appears in the toolbar, indicating the
position of the button; and then the
button appears on the toolbar.
Drag onto the
Toolbar1 toolbar

Leave the Customize dialog box open.
ADDING A CUSTOM BUTTON
Discussion
In addition to the buttons that execute commands, Excel provides several generic
buttons you can customize by attaching a macro. These buttons are listed in the
Commands list box in the Customize dialog box.

Adding a custom button
Lesson 8 - Using Custom Toolbars and Buttons Microsoft Excel Level 4
Page 118 Vicon Learning Systems


Step-by-Step
Add a custombutton to a toolbar.

If necessary, display the Toolbar1 custom toolbar, open the Customize dialog box,
and display the Commands page.

Steps Practice Data
1. Select the desired category from the
Categories list box.
The corresponding commands and
buttons appear in the Commands list
box.
Scroll as necessary and
click Macros in the
Categories list box
2. Select the desired command and
button you want to appear on the
toolbar from the Commands list box.
The command and button are selected.
Click in the
Commands list box
3. Drag the desired button onto the
custom toolbar.
The mouse pointer changes into a
white arrow attached to a rectangle
with a box next to it; a vertical bar
appears on the toolbar, indicating the
position of the button; and then the
custom button appears on the toolbar.
Drag onto the
Toolbar1 toolbar to the
right of

Leave the Customize dialog box open.
ASSIGNING A MACRO TO A BUTTON
Discussion
Once a custom button has been added to a toolbar, you can assign a macro to it. Once
assigned, the macro will run when the button is clicked.

The buttons on a custom toolbars are available to all workbooks. If you assign a
macro stored in a workbook to a custom button, the macro executes only when the
workbook containing the macro is open. If the workbook is closed when you select the
button, Excel automatically opens the workbook containing the macro and prompts
you to enable macros.

Microsoft Excel Level 4 Lesson 8 - Using Custom Toolbars and Buttons
Vicon Learning Systems Page 119

Step-by-Step
Assign a macro to a custom button.

If necessary, display the Toolbar1 custom toolbar, open the Customize dialog box,
and display the Commands page.

Steps Practice Data
1. Select the custom button to which you
want to assign the macro.
A black border appears around the
button and the button is selected.
Click on the
Toolbar1 toolbar
2. Select Modify Selection.
The Modify Selection menu appears.
Click Modify Selection
3. Select the Assign Macro command.
The Assign Macro dialog box opens.
Click Assign Macro...
4. Select the macro you want to assign to
the custom button.
The macro name appears in the Macro
name text box.
Click Today
5. Select OK.
The Assign Macro dialog box closes
and the macro is attached to the
custom button.
Click OK
6. Select Close.
The Customize dialog box closes.
Click Close

Select cell A5 and click the custom button on the custom toolbar. Notice that the
executed macro inserts todays date into the selected cell.
CHANGING A BUTTON IMAGE
Discussion
When a custom button has been added to a custom toolbar, the default image is used
on the button. You may want the image on the button to more closely resemble the
operation of the macro that has been assigned to the button. Therefore, Excel allows
you to change the button image by providing a number of other toolbar button images.
Lesson 8 - Using Custom Toolbars and Buttons Microsoft Excel Level 4
Page 120 Vicon Learning Systems


Changing the image on a button

Step-by-Step
Change a button image.

If necessary, display the Toolbar1 custom toolbar.

Steps Practice Data
1. Right-click any toolbar.
The toolbar shortcut menu appears.
Right-click any toolbar
2. Select the Customize command.
The Customize dialog box opens.
Click Customize
3. Select the Commands tab.
The Commands page appears.
Click the Commands tab,
if necessary
4. Select the toolbar button for which you
want to change the image.
A black border appears around the
button and the button is selected.
Click on the
Toolbar1 toolbar
5. Select Modify Selection.
The Modify Selection menu appears.
Click Modify Selection
Microsoft Excel Level 4 Lesson 8 - Using Custom Toolbars and Buttons
Vicon Learning Systems Page 121

Steps Practice Data
6. Point to the Change Button Image
command.
A palette of images appears.
Point to Change Button
Image
7. Select the image you want to appear
on the toolbar button.
The new image appears on the button.
Click

Leave the Customize dialog box open.
DISPLAYING BUTTON TEXT AND IMAGES
Discussion
You can further clarify the operation of a custom button by adding text to it. You can
display an image only, text only, or both an image and text on a button.

Adding an image and text is especially helpful to someone unfamiliar with a
workbook you have created.

Displaying a button with text and an image

Lesson 8 - Using Custom Toolbars and Buttons Microsoft Excel Level 4
Page 122 Vicon Learning Systems

Step-by-Step
Display both the image and text on a toolbar button.

If necessary, display the Toolbar1 custom toolbar, open the Customize dialog box,
and display the Commands page.

Steps Practice Data
1. Select the toolbar button on which you
want to display both the image and
text.
The button is selected.
Click on the
Toolbar1 toolbar
2. Select Modify Selection.
The Modify Selection menu appears.
Click Modify Selection
3. Click the Name text box label to select
the text.
The text in the Name text box is
selected.
Click the Name text box
label
4. Type the text you want to appear on
the toolbar button.
The text appears in the Name text box.
Type Date
5. Select the Image and Text command.
The image and text are added to the
toolbar button.
Click Image and Text
6. Select Close.
The Customize dialog box closes.
Click Close

ATTACHING A CUSTOM TOOLBAR
Discussion
When you create a custom toolbar, it is stored as a system setting and, therefore, is
available to all workbooks. Custom toolbars can also be attached to a specific
workbook.

The advantage to attaching a custom toolbar in a workbook is that the toolbar will be
available to any computer system that opens the workbook. If you intend to share a
workbook or copy the workbook to another system, it is a good idea to attach the
custom toolbar to the workbook so that anyone can use the toolbar buttons.

Microsoft Excel Level 4 Lesson 8 - Using Custom Toolbars and Buttons
Vicon Learning Systems Page 123

Once a user opens a workbook containing a custom toolbar, the toolbar appears in the
list of available toolbars, even when the workbook is closed.

Attaching a custom toolbar



You can use the Attach Toolbars dialog box to attach and
remove custom toolbars from a workbook. The Copy button
changes to a Delete button when you click a toolbar in the
Toolbars in workbook list box.


Step-by-Step
Attach a custom toolbar to a workbook.

Steps Practice Data
1. Right-click any toolbar.
The toolbar shortcut menu appears.
Right-click any toolbar
2. Select the Customize command.
The Customize dialog box opens.
Click Customize
3. Select the Toolbars tab.
The Toolbars page appears.
Click the Toolbars tab
Lesson 8 - Using Custom Toolbars and Buttons Microsoft Excel Level 4
Page 124 Vicon Learning Systems

Steps Practice Data
4. Select Attach.
The Attach Toolbars dialog box opens
with a list of custom toolbars
displayed.
Click Attach...
5. Select the custom toolbar name from
the Custom toolbars list box.
The custom toolbar name is selected.
Click Toolbar1
6. Select Copy.
The toolbar name is copied to the
Toolbars in workbook list box.
Click Copy >>
7. Select OK.
The Attach Toolbars dialog box closes.
Click OK
8. Select Close.
The Customize dialog box closes and
the custom toolbar is now attached to
the workbook.
Click Close
9. Save the workbook.
The custom toolbar is saved with the
workbook.
Click

Practice the Concept: Open the Customize dialog box and display the Attach
Toolbars dialog box. Select Toolbar1 in the Toolbars in workbook list box and use
the Delete button to remove the toolbar from the workbook. Close all dialog boxes
and save the workbook.
DELETING A CUSTOM TOOLBAR
Discussion
You can delete any custom toolbar you no longer need. This option removes the
toolbar from the Excel program, making it unavailable to any workbooks. A
workbook does not have to be open to delete a custom toolbar.



A deleted custom toolbar will be added back to your Excel
program if you open a workbook that was saved with the
custom toolbar attached.


Microsoft Excel Level 4 Lesson 8 - Using Custom Toolbars and Buttons
Vicon Learning Systems Page 125

Step-by-Step
Delete a custom toolbar.

Steps Practice Data
1. Right-click any toolbar.
The toolbar shortcut menu appears.
Right-click any toolbar
2. Select the Customize command.
The Customize dialog box opens.
Click Customize...
3. Select the Toolbars tab.
The Toolbars page appears.
Click the Toolbars tab
4. Select the toolbar you want to delete.
The toolbar name is selected.
Scroll as necessary and
click Toolbar1
5. Select Delete.
A Microsoft Excel warning box opens,
asking you to confirm the deletion.
Click Delete
6. Select OK.
The Microsoft Excel warning box
closes and the toolbar is deleted from
the worksheet and the Toolbars list
box in the Customize dialog box.
Click OK
7. Select Close
The Customize dialog box closes.
Click Close

Close MAC8.XLS.
Lesson 8 - Using Custom Toolbars and Buttons Microsoft Excel Level 4
Page 126 Vicon Learning Systems

EXERCISE
USING CUSTOM TOOLBARS AND BUTTONS
Task
Work with custom toolbars and buttons.

1. Open Exer84 and enable the macros.
2. Create a custom toolbar called Reports.
3. Add the Print... button to the toolbar.
4. Add a custom button to the right of the Print button on the toolbar.
5. Assign the macro Report_Landscape to the custom toolbar button.
6. Change the name of the custom toolbar button to Regions and
display the image and text.
7. Change the image of the custom toolbar button. Select the first image
in the sixth row on the palette of images.
8. Add another custom button and name the button Resets Report.
Assign the Reset macro to the button.
9. Test the Regions button that creates a regional subtotals report and
formats the printed report for landscaping.
10. Test the Resets Report button that removes the subtotals and resets
the page formatting to portrait orientation.
11. Attach the toolbar to the worksheet.
12. Detach the toolbar from the worksheet.
13. Delete the custom toolbar.
14. Close the workbook without saving it.



LESSON 9 -
CREATING A MACRO BUTTON
In this lesson, you will learn how to:
Use a macro button
Create a macro button
Copy a macro button
Format a macro button
Move/Size a macro button
Delete a macro button
Lesson 9 - Creating a Macro Button Microsoft Excel Level 4
Page 128 Vicon Learning Systems

USING A MACRO BUTTON
Discussion
You can create macro buttons in a worksheet that, when clicked, run a particular
macro. Macro buttons can simplify your work, automate repetitive tasks, or help an
inexperienced user perform various worksheet tasks.

You can draw macro buttons anywhere on a worksheet. Like other graphic objects,
macro buttons float above the worksheet. You can create as many macro buttons as
desired to perform a number of different tasks.

Step-by-Step
From the Student Data directory, open CITY60.XLS.
Use a macro button.

If necessary, enable the macros.

Steps Practice Data
1. Click the macro button.
The macro attached to the button
executes.
Click Open Atlanta

Close the Atlanta workbook that was opened by the macro.
CREATING A MACRO BUTTON
Discussion
You create a macro button on a worksheet using the Forms toolbar. You can also size
the macro and position it anywhere on the worksheet. After you draw the button, the
Assign Macro dialog box opens in which you assign a macro to the button. When the
button is clicked, the macro attached to the button runs.
Microsoft Excel Level 4 Lesson 9 - Creating a Macro Button
Vicon Learning Systems Page 129


Creating a macro button

Step-by-Step
Create a macro button.

If necessary, enable the macros.

Display the Forms toolbar and reposition the toolbar on the left of the worksheet as
desired.

Steps Practice Data
1. Click the Button button on the Forms
toolbar.
The mouse pointer changes into a
crosshair when positioned over the
worksheet.
Click
2. Drag to create a button.
An outline of the button appears as
you drag, the button appears in the
worksheet, and then the Assign Macro
dialog box opens.
Drag from the middle of
cell G4 to the bottom
middle of cell I5
Lesson 9 - Creating a Macro Button Microsoft Excel Level 4
Page 130 Vicon Learning Systems

Steps Practice Data
3. Select the macro you want to assign to
the button.
The macro name is selected.
Click Chicago
4. Select OK.
The Assign Macro dialog box closes
and the macro is assigned to the
button.
Click OK
5. Drag to select the text on the button.
The text on the button is selected.
Drag to select the text on
the button
6. Type the new text.
The new text appears on the button.
Type Open Chicago
7. Deselect the button.
The button is deselected.
Click in any blank cell

Test the macro button. Notice that the Chicago workbook opens. Close the Chicago
workbook and the Forms toolbar.
COPYING A MACRO BUTTON
Discussion
You can create macro buttons quickly by copying existing ones. This option is useful
if you need several similar macro buttons on a worksheet. When you copy macro
buttons, you can ensure that the buttons are the same size and shape.
Microsoft Excel Level 4 Lesson 9 - Creating a Macro Button
Vicon Learning Systems Page 131


Copying a macro button

Step-by-Step
Copy a macro button.

If necessary, enable the macros.

Steps Practice Data
1. Hold [Ctrl] and position the mouse
pointer over the button you want to
copy.
A plus sign (+) appears next to the
mouse pointer.
Hold [Ctrl] and position
the mouse pointer over the
Open Chicago button
2. Drag a copy of the button to the
desired location.
An outline of the button appears as
you drag and then a copy of the button
appears on the worksheet.
Drag a copy of the button
so that the left edge of the
button is in the middle of
cell G7
3. Deselect the button.
The button is deselected.
Click in any blank cell
Lesson 9 - Creating a Macro Button Microsoft Excel Level 4
Page 132 Vicon Learning Systems

Steps Practice Data
4. Right-click the copy of the button to
display the shortcut menu.
A shortcut menu appears.
Right-click the copy of the
Open Chicago button
6. Select the Assign Macro command.
The Assign Macro dialog box opens.
Click Assign Macro
7. Select the macro you want to assign to
the button.
The macro name is selected.
Click NewYork
8. Select OK.
The Assign Macro dialog box closes
and the macro is assigned to the
button.
Click OK
9. Drag to select the text on the button.
The text is selected.
Double-click the text
Chicago on the copy of
the Open Chicago button
10. Type the new text.
The new text appears on the button.
Type New York
11. Deselect the button.
The button is deselected.
Click in any blank cell

Test the new macro button. Notice that the Newyork workbook opens. Close the
Newyork workbook.
FORMATTING A MACRO BUTTON
Discussion
You can format text on a macro button in much the same way that you format text on
a worksheet. You select the entire button and format all the text or just selected text.



To select a macro button for editing, hold the [Ctrl] key and
click it. Otherwise, the macro attached to the button runs when
you click the button.


Microsoft Excel Level 4 Lesson 9 - Creating a Macro Button
Vicon Learning Systems Page 133

Step-by-Step
Format a macro button.

If necessary, enable the macros.

Steps Practice Data
1. To format all the button text, hold
[Ctrl] and click the macro button to
select it.
Selection handles appear around the
button.
Hold [Ctrl] and click the
Open Chicago button
2. Select the desired formatting option.
The text is formatted. Click
3. To format selected button text, hold
[Ctrl] and click the macro button to
select it.
Selection handles appear around the
button.
Hold [Ctrl] and click the
Open Atlanta button
4. Select the text you want to format.
The text is selected.
Double-click Atlanta
5. Select the desired formatting option.
The text is formatted.
Click
6. Deselect the button.
The button is deselected.
Click in any blank cell

Practice the Concept: Bold all the text in all the buttons and italicize all the city
names.
MOVING/SIZING A MACRO BUTTON
Discussion
You can move or size a macro button the same way that you move or size a graphic
object on a worksheet. In order to move or size a macro button, you must first select
it.
Lesson 9 - Creating a Macro Button Microsoft Excel Level 4
Page 134 Vicon Learning Systems


Moving and sizing a macro button



To select a macro button for moving or sizing, hold the [Ctrl]
key and click it. Otherwise, the macro attached to the button
runs when you click the button.


Step-by-Step
Move and size a macro button.

If necessary, enable the macros.

Steps Practice Data
1. To move the macro button, hold [Ctrl]
and click the button to select it.
Selection handles appear around the
button.
Hold [Ctrl] and click the
Open Atlanta button
2. Point to the button you want to move.
The mouse pointer changes into a
single, white arrow with a black, four-
headed arrow attached to it.
Point to a border of the
Open Atlanta button
Microsoft Excel Level 4 Lesson 9 - Creating a Macro Button
Vicon Learning Systems Page 135

Steps Practice Data
3. Drag the button to a new location on
the worksheet.
An outline of the button appears as
you drag and then the button appears
in the new location.
Drag the Open Atlanta
button below the Open
New York button
4. To size the macro button, hold [Ctrl]
and click the button to select it.
Selection handles appear around the
button.
Hold [Ctrl] and click the
Open Chicago button
5. Point to the button you want to size.
The mouse pointer changes into a
black, double-headed arrow.
Point to the top center
selection handle of the
Open Chicago button
6. Drag one of the handles to size the
button.
The button adjusts accordingly as you
drag and then the button is sized.
Drag the top center
selection handle of the
Open Chicago button to
the bottom of row 2

DELETING A MACRO BUTTON
Discussion
You can delete any macro buttons you no longer need. This option prevents you from
accidentally using macros that no longer work correctly. When you delete a macro
button, only the button itself is deleted. The attached macro is not deleted.

Lesson 9 - Creating a Macro Button Microsoft Excel Level 4
Page 136 Vicon Learning Systems

Step-by-Step
Delete a macro button.

If necessary, enable the macros.

Steps Practice Data
1. Hold [Ctrl] and click the macro button
to select it.
Selection handles appear around the
button.
Hold [Ctrl] and click the
Open Chicago button
2. Press [Delete].
The button is deleted.
Press [Delete]

Close CITY60.XLS.
Microsoft Excel Level 4 Lesson 9 - Creating a Macro Button
Vicon Learning Systems Page 137

EXERCISE
CREATING A MACRO BUTTON
Task
Create and work with macro buttons on a worksheet.

1. Open Exer85 and enable the macros.
2. Display the Forms and Visual Basic toolbars.
3. Display the Visual Basic Editor and view the macros in Module3.
The Eastern, Southern, Midwestern, and Western macros use the
advanced filter feature to copy records to columns O to S. The
ClearOutput macro clears the copy range.
4. Close the Visual Basic Editor window and scroll to cell M1.
5. Draw a button in the range M7:M8.
6. Assign the Eastern macro to the button.
7. Name the button Eastern Sales.
8. Italicize the text in the button.
9. Test the button.
10. Copy the button so that the top left corner of it is in cell M3. Assign
the ClearOutput macro and rename the copied button Clear
Report. Click in a blank cell to deselect the button.
11. Test the Clear Report button.
12. Create three more buttons under the Eastern Sales button. Assign
the Southern, Midwestern, and Western macros to the buttons.
Change the button names accordingly.
13. Test all the buttons.
14. Move the Clear Report button below the last button in column M.
15. Enlarge the size of the Clear Report button so that it also extends to
column N.
Lesson 9 - Creating a Macro Button Microsoft Excel Level 4
Page 138 Vicon Learning Systems



16. Delete the Eastern Sales button.
17. Close the Forms and Visual Basic toolbars.
18. Close the workbook without saving it.



LESSON 10 -
USING WORKSHEET PROTECTION
In this lesson, you will learn how to:
Unlock cells in a worksheet
Protect a worksheet
Unprotect a worksheet
Protect workbook windows
Unprotect workbook windows
Assign a password
Open a protected file
Remove a password
Set manual calculation
Set automatic calculation
Lesson 10 - Using Worksheet Protection Microsoft Excel Level 4
Page 140 Vicon Learning Systems

UNLOCKING CELLS IN A WORKSHEET
Discussion
You can control access to a worksheet by locking or unlocking cells in the worksheet.
If worksheet protection is activated, you cannot change the contents of any locked
cell. If you want to allow changes to some cells, you must unlock those cells before
you activate worksheet protection.

Normally, you unlock the cells you want to use for data entry and lock cells which
have formulas in them so that the formulas cannot be changed. For example, you
could lock all cells on a sales worksheet except for those cells in which sales figures
are entered. You can also lock text in a worksheet.



Although cells are locked by default, this option has no effect
on a worksheet unless the worksheet is protected.


Step-by-Step
From the Student Data directory, open PROJ3.XLS.
Unlock cells in a worksheet.

In order to enter information only in cells E3 and E4, you must unlock those cells
before you protect the worksheet.

Steps Practice Data
1. Select the cell or range you want to
unlock.
The cell or range is selected.
Drag E3:E4
2. Select the Format menu.
The Format menu appears.
Click Format
3. Select the Cells command.
The Format Cells dialog box opens.
Click Cells...
4. Select the Protection tab.
The Protection page appears.
Click the Protection tab
5. Deselect the Locked option.
The Locked option is deselected.
Click Locked to
deselect it
Microsoft Excel Level 4 Lesson 10 - Using Worksheet Protection
Vicon Learning Systems Page 141

Steps Practice Data
6. Select OK.
The Format Cells dialog box closes
and the cells are unlocked.
Click OK

Click anywhere in the worksheet to deselect the range.
PROTECTING A WORKSHEET
Discussion
Once you have unlocked cells, you can prevent changes to the rest of the worksheet
by protecting it. Protecting a worksheet prevents unauthorized or accidental changes
to formulas. For example, if you have unlocked cells E3 and E4 only, all the
remaining cells are protected. You can only enter data in cells E3 and E4.

When you protect a worksheet, you can select whether or not you want to protect the
contents of the cells, the graphic objects, and/or the scenarios. You can select the
desired options in the Protect Sheet dialog box.

A password is optional. Passwords can contain any combination of letters, numbers,
symbols, and spaces, and can be up to 255 characters. Passwords are case-sensitive.
For example, CLASS is a different password than class.

Protecting a worksheet

Lesson 10 - Using Worksheet Protection Microsoft Excel Level 4
Page 142 Vicon Learning Systems



When you protect a worksheet, many commands and toolbar
buttons are no longer available.


You can protect the worksheet structure from being deleted,
hidden, or moved and the worksheet window from being
hidden, moved, or resized by assigning a password to the
workbook in the Protect Workbook dialog box. To open the
Protect Workbook dialog box, select the Tools menu, point to
the Protection command, and then select the Protect
Workbook command.




If you forget the password for a protected worksheet, you
cannot unprotect the worksheet.


Step-by-Step
Protect a worksheet.

If necessary, unlock cells E3 and E4.

Steps Practice Data
1. Select the Tools menu.
The Tools menu appears.
Click Tools
2. Point to the Protection command.
The Protection submenu appears.
Point to Protection
3. Select the Protect Sheet command.
The Protect Sheet dialog box opens
with the insertion point in the
Password text box.
Click Protect Sheet...
4. Type the desired password, if
necessary.
Asterisks appear in the Password text
box, one for each character in the
password.
Typeclass
Microsoft Excel Level 4 Lesson 10 - Using Worksheet Protection
Vicon Learning Systems Page 143

Steps Practice Data
5. Select OK.
The Protect Sheet dialog box closes or,
if you typed a password, the Confirm
Password dialog box opens with the
insertion point in the Reenter
password to proceed. text box.
Click OK
6. Type the password again, if necessary.
Asterisks appear in the Reenter
password to proceed. text box, one for
each character in the password.
Type class
7. Select OK, if necessary.
The Confirm Password and the Protect
Sheet dialog boxes close and the sheet
is protected.
Click OK

Select cell D8 and try to type the word test. A Microsoft Excel message box opens,
informing you that the cell is protected and you cannot edit it. Select OK to close the
message box.

Type 20 in cell E3 and 15 in cell E4. You can change the content of these cells
because they are the only ones unlocked in the worksheet.
UNPROTECTING A WORKSHEET
Discussion
Even if you have protected a worksheet, you can unprotect it. If you used a password
to protect the worksheet, however, you must know the password to unprotect it.

After you have unprotected the worksheet, you can make changes to any cell in it.

Lesson 10 - Using Worksheet Protection Microsoft Excel Level 4
Page 144 Vicon Learning Systems

Step-by-Step
Unprotect a worksheet.

Steps Practice Data
1. Select the Tools menu.
The Tools menu appears.
Click Tools
2. Point to the Protection command.
The Protection submenu appears.
Point to Protection
3. Select the Unprotect Sheet command.
If a password was used to protect the
worksheet, the Unprotect Sheet dialog
box opens with the insertion point in
the Password text box.
Click Unprotect Sheet...
4. Type the required password, if
necessary.
Asterisks appear in the Password text
box, one for each character in the
password.
Type class
5. Select OK.
The Unprotect Sheet dialog box closes
and the sheet is unprotected.
Click OK

Select cell D8 and type the word test. Since the worksheet is now unprotected, the
word appears in the cell. Delete the word test.
PROTECTING WORKBOOK WINDOWS
Discussion
You can protect workbook windows. When you protect a workbook window, the
Minimize Window, Maximize Window, and Close Window buttons are removed.
As a result, the window cannot be moved or sized. This option is useful if you have
arranged the windows and want to prevent them from being changed.

In addition to protecting a window, you can prevent structural changes to a workbook.
For example, if a workbook structure is protected, you are unable to insert, delete, or
move worksheets.

A password is optional. Passwords are case-sensitive. For example, CLASS is a
different password than class.
Microsoft Excel Level 4 Lesson 10 - Using Worksheet Protection
Vicon Learning Systems Page 145




If you forget the password for a protected workbook, you
cannot unprotect the workbook.


Step-by-Step
Protect workbook windows.

Click the Restore Window button to display the workbook in a window rather than in
a maximized size.

Steps Practice Data
1. Select the Tools menu.
The Tools menu appears.
Click Tools
2. Point to the Protection command.
The Protection submenu appears.
Point to Protection
3. Select the Protect Workbook
command.
The Protect Workbook dialog box
opens with the insertion point in the
Password text box.
Click Protect
Workbook...
4. Type the desired password, if
necessary.
Asterisks appear in the Password text
box, one for each character in the
password.
Type class
5. Under Protect workbook for, select
the desired options.
The desired options are selected.
Click Windows
6. Select OK.
The Protect Workbook dialog box
closes and, if you typed a password,
the Confirm Password dialog box
opens with the insertion point in the
Reenter password to proceed. text box.
Click OK
7. Type the password again, if necessary.
Asterisks appear in the Reenter
password to proceed. text box, one for
each character in the password.
Type class
Lesson 10 - Using Worksheet Protection Microsoft Excel Level 4
Page 146 Vicon Learning Systems

Steps Practice Data
8. Select OK.
The Confirm Password dialog box
closes and the workbook window is
protected.
Click OK

Notice that the Minimize Window, Maximize Window, and Close Window buttons
no longer appear in the workbook window. Try to resize the window by dragging.
Notice that you unable to do this.
UNPROTECTING WORKBOOK WINDOWS
Discussion
When you unprotect a workbook window, the Maximize Window, Minimize
Window, and Close Window buttons are restored and the window can be resized.
You can also perform structural changes (such as inserting, deleting, or moving
worksheets) in an unprotected workbook.

If a password has been used to protect a workbook, you must know the password to
unprotect it.



If you forget the password, you cannot unprotect the
workbook.


Step-by-Step
Unprotect workbook windows.

Steps Practice Data
1. Select the Tools menu.
The Tools menu appears.
Click Tools
2. Point to the Protection command.
The Protection submenu appears.
Point to Protection
Microsoft Excel Level 4 Lesson 10 - Using Worksheet Protection
Vicon Learning Systems Page 147

Steps Practice Data
3. Select the Unprotect Workbook
command.
If a password was used to protect the
workbook, the Unprotect Workbook
dialog box opens with the insertion
point in the Password text box.
Click Unprotect
Workbook...
4. Type the required password, if
necessary.
Asterisks appear in the Password text
box, one for each character in the
password.
Type class
5. Select OK.
The Unprotect Workbook dialog box
closes and the workbook window is
unprotected.
Click OK

Notice that the Minimize Window, Maximize Window, and Close Window buttons
reappear in the workbook window. Maximize the window.
ASSIGNING A PASSWORD
Discussion
You can assign a password to a file so that only those users who know the password
can open or save changes to the file.

Passwords can contain any combination of letters, numbers, symbols, and spaces, and
can be up to 15 characters. Passwords are case-sensitive. After a password has been
assigned, you are prompted for the password each time you open the document.

Passwords are often assigned to files that contain sensitive data, such as salaries or
bonuses. They can also be used to secure files that are stored on a network.
Lesson 10 - Using Worksheet Protection Microsoft Excel Level 4
Page 148 Vicon Learning Systems


Assigning a password



If you forget the assigned password, you cannot open the file.


Step-by-Step
Assign a password to a file.

Steps Practice Data
1. Select the File menu.
The File menu appears.
Click File
2. Select the Save As command.
The Save As dialog box opens.
Click Save As...
3. Select the Tools button.
The Tools menu appears.
Click Tools
4. Select the General Options command.
The Save Options dialog box opens
with the insertion point in the
Password to open text box.
Click General Options...
Microsoft Excel Level 4 Lesson 10 - Using Worksheet Protection
Vicon Learning Systems Page 149

Steps Practice Data
5. Type the desired password.
Asterisks appear in the Password to
open text box, one for each character
in the password.
Type class
6. Select OK.
The Save Options dialog box closes
and the Confirm Password dialog box
opens with the insertion point in the
Reenter password to proceed. text box.
Click OK
7. Type the password again.
Asterisks appear in the Reenter
password to proceed. text box, one for
each character in the password.
Type class
8. Select OK.
The Confirm Password dialog box
closes.
Click OK
9. Select Save.
The Save As dialog box closes and a
Microsoft Excel message box opens,
prompting you to overwrite the
existing file.
Click Save
10. Select Yes.
The Microsoft Excel message box
closes and the password is saved with
the file.
Click Yes

Close PROJ3.XLS.
OPENING A PROTECTED FILE
Discussion
Once a file has been saved with a password, you must know the password to open it.
The Password dialog box opens whenever a file has been password-protected.



If you forget the assigned password, you cannot open the file.


Lesson 10 - Using Worksheet Protection Microsoft Excel Level 4
Page 150 Vicon Learning Systems

Step-by-Step
Open a file protected with a password.

Steps Practice Data
1. Click the Open button.
The Open dialog box opens.
Click
2. Select the Look in list.
A list of available drives appears.
Click Look in
3. Select the drive where the file is
stored.
A list of available folders appears.
Click the student data
drive
4. Select the folder where the file is
stored.
A list of available files appears.
Double-click to select the
student data folder
5. Select the file you want to open.
The file name is selected.
Click Proj4 or the file
indicated by your
instructor
6. Select Open.
The Open dialog box closes and the
Password dialog box opens with the
insertion point in the Password text
box.
Click Open
7. Type the required password.
Asterisks appear in the Password text
box, one for each character in the
password.
Type class
8. Select OK.
The Password dialog box closes and
the workbook opens.
Click OK

REMOVING A PASSWORD
Discussion
If a password is no longer necessary, you can remove it from the file. You can then
open the file at any time without a password.

After you remove a password, you must save the file to replace the protected version.
Microsoft Excel Level 4 Lesson 10 - Using Worksheet Protection
Vicon Learning Systems Page 151


Step-by-Step
Remove a password from an existing file.

Type class in the Password dialog box to open the file, if necessary.

Steps Practice Data
1. Select the File menu.
The File menu appears.
Click File
2. Select the Save As command.
The Save As dialog box opens.
Click Save As...
3. Select the Tools button.
The Tools menu appears.
Click Tools
4. Select the General Options command.
The Save Options dialog box opens
with the text in the Password to open
text box selected.
Click General Options...
5. Press [Delete].
The password is deleted.
Press [Delete]
6. Select OK.
The Save Options dialog box closes.
Click OK
7. Select Save.
A Microsoft Excel message box opens,
prompting you to overwrite the
existing file.
Click Save
8. Select Yes.
The Microsoft Excel message box and
the Save As dialog boxes close, and
the password is removed from the file.
Click Yes

SETTING MANUAL CALCULATION
Discussion
When you change any number in a worksheet, all formulas that refer to that number
automatically recalculate. You can specify that the worksheet recalculate manually.
Manual recalculation allows you to change numbers as needed and then recalculate
Lesson 10 - Using Worksheet Protection Microsoft Excel Level 4
Page 152 Vicon Learning Systems

the worksheet only one time. This option can save time when you are working in
large, complex worksheets.

If the recalculation is set to manual, the Calculate indicator appears in the status bar
when any values have changed and formulas need to be recalculated. If the Calculate
indicator is on, the figures displayed in the worksheet may not be accurate. For this
reason, it is a good idea to recalculate before you print the worksheet.

Calculation options are system settings. They are not saved with a workbook. Once
you enable manual calculation, you will have to manually recalculate all worksheets
until you change the calculation back to automatic.

Setting manual calculation



Even if calculation is set to manual, the worksheet
automatically recalculates before every save if the
Recalculate before save option is selected on the Calculation
page in the Options dialog box.


To recalculate all open workbooks, you can select the Calc
Now button on the Calculation page in the Options dialog
box or press the [F9] key. To recalculate only the current
worksheet, you can select the Calc Sheet button on the
Calculation page in the Options dialog box.


Microsoft Excel Level 4 Lesson 10 - Using Worksheet Protection
Vicon Learning Systems Page 153

Step-by-Step
Set manual calculation.

Set the recalculation to manual, edit a cell, and recalculate manually.

Steps Practice Data
1. Select the Tools menu.
The Tools menu appears.
Click Tools
2. Select the Options command.
The Options dialog box opens.
Click Options...
3. Select the Calculation tab.
The Calculation page appears.
Click the Calculation tab
4. Under Calculation, select the Manual
option.
The Manual option is selected.
Click Manual
5. Select OK.
The Options dialog box closes and
recalculation is set to manual.
Click OK

Select cell E3, type 25, and press [Enter]. Notice that the formulas do not recalculate
and the Calculate indicator appears in the status bar.

Press [F9] to recalculate the workbook. Notice that cell B8 changes from 2,140,708 to
2,229,904, cell B10 changes from 1,784,377 to 1,873,573, and the Calculate indicator
no longer appears in the status bar.
SETTING AUTOMATIC CALCULATION
Discussion
Calculation options are system settings. They are not saved with a workbook.
Therefore, if you select manual recalculation for one workbook, you will have to
manually calculate all workbooks until you change the calculation back to automatic.

Lesson 10 - Using Worksheet Protection Microsoft Excel Level 4
Page 154 Vicon Learning Systems

Step-by-Step
Set automatic calculation.

Steps Practice Data
1. Select the Tools menu.
The Tools menu appears.
Click Tools
2. Select the Options command.
The Options dialog box opens.
Click Options
3. Select the Calculation tab.
The Calculation page appears.
Click the Calculation tab,
if necessary
4. Under Calculation, select the
Automatic option.
The Automatic option is selected.
Click Automatic
5. Select OK.
The Options dialog box closes and
recalculation is set to automatic.
Click OK

Select cell E3, type 15, and press [Enter]. Notice that the formulas recalculate
automatically.
Close PROJ4.XLS.
Microsoft Excel Level 4 Lesson 10 - Using Worksheet Protection
Vicon Learning Systems Page 155

EXERCISE
USING WORKSHEET PROTECTION
Task
Use worksheet protection.

1. Open Protect.
2. You want to be able to enter new hours worked every week. Unlock
the range D6:D12.
3. Protect the worksheet. Assign a password of protect.
4. Select cell E11 and type 2. A Microsoft Excel message box opens,
informing you that the cell is protected and you cannot edit it.
5. Unprotect the worksheet, change the type of time in cell E11 to 2.
6. Protect both the structure and windows of the workbook. Use a
password of workbook.
7. Unprotect the workbook.
8. Save the file with a password to open of save, and then close the file.
9. Open Protect. Notice that you must enter the password.
10. Set the recalculation to manual.
11. Select cell D6 and type 7. Notice that the pay in cell G6 does not
change. Recalculate the worksheet manually. Notice that the pay in
cell G6 is now updated.
12. Change the calculation back to automatic.
13. Save the workbook without a password.
14. Close the workbook.


Vicon Learning Systems Page 157

INDEX

AND conditions
using, 53, 54
Arguments
using, 2
Automatic calculation
resetting, 153, 154
Buttons
adding custom to a toolbar, 117, 118
adding to a toolbar, 115, 116
assigning macros to, 118, 119
changing the image, 119, 120
creating macro, 128, 129
deleting macro, 135, 136
displaying text and images, 121, 122
formatting macro, 132
moving macro, 133, 134
sizing macro, 133, 134
Cells
unlocking, 140
Comments
entering in a macro, 101, 102
Data tables
creating a one-variable table, 65, 66
creating a two-variable table, 67, 68
placing formulas in, 64
using, 64
Date functions
formatting, 11, 12
using, 9, 10
Files
assigning passwords, 147
opening protected, 149, 150
removing a password, 150, 151
Financial functions
using, 2, 4
Functions
formatting dates, 11, 12
revising, 12, 13
using, 2
using date, 9, 10
using financial, 2, 4
using logical, 5, 7
HLOOKUP function
using, 41, 43
IF functions
using, 5, 7, 44, 46

Page 158 Vicon Learning Systems

using nested, 47, 48
ISERROR functions
using, 50, 51
Logical functions
limiting the precision of numbers, 59, 60
using, 5, 7
using AND conditions, 53, 54
using ISERROR functions, 50, 51
using nested IF functions, 47, 48
using OR conditions, 55, 56
using ROUND functions, 57, 58
using the IF function, 44, 46
Lookup functions
using, 38
using HLOOKUP, 41, 43
using VLOOKUP, 38, 40
Macro buttons
copying, 130, 131
creating, 128, 129
deleting, 135, 136
formatting, 132
moving, 133, 134
sizing, 133, 134
using, 128
Macros
assigning a shortcut key, 88, 89
assigning to a button, 118, 119
assigning to a menu, 91, 92
copying commands between modules, 102, 104
defining, 72
deleting, 95, 96
deleting from a menu, 94
editing commands manually, 105, 106
entering comments, 101, 102
opening a macro workbook, 72, 73
opening the Visual Basic Editor window, 78, 80
recording, 86, 87
running, 74, 75
running from the Code window, 109, 110
typing commands, 107, 108
using a shortcut key, 76
using absolute references, 90
using relative references, 90
using relative references, 90
using the Visual Basic Editor window, 80, 81
using the Visual Basic toolbar, 77, 78
writing new, 100
Manual calculation
setting, 151, 153
Menus
assigning macros to, 92

Vicon Learning Systems Page 159

deleting macros from, 94
OR conditions
using, 55, 56
Passwords
assigning, 147, 148
opening a protected file, 149, 150
protecting a worksheet, 141, 142
protecting workbook windows, 144, 145
removing, 150, 151
unprotecting a worksheet, 143, 144
unprotecting workbook windows, 146
Range names
applying, 24, 26
assigning, 20
creating 3-D, 30, 31
creating from headings, 22, 23
deleting, 27, 28
jumping to, 18, 19
using, 18
using 3-D names in formulas, 32, 33
using in a 3-D formula, 28, 29
using in a formula, 21, 22
ROUND functions
using, 57, 58
Shortcut keys
assigning to a macro, 89
using to run macros, 76
Toolbars
adding a button, 115, 116
adding a custom button, 117, 118
assigning a macro to a button, 118, 119
attaching custom to a workbook, 122, 123
changing a button image, 119, 120
creating custom, 114
deleting a custom, 124, 125
displaying button text and images, 121, 122
Visual Basic Editor window
opening, 78, 80
using, 80, 81
Visual Basic toolbar
using, 77, 78
VLOOKUP function
using, 38, 40
Workbooks
protecting, 144, 145
unprotecting, 146
Worksheets
protecting, 141, 142
setting automatic calculation, 153, 154
setting manual calculation, 151, 153
unlocking cells, 140

Page 160 Vicon Learning Systems

unprotecting, 143, 144

Вам также может понравиться