You are on page 1of 108

Desktop Mentor

Excel 2007

Advanced
Excel 2007 Advanced

Table of Contents
Importing Data from Access ................................................................................................................ 4
Importing Data into an Existing Workbook ....................................................................................... 4
Opening Access Databases ............................................................................................................. 6
Importing Data from the Web ............................................................................................................... 6
Importing Web Data .......................................................................................................................... 6
Saving a Web Query ........................................................................................................................ 7
Importing Text Files .............................................................................................................................. 9
Importing from Other Data Sources ..................................................................................................10
Importing Data ................................................................................................................................10
Viewing Existing Connections ........................................................................................................12
Sorting Data .........................................................................................................................................13
Sorting Data ....................................................................................................................................13
Sorting by Colour ............................................................................................................................15
Sorting on Multiple Fields ...............................................................................................................15
Filtering Data .......................................................................................................................................16
AutoFilter ........................................................................................................................................16
Text AutoFilter ................................................................................................................................ 17
Number AutoFilter .......................................................................................................................... 18
Top 10 AutoFilter ........................................................................................................................... 19
Advanced Filter ...............................................................................................................................20
Adding Subtotals ................................................................................................................................21
Grouping and Ungrouping Data ........................................................................................................23
Creating Pivot Tables .........................................................................................................................24
Creating a PivotTable .....................................................................................................................24
Hiding Entries .................................................................................................................................26
Drilling Down...................................................................................................................................27
Table Options .................................................................................................................................27
PivotTable Formatting ....................................................................................................................29
Creating Pivot Charts .........................................................................................................................30
Creating a PivotChart .....................................................................................................................30
Hiding Entries .................................................................................................................................32
Freezing Panes ....................................................................................................................................32
Database Functions ............................................................................................................................33
The Names Manager ...........................................................................................................................35
Displaying the Name Manager .......................................................................................................35
Adding Range Names ....................................................................................................................35
Removing Range Names ...............................................................................................................36
Amending Range Names ...............................................................................................................36
The Scenario Manager ........................................................................................................................37
Creating Scenarios .........................................................................................................................37
Displaying Scenarios ......................................................................................................................39
Summary Reports ...........................................................................................................................39
Goal Seek .............................................................................................................................................40
Using the Goal Seeker ...................................................................................................................40

© Hewlett-Packard 2007 Page 1 of 107


Excel 2007 Advanced

Data Tables ..........................................................................................................................................41


One Way Data Tables ....................................................................................................................41
Two Way Data Tables ....................................................................................................................42
Creating If Statements ........................................................................................................................44
Basic If Statements .........................................................................................................................44
If Statements with Multiple Conditions ...........................................................................................45
Nested If Statements ......................................................................................................................46
Creating Lookup Statements .............................................................................................................46
VLOOKUP Functions ......................................................................................................................46
HLOOKUP Functions .....................................................................................................................47
Error Trapping .....................................................................................................................................48
Excel Error Messages ....................................................................................................................49
Date and Text Functions ....................................................................................................................49
Date Functions................................................................................................................................49
Text Functions ................................................................................................................................50
Auditing Workbooks ...........................................................................................................................51
The Watch Window .............................................................................................................................52
Accessing Add-Ins ..............................................................................................................................53
Calculation Options ............................................................................................................................55
Linking Formulas ................................................................................................................................56
Linking Formulas ............................................................................................................................56
Paste Link .......................................................................................................................................56
Maintaining Links ............................................................................................................................58
Adding Comments ..............................................................................................................................59
Setting your User Name .................................................................................................................59
Adding Comments ..........................................................................................................................59
Viewing Comments .........................................................................................................................60
Editing and Removing Comments ..................................................................................................61
Printing Comments .........................................................................................................................61
Sharing a Workbook ...........................................................................................................................62
Opening Workbooks Already in Use...............................................................................................62
Sharing Workbooks ........................................................................................................................63
Sharing Conflicts.............................................................................................................................64
Tracking Changes ...............................................................................................................................65
Accepting and Rejecting Changes ....................................................................................................66
Inspecting Workbooks ........................................................................................................................67
Restricting Permissions .....................................................................................................................69
Restricting Permission in a Workbook ............................................................................................69
Opening a Workbook with Restricted Permission ..........................................................................71
Protecting Worksheets .......................................................................................................................72
Unlocking Cells for Editing ..............................................................................................................73
Unprotecting Worksheets ...............................................................................................................74
Protecting Workbooks ........................................................................................................................75
Creating a Document Workspace ......................................................................................................76
Saving to a Document Workspace ....................................................................................................78
Data Consolidation .............................................................................................................................79

© Hewlett-Packard 2007 Page 2 of 107


Excel 2007 Advanced

Data Validation ....................................................................................................................................81


Setting Validation ............................................................................................................................81
Error Messages ..............................................................................................................................82
Showing Invalid Data ......................................................................................................................84
Saving in HTML Format ......................................................................................................................85
Creating Themes .................................................................................................................................87
Applying Saved Themes.....................................................................................................................90
Customising the Quick Access Toolbar ...........................................................................................91
Recording Macros ...............................................................................................................................92
Showing the Developer Ribbon ......................................................................................................92
Recording Macros...........................................................................................................................93
Relative Recording ..............................................................................................................................94
Running Macros ..................................................................................................................................95
Assigning Macros to the Quick Access Bar.....................................................................................96
Assigning Macros to the Keyboard ...................................................................................................97
Creating Forms ....................................................................................................................................99
Setting Form Control Properties .....................................................................................................100
Linking Forms to Cells ..................................................................................................................100
Setting List Values ........................................................................................................................101
Adding Formulas to Show Form Results ......................................................................................102
Saving Templates ..............................................................................................................................102
Creating Templates ......................................................................................................................103
Using Templates ...........................................................................................................................103
Creating Default Templates ..........................................................................................................104
Macro Security ..................................................................................................................................105
Assigning Macros to Buttons and Images .....................................................................................106
Assigning Macros to Buttons ........................................................................................................106
Assigning Macros to Other Objects ..............................................................................................107

© Hewlett-Packard 2007 Page 3 of 107


Excel 2007 Advanced

Importing Data from Access


Importing Data into an Existing Workbook

If the data you wish to use exists in an Access database, it can be imported into Excel as follows:

 Click in the first cell you wish to populate with the imported data
 Click on the Data ribbon
 Click on the From Access option in the Get External group

 Locate the folder that contains the database you wish to open
 Select the file you wish to open
 Click on Open

If your database contains more than one object (table or query), you will be given a choice of the object to
open. Choose the object and click on OK.

© Hewlett-Packard 2007 Page 4 of 107


Excel 2007 Advanced

The Import Data window will display. Click on OK to insert the data as a table in the selected cell.

If you wish to only import specific data from the database:

 Click on the Properties button in the Import Data window


 Click on the Definition tab
 Click on the drop-down arrow of the Command Type box and choose SQL
 In the Command Text box, type the SQL string for the data you wish to import. For example, to
import all data from the Hotels table that has a rating higher than 2:

 Click on OK
 Click on OK again to import the data

© Hewlett-Packard 2007 Page 5 of 107


Excel 2007 Advanced

If the Access database changes, you can update the workbook by clicking on the Refresh All button on the
Data ribbon.

Opening Access Databases

You can also import an Access database by opening the file directly:

 Click on the Office button and choose Open


 Click on the drop-down arrow of the file type list and choose Access Databases
 Locate the folder that contains the database you wish to open
 Select the file you wish to open
 Click on Open

If prompted, click on the Enable button to enable the data connection:

If your database contains more than one object (table or query), you will be given a choice of the object to
open. Choose the object and click on OK.

Importing Data from the Web


Importing Web Data
You can import data directly from any page on the Internet or your company intranet. Web queries
can be saved and run in as many worksheets as necessary, and can be refreshed to show the latest
figures quickly and easily.

 Click in the first cell you wish to populate with the imported data
 Click on the Data ribbon
 Click on the From Web option in the Get External group

© Hewlett-Packard 2007 Page 6 of 107


Excel 2007 Advanced

 Your browser home page will be shown by default. Locate the page containing the data you wish
to import, by typing the URL in the Address box and clicking on Go

 On the web page, locate the table you wish to import


 Click on the yellow arrow next to the table you want to import - you can select as many tables as
required

 Click on Import

The Import Data window will display. Click on OK to insert the data as a table in the selected cell.

To update the data in a web query, click on the Refresh All button on the Data ribbon.

Saving a Web Query

You can save a web query, to allow you to import the data into another worksheet quickly and easily.

© Hewlett-Packard 2007 Page 7 of 107


Excel 2007 Advanced

 Click in the first cell you wish to populate with the imported data
 Click on the Data ribbon
 Click on the From Web option in the Get External group
 Locate the page containing the data you wish to import, by typing the URL in the Address box
and clicking on Go
 Click on the yellow arrow next to the table you want to import - you can select as many tables as
required
 Click on the Save Query button along the top of the Web Query window

 Type a name for the query, then click on Save

Web queries are saved with the .IQY file extension.

To re-use a saved web query:

 Click on the Office button and choose Open


 Click on the drop-down arrow of the file type list and choose Access Databases
 Locate the folder that contains the web query - by default this will be under your name then
AppData\Roaming\Microsoft\Queries
 Select the file you wish to open
 Click on Open

If prompted, click on the Enable button to enable the data connection:

© Hewlett-Packard 2007 Page 8 of 107


Excel 2007 Advanced

Importing Text Files


To import a text file into an existing workbook:
 Click in the first cell you wish to populate with the imported data
 Click on the Data ribbon
 Click on the From Text option in the Get External group

 Locate the folder that contains the text file you wish to open
 Select the file you wish to open
 Click on Import
 The Text Import Wizard will be displayed. This helps you to arrange the data into appropriate
columns, rather than all data appearing in a single column separated by commas.
 Choose Delimited if the columns should be separated at a set symbol e.g. a comma or tab
 Click on Next
 Choose the delimiter character e.g. Comma
 Ensure the sample displays correctly and click on Finish

© Hewlett-Packard 2007 Page 9 of 107


Excel 2007 Advanced

 You can also open a text file directly by clicking on the Office button and the Open commands.
Choose to show Text Files then locate the file you wish to open.

Importing from Other Data Sources


Importing Data

If your data comes from a source other than Access, the Internet or a text file, you may be able to import
the data using the From Other Sources option.

 Click in the first cell you wish to populate with the imported data
 Click on the Data ribbon
 Click on the From Other Sources option in the Get External group

 Choose From Data Connection Wizard from the drop-down menu

© Hewlett-Packard 2007 Page 10 of 107


Excel 2007 Advanced

 Choose the kind of data connection you wish to make, then click on Next

 Choose the file or server that contains the data you wish to import, then click on Next
 If prompted, choose the table or object you wish to import, then click on Next
 In the final step of the wizard, enter a file name for the connection, as well as a Friendly Name
that can be used to identify the connection again at a later stage
 Click on Finish when the data wizard is complete

© Hewlett-Packard 2007 Page 11 of 107


Excel 2007 Advanced

The Import Data window will display. Click on OK to insert the data as a table in the selected cell.

Viewing Existing Connections

To view all of the external data connections in the current workbook, click on the Existing Connections
button on the Data ribbon.

All connections will be listed:

© Hewlett-Packard 2007 Page 12 of 107


Excel 2007 Advanced

 Open a previously used connection by clicking on the name in the Connection Files on this
Computer list and clicking on Open
 Edit a connection already in the workbook by right-clicking on the name in the Connections in
this Workbook list and choosing Edit Connection Properties

Sorting Data
Sorting Data

It is not necessary to select the entire table before sorting it.

 Click anywhere within the column to be sorted


 On the Home ribbon, click on the Sort and Filter button in the Editing group

The menu options will differ depending on the type of data your column contains:

© Hewlett-Packard 2007 Page 13 of 107


Excel 2007 Advanced

 If sorting a column containing text, choose Sort A-Z or Sort Z-A as required
 If sorting a column containing values, choose Sort Smallest to Largest or Sort Largest to
Smallest as required
 If sorting a column containing dates, choose Sort Oldest to Newest or Sort Newest to Oldest as
required

The field names will remain at the top of the list and all records will be sorted in order of the column
containing the active cell.

Note: Even if you select a specific range in the table, all rows will be sorted when you choose the Sort
command.

You can also sort the table by clicking on the drop-down arrow next to the heading of the column you wish
to sort, then choosing the required sort option from the top of the menu:

© Hewlett-Packard 2007 Page 14 of 107


Excel 2007 Advanced

Sorting by Colour

You can also sort a table by colour, so that cells with a specific text or fill colour will appear together at the
top of the table.

 Click anywhere within the column to be sorted


 On the Home ribbon, click on the Sort and Filter button in the Editing group
 Choose Sort by Colour
 Choose the Fill or Text colour to move to the top of the table

Sorting on Multiple Fields

The sort buttons can also be used to sort in order of more than one field. For example, to sort the following
list in descending order of Airport, with the same airports grouped in descending order of Price:

 First click anywhere in the Airport column and use the Sort Z-A command
 Next, click in the Price column and use the Sort Largest to Smallest command

© Hewlett-Packard 2007 Page 15 of 107


Excel 2007 Advanced

You can also use the Sort button on the Data ribbon to sort by multiple levels:

 Click on the drop-down arrow of the Sort By field and choose the first field to sort by
 Change the Order if required
 Click on the Add Level button
 Click on the drop-down arrow of the Then By field and choose the second field to sort by
 Again, change the Order if required
 Repeat the above 3 steps for each level you wish to add
 Click on OK to sort the data

Filtering Data
AutoFilter

To use AutoFilter:

 If the list does not show arrows next to each heading, turn AutoFilter on by clicking on the Data
ribbon, then on the Filter button in the Sort & Filter group

 Click on the drop-down arrow in the heading of the column you wish to filter
 A list will display all values currently in the column - uncheck all values you want to hide from the
list
 Click on OK

© Hewlett-Packard 2007 Page 16 of 107


Excel 2007 Advanced

To re-display all data:

 Click on the same drop-down arrow and choose (Select All)


 Click on OK to show all data

Text AutoFilter

If the column you are filtering contains text, you can use the Text Filters option to apply custom filtering to
the list. Custom filters allow you set specific criteria to be matched e.g. all entries containing a specific
word, or all entries that end in specific characters.

 Click on the drop-down arrow in the heading of the column you wish to filter
 Click on Text Filters

 Choose the type of comparison you wish to make e.g. Contains or Ends With

© Hewlett-Packard 2007 Page 17 of 107


Excel 2007 Advanced

 Click in the empty box in the top right of the dialog box and enter the text you wish to match
 To add a further condition, click on And if both conditions must be met, or click on Or if either
condition can be met
 Click on the drop-down arrow in the second line and choose the next comparison you wish to
make
 Click in the box next to this and enter the text you wish to match
 Click on OK when complete

For example: The following would show all records that had the word "London" in this field, but only if they
also started with "North".

Number AutoFilter

If the column you are filtering contains values, you can use the Number Filters option to apply custom
filtering to the list e.g. to find all entries greater than 100, or between 50 and 75.

 Click on the drop-down arrow in the heading of the column you wish to filter
 Click on Number Filters

© Hewlett-Packard 2007 Page 18 of 107


Excel 2007 Advanced

 Choose the type of comparison you wish to make e.g. Greater Than or Between

 Click in the empty box in the top right of the dialog box and enter the value you wish to match
 To add a further condition, click on And if both conditions must be met, or click on Or if either
condition can be met
 Click on the drop-down arrow in the second line and choose the next comparison you wish to
make
 Click in the box next to this and enter the value you wish to match
 Click on OK when complete

Top 10 AutoFilter

The Top 10 option allows you to choose the top or bottom number of records in a field - you could use it to
find the top 10 sales or the bottom 5% of salaries.

 In the first box, choose whether to show the top or bottom items from the list
 Choose the number of items to display
 Choose whether to show the specific number of Items or the specified Percent
 Click on OK

© Hewlett-Packard 2007 Page 19 of 107


Excel 2007 Advanced

The Above Average and Below Average commands require no further input. These will work out the
average value in the column, then show all records that have a value above or below this.

Advanced Filter

Advanced filtering is used with more complex criteria or if you wish to copy the filtered list to another
location in the workbook. There are three ranges that are needed to perform an Advanced Filter:

Range Description
List Range This is the entire data list that you wish to filter - all matching records will be
found in this range
Criteria Range This is the area of the worksheet in which you specify what data you want to
find in the data list e.g. all clients in London or all accounts with a balance
exceeding £1000.
Copy To Range All records of the database range that match the specified criteria will be copied
here

Before filtering the list, set up the Criteria range. This should contain the relevant column headings in the
first row and the criteria itself on the following lines. Multiple lines of criteria can be entered, but care should
be taken that conditions are placed on the correct line:

 If both conditions must be met, these should be placed on the same line. The following criteria will
only show Excel courses if they had a level of Advanced:

 If either condition can be met they should be placed on separate lines. The following criteria will
find all Excel courses, regardless of their level, as well as all Advanced courses, regardless of
their subject:

To filter the list:

 Click anywhere in the list you wish to filter


 On the Data ribbon, click on the Advanced button in the Sort & Filter group

 Choose to Copy to another location

© Hewlett-Packard 2007 Page 20 of 107


Excel 2007 Advanced

 Click in the Criteria box, then select the range you have set your criteria in, including the field
names
 Click in the Copy To box, then click on the cell you wish the matching data to be extracted to
 Click on OK

To filter records to a different worksheet, click on the cell you wish to filter to, then click on the Advanced
button on the Data ribbon. Choose Copy to Another Location, then enter the data list and criteria ranges.
Enter the cell on the current sheet you wish to filter to, then click on OK.

Adding Subtotals
This feature automatically calculates totals in the specified column. If the data is sorted correctly,
subtotals will be given for each group of records, with a grand total at the end.

 Sort the data list in the required order and click anywhere in the list
 Click on the Data ribbon
 Click on the Subtotal button in the Outline group

 In the At each change in box, specify the field to be grouped for subtotals
 In the Use Function box, choose the function you want to use the summarise the data in each
group
 In the Add subtotal to list, check each numeric field that you wish to show a total for
 Click on OK

© Hewlett-Packard 2007 Page 21 of 107


Excel 2007 Advanced

An outline is created automatically.

 Click on level 1 to display the grand total only


 Click on level 2 to display sub totals and the grand total
 Click on level 3 to display all data and totals

 Click on the - symbol next to a group to collapse that group, showing on its total
 Click on the + symbol next to a hidden group to show all data again

 To remove subtotals from a list, click on the Subtotals button on the Data ribbon, then on
Remove All.

© Hewlett-Packard 2007 Page 22 of 107


Excel 2007 Advanced

Grouping and Ungrouping Data


You can group and ungroup data in a list to create an outline.

Grouping will read the summary columns and rows in the worksheet i.e. those containing totals, and
place these into the highest level of the outline. Detail columns and rows i.e. those containing the
numbers to be summed, are placed into the lowest level.

There can be up to 8 levels in an outline.

 Create the worksheet in the normal way, ensuring all formula are entered correctly and either
below or to the right of the detail
 Click on the Data ribbon
 Create an outline by clicking on the Group button in the Outline group
 Choose Auto Outline

In the following example, rows 5 and 10 contain subtotals, with row 12 containing the sum of these
sub totals. Column E contains a total for each row. When an Auto Outline is applied, these totals are
put into levels as follows:

An outline is created automatically.


 Click on a level number to hide all data to that level for a column or row
 Click on the - symbol next to a group to collapse that group, showing on its total
 Click on the + symbol next to a hidden group to show all data again
 To remove the outline:
 Click on the Data ribbon

© Hewlett-Packard 2007 Page 23 of 107


Excel 2007 Advanced

 Create an outline by clicking on the Ungroup button in the Outline group


 Choose Clear Outline

Press [Ctrl 8] to hide or display the outline symbols quickly.

Creating Pivot Tables


A PivotTable is a table used to summarise and analyse data from an existing list or worksheet. A
PivotTable is made up of row headings, column headings and intersecting summary data.

This data list:

Could be used to produce this PivotTable:

Creating a PivotTable

To create a PivotTable from a data list or table of information:

 Click on any cell of the list or table


 Click on the Insert ribbon
 Click on the PivotTable button in the Tables group

© Hewlett-Packard 2007 Page 24 of 107


Excel 2007 Advanced

 Ensure the data list range is correct


 Choose the location for the PivotTable. Choose New Worksheet to place the PivotTable on a new
worksheet in the current book or Existing Worksheet to place the PivotTable on an existing sheet
 Click on OK

A blank PivotTable is created in the location specified, with a task bar on the right-hand side where the
PivotTable is built:

To add a field to the PivotTable, drag the field from the field list to the relevant area of the task pane.

 Choose the field you wish to summarise by column, and drag this to the Column Labels box
 Choose the field you wish to summarise by row and drag this to the Row Labels box
 Choose the field that contains the values you wish to summarise for each column and row
heading and drag this to the Values box

© Hewlett-Packard 2007 Page 25 of 107


Excel 2007 Advanced

As you add fields to the task pane, the PivotTable will build automatically on the worksheet.

Hiding Entries

The PivotTable need not include all data from the underlying list - it is possible to hide specific categories or
entries.

 Click on the drop-down arrow of the field used to summarise by row or column - all entries in that
field will be displayed
 Click on the check box of each item you wish to exclude
 Click on OK when complete

© Hewlett-Packard 2007 Page 26 of 107


Excel 2007 Advanced

Drilling Down

Drill Down allows you to double click on any of the summary figures of a PivotTable to view the details that
make up this figure. Double clicking on a sum, for example, would show all figures (and the records) that
make up the sum.

 Double click on the figure you wish to view the detail of


 A new sheet will be created containing the records

For example, double-clicking on the Heathrow total in the example given at the top of this page would show
the following detail sheet:

The sheet can be deleted if no longer required. Right-click over the sheet tab and choose Delete from the
shortcut menu to do this.

Table Options

To change the function used to summarise the table:

 Click on any value in the PivotTable


 Click on the Design ribbon
 Click on the Field Settings button in the Active Field group

 Choose the function you wish to use to summarise the data


 Click on OK

© Hewlett-Packard 2007 Page 27 of 107


Excel 2007 Advanced

Additional PivotTable options can be set as follows:

 Click on the Options button in the PivotTable group of the Design ribbon

 To enter a default value into empty cells, or cells containing errors, enter the appropriate values in
the Format boxes

© Hewlett-Packard 2007 Page 28 of 107


Excel 2007 Advanced

 Click on the Totals & Filters tab and choose whether to show grand totals for columns and/or
rows
 Click on the Data tab and choose whether to refresh the PivotTable automatically each time it's
opened
 Click on OK when all options have been set

If the original data in the worksheet is changed, the PivotTable will NOT automatically update. To update the
PivotTable, select any cell in the table and click in the Refresh button on the Options ribbon.

PivotTable Formatting

The Layout ribbon can be used to format the PivotTable once it's been created.

 Click on the Layout ribbon


 Click on the drop-down arrow of the PivotTable Styles list
 Choose the style you wish to apply to the table

© Hewlett-Packard 2007 Page 29 of 107


Excel 2007 Advanced

Creating Pivot Charts


A pivot chart is used to summarise and analyse data from an existing list or worksheet. A pivot chart
is made up of series fields, category fields and page fields.

This data list:

Could be used to produce this PivotChart:

Creating a PivotChart

To create a PivotChart from a data list or table of information:

 Click on any cell of the list or table


 Click on the Insert ribbon
 Click on the drop-down arrow of the PivotTable button in the Tables group

 Ensure the data list range is correct


 Choose the location for the PivotChart. Choose New Worksheet to place the PivotChart on a new
chart sheet in the current book or Existing Worksheet to place the PivotChart as an object on an
existing sheet
 Click on OK

© Hewlett-Packard 2007 Page 30 of 107


Excel 2007 Advanced

A blank PivotTable and PivotChart is created, with a task bar on the right-hand side where the PivotChart is
built:

To add a field to the PivotChart, drag the field from the field
list to the relevant area of the task pane.

 Choose the field you wish to show in the legend and


drag this to the Legend Fields box
 Choose the field you wish to show along the category
axis of the chart and drag this to the Axis Fields box
 Choose the field that contains the values you wish to
plot on the chart and this to the Values box
 As you add fields to the task pane, the PivotTable and
PivotChart will build automatically on the worksheet.

© Hewlett-Packard 2007 Page 31 of 107


Excel 2007 Advanced

Hiding Entries

The PivotChart need not include all data from the underlying list - it is possible to hide specific categories or
entries.

 On the PivotChart Filter Pane, click on the drop-down arrow of the Axis Field or Legend Field -
whichever you wish to hide entries from
 Click on the check box of each item you wish to exclude
 Click on OK when complete

Freezing Panes
If your data list contains more records than will fit on a single screen, you will have to scroll down to
view records that appear towards the end of your list. As you scroll down, you will lose the headings
at the top of the list.

 To solve this problem, you can freeze your headings on screen so that they always show along
the top.
 Click on the View ribbon
 Click on the drop-down arrow of the Freeze Panes button
 Choose Freeze Panes to freeze all rows above the active cell, and all columns to the left of the
active cell or
 Choose Freeze Top Row to freeze the top row of the data list or
 Choose Freeze Left Column to freeze the left column of the data list

© Hewlett-Packard 2007 Page 32 of 107


Excel 2007 Advanced

Unfreeze the titles by clicking on the drop-down arrow of the Freeze Panes button and choose the Unfreeze
Panes option.

Database Functions
Database functions are used to analyse relevant records in a data list. Only the records that match
the specified criteria will be analysed - any records that don't match this criteria will be ignored.

The following functions can be used to analyse a data list.

Function Example Description


DSUM =DSUM(Database, "Field", Adds the contents of the specified field of the
Criteria) database, but only for those records that match
the criteria.
DAVERAGE =DAVERAGE(Database, "Field", Finds the average of the specified field of the
Criteria) database, but only for those records that match
the criteria.
DMAX =DMAX(Database, "Field", Returns the largest value in the specified field of
Criteria) the database, but only for those records that
match the criteria.
DMIN =DMIN(Database, "Field", Returns the smallest value in the specified field
Criteria) of the database, but only for those records that
match the criteria.

In the following example, the area shaded in yellow is the database range, while the area shaded in
blue is the criteria. The DSum command is used in the pink shaded area to calculate the total balance
of all customers in London:

© Hewlett-Packard 2007 Page 33 of 107


Excel 2007 Advanced

When using database functions, range names can be used to save time and make the formulas
easier to create.

 Select the database range


 Click in the name box above the column headings and type a name for the range e.g. data

 Press [Return]
 Select the criteria range
 Click in the name box above the column headings and type a name for the range e.g. criteria
 Press [Return]
 Once the names have been applied, they can be used in the formula as required. The following
formula would calculate the average balance of all records in the range named data that match
the criteria in the range named criteria:
 =DSUM(database,"balance",criteria)

© Hewlett-Packard 2007 Page 34 of 107


Excel 2007 Advanced

The Names Manager


Range names can be set to refer to any range of cells. The Name Manager allows you to check the
value and formula entered in named ranges, even if these cells are no longer in view on your
worksheet. You can also use the Name Manager to edit and delete range names.

Displaying the Name Manager

To display the Name Manager:

 Click on the Formulas ribbon


 Click on the Name Manager button in the Defined Names group

The Name Manager will be displayed:

Adding Range Names

To add a range name to the worksheet:

 Click on the New button


 Enter a range name in the Name box
 Choose the Scope for the name i.e. how the name will be accessible. Choose Workbook if you
wish to be able to refer to the name from any sheet of the workbook
 Add any comments to describe the range
 Click in the Refers To box, then select the range that the name should refer to in the worksheet
 Click on OK

© Hewlett-Packard 2007 Page 35 of 107


Excel 2007 Advanced

You can show the Name Manager on any sheet to see the values in the named ranges in your worksheet.

Removing Range Names

To remove a range name from the worksheet:

 Click on the Formulas ribbon


 Click on the Name Manager button in the Defined Names group
 Select the name you wish to remove
 Click on the Delete button

This will remove the name from the cell, but leave the cell as is on the worksheet.

Amending Range Names

To amend the range that a name is referring to:

 Click on the Formulas ribbon


 Click on the Name Manager button in the Defined Names group
 Select the name you wish to amend
 Click in the Refers To box at the bottom of the Name Manager and amend the range as required
 Click on the tick button to save the change to the range

© Hewlett-Packard 2007 Page 36 of 107


Excel 2007 Advanced

The Scenario Manager


A scenario is a named set of values that can be substituted into a range of a worksheet. Any formula
referring to this range will be updated accordingly. The Scenario Manager is extremely useful for
comparing the impact of different sets of values on the rest of the worksheet.

This worksheet shows a best-case scenario for profit, with high revenue and comparatively low cost. Cells
B1 and B2 could be saved as a scenario called Best.

This version of the same worksheet shows a worst-case scenario, with low revenue and high cost. Cells B1
and B2 could be saved as a scenario called Worst.

You could switch between the scenarios easily, to see how each impacts all formulas on the worksheet.

Creating Scenarios

To create a scenario:

 Select the cells you wish to save as a scenario


 Click on the Data ribbon
 Click on the What-if Analysis button in the Data Tools group
 Choose Scenario Manager

 The Scenario Manager will display - click on the Add button to add a new scenario
 Enter a name for the scenario in the Scenario Name box
 Ensure the Changing Cells box refers to the correct range in the worksheet
 Click on OK

© Hewlett-Packard 2007 Page 37 of 107


Excel 2007 Advanced

The Scenario Values box will display. Enter the values you want to store in the selected cells for this
scenario

 To create another scenario for the same range, click on Add


 Enter a new Scenario Name and click on OK
 The Scenario Values box will display. Enter the values you want to store in the selected cells for
this scenario
 Repeat the above steps to add more scenarios for the same cells, or click on OK when complete
 Click on Close to return to the worksheet

© Hewlett-Packard 2007 Page 38 of 107


Excel 2007 Advanced

Displaying Scenarios

To display a particular scenario in your worksheet:

 Click on the Data ribbon


 Click on the What-if Analysis button in the Data Tools group
 Choose Scenario Manager

 Choose the scenario you wish to display, then click on Show

You can remove a scenario in the Scenario Manager window by clicking on the name of the scenario, then on
the Delete button.

Summary Reports

The Summary button in the Scenario Manager window can be used to print summary reports about the
scenarios in the worksheet and their associated values.

The following reports can be displayed:

Report Description
Summary Select this option to create an outlined summary report on a separate sheet of the
workbook. The summary report will show the current values in the changing cells,
the values in each scenario and any cells that are affected by the scenarios
PivotTable Select this option to create a pivot table on a separate worksheet. This pivot table
will contain a page field listing all users that have created scenarios in the
worksheet

© Hewlett-Packard 2007 Page 39 of 107


Excel 2007 Advanced

Goal Seek
The Goal Seek command is used to change the result of a formula by changing the value of a cell that
the formula is dependent on.

 Imagine you know the required profit to be made in a certain month, and would like to know the
sales needed to make that profit.
 Cell B1 contains the sales figure as a normal value
 Cell B2 calculates the cost of sales at 35% of the sales figure using the formula =B1*35%
 Cell B3 calculates the profit as sales less cost using the formula =B1-B2
 The goal seek command could be used to change the profit (B3) to a particular result by
increasing or decreasing the sales, and therefore also changing the cost.

Using the Goal Seeker

To use the Goal Seek command to change your formula's result:

 Select the formula you wish to change the result of


 Click on the Data ribbon
 Click on the What-if Analysis button in the Data Tools group
 Choose Goal Seek

 Click in the To Value box and type the desired result for the selected formula
 Click in the By Changing Cell box and either type or select the cell that should change to update
the formula result
 Click on OK to show the proposed result

 Choose OK to set the proposed value, or Cancel to leave as is

© Hewlett-Packard 2007 Page 40 of 107


Excel 2007 Advanced

The Goal Seek command allows you to change only one value to reach your desired goal.

Data Tables
Data tables can supply several answers to a calculation by substituting different values into a formula.
A one-way data table is used to substitute only one value of the formula, while a two-way data table is
used to substitute two values.

One Way Data Tables

One way data tables are used when we have only one value that differs in each formula. In the following
example, we want to work out multiple prices, each based on a different discount percentage.

In this example, the formula in cell B4 calculates the price multiplied by the discount using the formula
=B1*B2. B2 will become the input cell that all values in the first column of the data table range (A4:B11) will
be substituted into in turn.

To create the data table:

 Enter the range of substitute values into a single column (as we have in cells A5 to A11 above)
 In the row above and one column to the right of this column, enter the first formula to be
calculated. At the place in the formula where the value should be substituted, use the address of
any cell outside the data table area. This is known as the input cell, and our input cell in the above
example is B2
 Type any other formula to be calculated to the right of the first. Use the same input cell in each
formula
 Select the range of cells containing the substitute values and formulas but not the input cell
(A4:B11 in the above example)
 Click on the Data ribbon
 Click on the What-if Analysis button in the Data Tools group

© Hewlett-Packard 2007 Page 41 of 107


Excel 2007 Advanced

 Choose Data Table

 Click in the Column Input Cell box and type the reference of the input cell
 Click on OK to calculate all results

For the above example, the following results would be shown:

Two Way Data Tables

Two way data tables are used when we have two values that differ in each formula. In the following
example, we want to work out multiple prices, each based on a different discount percentages and different
starting prices.

In this example, the formula in cell A4 calculates the price multiplied by the discount using the formula
=B1*B2. Both B1 and B2 will become input cells. The first row of values (B4:F4) will be substituted into cell
B1, while the first column of values (A5:A11) will be substituted into B2.

© Hewlett-Packard 2007 Page 42 of 107


Excel 2007 Advanced

To create the data table:

 Enter the first set of substitute values in a single row (as we have in cells B4:F4 above)
 Enter the second set of substitute values in a single column (as we have in cells A5:A11 above)
 In the corner cell type the formula to be calculated. At the place in the formula where the value
from the first or second set should be substituted, use the address of any cells outside the data
table area. Different input cells must be used for each set of values
 Select the range of cells containing the substitute values and formulas but not the input cells
(A4:F11 in the above example)
 Click on the Data ribbon
 Click on the What-if Analysis button in the Data Tools group
 Choose Data Table

 Click in the Row Input Cell box and type the reference of the first input cell (B1 in our example)
 Click in the Column Input Cell box and type the reference of the second input cell (B2 in our
example)
 Click on OK to calculate all results

© Hewlett-Packard 2007 Page 43 of 107


Excel 2007 Advanced

For the above example, the following results would be shown:

Creating If Statements
Basic If Statements

The =IF function performs a conditional calculation. The function tests a condition to see whether it is true
or false. One result is displayed if the condition is true, another if it is false.

The syntax is =IF(Condition, Result if True, Result if False)

The standard comparison operators are used to enter the condition:

Operator Meaning
= Equal to
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
<> Not equal to

To enter an IF statement:

 Click in the cell to contain the formula result


 Type =IF and open brackets (
 Type the condition using the comparison operators listed above
 Type a comma and the result that should appear if the condition is true. This can be a formula to
be calculated, a value to be typed or text to be typed. Text must be enclosed in quotation marks ("
")
 Type a comma and the result that should appear if the condition is false
 Close brackets ) and press [Enter]

© Hewlett-Packard 2007 Page 44 of 107


Excel 2007 Advanced

For example:

If the figure in cell A1 is greater than 2000, the current cell should calculate 5% of the figure in A1. If not,
the current cell should contain zero.

If Statements with Multiple Conditions

The And( ) and Or( ) functions are used to test more than one condition at the same time. The And()
function is used to test multiple conditions when ALL conditions must be met for the condition to be true.

The syntax of the AND statement is: =IF(AND(Condition 1, Condition 2), Result if True, Result if False)

The OR() function is used to test multiple conditions when only ONE of the conditions must be met for the
condition to be true.

The syntax of the OR statement is: =IF(OR(Condition 1, Condition 2), Result if True, Result if False)

To enter an IF statement using AND() or OR():

 Click in the cell to contain the formula result


 Type =IF and open brackets (
 Type And if all conditions should be met, or Or if only one condition should be met, then open a
further set of brackets (
 List all conditions separated by commas and close brackets )
 Type a comma and the result to be shown if ALL conditions are met (if using And) or only one
condition is met (if using Or)
 Type another comma and the result to be shown if the conditions are not met
 Close brackets ) to end the formula

For example:

If both figures in cell A1 and A2 are greater than 2000, the current cell should calculate 5% of the sum of
these figures. If either is less than 2000, the current cell should contain zero.

© Hewlett-Packard 2007 Page 45 of 107


Excel 2007 Advanced

Nested If Statements

Nested =IF statements are used when more than one result can be given depending on the criteria met.
Instead of a single result if true or false, another IF statement is started and another condition tested.

There can be up to 7 levels of nesting in an IF statement:

 Click in the cell to contain the formula result


 Type =IF and open brackets (
 Type the first condition to be tested and type a comma
 If the result if true is a value or formula, type the value or formula and type a comma. If another
condition should be tested, type the IF statement including the result if true and result if false.
Close the brackets of the nested IF
 Type a comma and enter the main statement's result if false. If this is a value or formula, type the
value or formula. If another condition should be tested, type the IF statement including the result
if true and result if false. Close the brackets of the nested IF and the main IF.

For example:

If the figures in cell A1 is greater than 2000, 200 is returned. If not, it is tested again. If it is greater than
1000, 100 is returned. If not, 0 is returned.

Creating Lookup Statements


Lookup functions are similar to =IF functions in that they return a value based on a condition. The
function looks for the criteria in a table of values and returns the matching value from that table.

VLOOKUP Functions

VLOOKUP is used when the lookup table is entered in columns (i.e. vertical).

The following example will look up the value of B1 in the table stored in D2:F6. The result in the third
column of the corresponding row will be displayed.

© Hewlett-Packard 2007 Page 46 of 107


Excel 2007 Advanced

To enter a VLOOKUP function:

 Click on the cell to contain the formula result


 Type =VLOOKUP and open brackets (
 Click on or type the reference of the lookup cell and type a comma
 Select or type the range of the table containing the values. The first column of this table should
contain the values to be matched and should be displayed in ascending order. If the range has
column headings, these should not be included in the selection
 Type a comma, then type the number of the column that contains the value to be displayed (1
being the left-most column)
 Close brackets )
 Press [Enter]

If the function cannot find an exact match for the lookup value, it finds the largest value that is less than the
lookup value.

Using the above example, if cell B1 contained 8, the value 2700 would be returned, even though there is no
application with a code of 8. As 5 is the closest match, the value of this application is given.

This default can be changed by adding FALSE to the end of the lookup statement. Instead of returning the
closest match, an error message will be returned if an exact match is not found.

Using the above example, the function could be updated to: =VLOOKUP(B1,D2:F6,3,FALSE)

HLOOKUP Functions

HLOOKUP is used when the lookup table is entered in rows (i.e. horizontal).

The following example will look up the value of B1 in the table stored in D2:F6. The result in the third
column of the corresponding row will be displayed.

To enter a HLOOKUP function:

 Click on the cell to contain the formula result


 Type =HLOOKUP and open brackets (
 Click on or type the reference of the lookup cell and type a comma
 Select or type the range of the table containing the values. The first row of this table should
contain the values to be matched and should be displayed in ascending order. If the range has
row headings, these should not be included in the selection
 Type a comma, then type the number of the row that contains the value to be displayed (1 being
the top row)
 Close brackets )
 Press [Enter]

© Hewlett-Packard 2007 Page 47 of 107


Excel 2007 Advanced

Error Trapping
Excel has a number of functions that can be used to find errors and other types of values in cells. Each
function returns TRUE or FALSE depending on whether the error or value is found in the cell.

Available functions:

Function Description
=ISBLANK(cell) Returns TRUE if the specified cell is blank
=ISERROR(cell) Returns TRUE if the specified cell contains an error
=ISERR(cell) Returns TRUE if the specified cell contains an error other than #N/A
=ISTEXT(cell) Returns TRUE if the specified cell contains text
=ISNUMBER(cell) Returns TRUE if the specified cell contains a number

For example:

 Cell B1 contains the =ISERROR(A1) function and returns true as there is an error in cell A1
 Cell B2 contains the same function and returns false as there is no error in cell A2
 Cell B3 contains the =ISNUMBER(A3) function and returns true as there is a number in cell A3
 Cell B4 contains the same function and returns false as there is no number in cell A4

Error functions are often combined with IF statements to give different results in a cell depending on
whether a condition is true or false.

For example:

The following example attempts to divide cell A1 by B1. If the division would return an error, the cell will
remain blank. If the division will not return an error, the result will be displayed. This formula has been
copied to the next row, which is blank as an error has occurred when attempting to divide by 0.

© Hewlett-Packard 2007 Page 48 of 107


Excel 2007 Advanced

Excel Error Messages

The following error messages occur when entering a formula in Excel:

Error Meaning
#### This is not actually an error message but simply means that the column is not wide
enough to display the result of the formula - widening the column will fix the error
#DIV/01 The formula is trying to divide by 0. This error can also occur if you are dividing
text rather than values
#N/A No value is available. This error commonly occurs in Lookups when the lookup cell
does not yet contain a value
#NAME? This formula is either referencing a range name that does not exist or is using a
function which is misspelled e.g. =SUMM instead of =SUM
#NUM! There is a problem with a number in the formula. This is often caused by a function
using an unacceptable argument e.g. using a negative number in a function that
will only accept positive numbers
#REF! The formula refers to a cell that is not valid. This can be caused by deleting cells
that other formulas refer to or pasting moved cells over cells that other formulas
refer to
#VALUE! An incorrect argument has been used. This can be caused by referencing a range
of cells when a single cell is required or referencing text when a number is required

Date and Text Functions


Date Functions

The following functions can be used to insert dates and times into the worksheet:

Function Description
=today() Returns the current date which will update each time the file is opened
=now() Returns the current date and time which will update each time the file is
opened

The following functions can be used to manipulate dates in the worksheet:

Function Syntax Description


Day =DAY(date) Returns the day number from the specified date, from 1 to 31
Month =MONTH(date) Returns the month number from the specified date, from 1
(January) to 12 (December)
Year =YEAR(date) Returns the year as a value e.g. 2007
Weekday =WEEKDAY(date) Returns a value representing the day of the week that the
date falls on, where 1 is Sunday and 7 is Saturday
Weeknum =WEEKNUM(date) Returns the week number in the year, from 1 to 52

Remember you can find out the number of days between two dates by subtracting the earlier date from the later
date.

© Hewlett-Packard 2007 Page 49 of 107


Excel 2007 Advanced

Text Functions

As well as manipulating values in a spreadsheet, it is also possible to create formula to manipulate text. For
example, two or more cells can be concatenated using the & operator. In the following spreadsheet, the
name and surname have been concatenated to return the full name:

Whenever text or spaces are added to the formula, be sure to enclose these in quotation marks. Quotation
marks are never needed for cell references or range names.

The following text functions can also be used to manipulate text in cells.

Function Syntax Description


Find =FIND("Text", Reference) Searches for Text in the
referenced cell and returns the
character number where the text
starts
Replace =REPLACE(Reference, Starting Cell, Number, From the starting character, the
"Text") specified number of characters
will be replaced with the Text.
The new cell content is returned.
Len =LEN(Reference) Returns the number of
characters in the specified cell
Trim =TRIM(Reference) Returns the cell contents with all
extra spaces removed
Left =LEFT(Reference, Number of Characters) Returns the specified number of
characters from the left of the
specified cell
Right =RIGHT(Reference, Number of Characters) Returns the specified number of
characters from the right of the
specified cell
Mid =MID(Reference, Starting Character, Number of Returns the specified number of
Characters) characters from the given
starting position of the cell
Upper =UPPER(Reference) Returns the content of the cell in
upper case
Lower =LOWER(Reference) Returns the content of the cell in
lower case
Proper =PROPER(Reference) Returns the content of the cell in
proper case (initial caps)

© Hewlett-Packard 2007 Page 50 of 107


Excel 2007 Advanced

Auditing Workbooks
The Formula Auditing group on the Formulas ribbon is used to trace cells and errors in a worksheet.

 To trace precedents, the cells that the selected formula refers to, click on a formula and then on
the Trace Precedents button on the Formulas ribbon

 To trace dependents, cells that contain formulas that refer to the active cell, click on any cell and
then on the Trace Dependents button on the Formulas ribbon

 Click on the Remove All Arrows button to remove tracing arrows


 The Formula Auditing group also contains a button that can be used to trace errors. This feature
will try to locate the cell that is causing the error in the formula.
 Click on the cell that contains the error
 Click on the drop-down arrow of the Error Checking button on the Formulas ribbon
 Choose Trace Error

© Hewlett-Packard 2007 Page 51 of 107


Excel 2007 Advanced

Arrows will show the cells that the formula refers to, which should allow you to see where the error
lies:

Use the Show Formulas button on the Formulas ribbon to replace formula results with the formulas
themselves, for evaluation and checking purposes.

The Watch Window


The Watch Window allows you to check the value and formula entered in specific cells, even if these
cells are no longer in view on your worksheet. The watch window updates automatically as the cells
change, allowing to you see at a glance what their results are.

 To show the watch window:


 Click on the Formulas ribbon
 Click on the Watch Window button in the Formula Auditing group

 The watch window will display:

You can move the watch window by dragging the title bar of the window to a new position.

To add a cell to the watch window, so that you can always see the value in that cell:

 Click on the cell you wish to add to the watch window


 Click on the Add Watch button near the top left of the watch window
 Click on Add to confirm the cell to be added

© Hewlett-Packard 2007 Page 52 of 107


Excel 2007 Advanced

 You will be able to see the workbook name, sheet name, any range names applied to the cell, the
current value and any formula entered in the cell:

 To remove a cell from the watch window, click on the cell reference, then on the Delete Watch
button.

Close the watch window using the X in the top-right corner of the window.

Accessing Add-Ins
An Add in is a small program that allows you to add additional features and custom commands to Excel
2007.

Some standard Add-ins are available with Excel but you will need to install them after you have installed
the Excel program. In order to access the Excel Add-ins you will need to have the original Microsoft Office
disks, or have access to the Internet to obtain the add-ins from Microsoft's web site.

The following standard Excel add-ins are available:

Add-In Description
Analysis ToolPak Adds, Financial, statistical and analysis tools and functions
Analysis ToolPak Allows developers to use the analysis ToolPak features in their macros and
VBA solutions
Conditional Sum Creates a formula that sums data in a list if it matches your specified criteria
Wizard
Euro Currency Formats values in Euros and allows the EUROCONVERT function to work
Tools
Internet Assistant Allows developers to publish Excel VBA code and programs to the Web
VBA
Lookup Wizard Creates a formula to look up data in a list by using another known value in that
list
Solver Add-In Allows users to add in complex business scenarios and work out solutions,
based on adjustable cells and constraints

Additional Add-Ins are available from the Microsoft Web site at www.microsoft.com

© Hewlett-Packard 2007 Page 53 of 107


Excel 2007 Advanced

To install an Excel add-in:

 Click on the Office button, then on the Excel Options button


 Click on the Add-Ins menu option on the left-hand side of the window
 Click on the Go button next to Manage Excel Add-Ins

 Check each add-in you wish to install


 Click on OK

You will be asked to confirm that you wish to install each add in - click on Yes to continue:

© Hewlett-Packard 2007 Page 54 of 107


Excel 2007 Advanced

The add-in will be installed:

Calculation Options
Excel 2007 will automatically update all calculations in your workbook each time it is opened. The
workbook will also recalculate each time you enter a new formula, to ensure all other formulas in the
worksheet are up-to-date.

If your spreadsheet is large and contains many formulas, this can result in waiting time while Excel
updates all formulas. If you prefer, you can set the Excel to manual calculation - all formulas will only
update when you specify they should.

 To set the calculation type:


 Click on the Formulas ribbon
 Click on the drop-down arrow of the Calculation Options button
 Choose Manual

 Once the calculation has been set to manual, you can choose to re-calculate when it suits you.
 To recalculate and update all formulas, either:
 Click on the Calculate Now button on the Formulas ribbon to recalculate the entire workbook
 Click on the Calculate Sheet button on the Formulas ribbon to recalculate the current worksheet
only

You can also use the following shortcuts to recalculate:

Keystroke Action
F9 Calculate workbook
Shift F9 Calculate current worksheet only

© Hewlett-Packard 2007 Page 55 of 107


Excel 2007 Advanced

Additional calculation options can be set by clicking on the Office button, then on the Excel Options button.
Click on the Formulas menu on the left-hand side of the window.

Linking Formulas
Linking Formulas

It is possible to include cells from any sheet in a formula.

For example, the formula =A3-B3 refers to these cells on the current sheet but can be changed to
=Sheet1!A3-Sheet2!B3 to refer to cells on sheets 1 and 2, regardless of the sheet in which the formula is
typed.

It is also possible to refer to a range of cells spanning several sheets. The following formula will sum the
values in cell A3 of all sheets, from the sheet named January to the sheet named June:

A link to another workbook can also be created by entering a reference to the target range using the
syntax: =[file.xls]sheet!cell. In the following example, the formula refers to cell A10 on the sheet named
Jan in the sales.xlsx file stored in the same directory as the current workbook.

Paste Link

Data can be linked from one worksheet to another, even if the sheets are not in the same workbook.

The original data is known as the source while the copy is known as the target or destination. Whenever
the source changes, the target will be updated accordingly.

 Select the source data


 Click on the Copy button on the Home ribbon, or press [Ctrl C]

© Hewlett-Packard 2007 Page 56 of 107


Excel 2007 Advanced

 Select the target cell for the data to start in


 Click on the drop-down arrow of the Paste button on the Home ribbon
 Choose Paste Special

 Click on the Paste Link button in the Paste Special window

The data will be copied and linked to the original workbook. If the original changes, the target will update when it
is next opened.

© Hewlett-Packard 2007 Page 57 of 107


Excel 2007 Advanced

Maintaining Links

Worksheet links are updated each time the target file is opened or recalculated. If the source file's location
changes, it can be edited so further updates can be made:

 Click on the Data ribbon


 Click on the Edit Links button in the Connections group

All links will be listed in the Edit Links window:

 If the file has moved, click on the Change Source button and locate the moved file. Click on OK
 To check the status of the link, click on the Check Status button. You will be told if the source is
OK or cannot be found
 To stop linking to a file, click on the link, then on the Break Link button. Click on Break Links to
confirm this
 Click on Close to return to the worksheet

© Hewlett-Packard 2007 Page 58 of 107


Excel 2007 Advanced

Adding Comments
Comments can be attached to any cells in the worksheet to add explanations about formula,
worksheet layout, etc.

Setting your User Name

By default, comments will display the name of the user that inserted the comment. Ensure the correct user
name is set before inserting a comment.

 Click on the Office button


 Click on the Excel Options button
 With the Popular menu selected on the left-hand side of the window, click in the User Name box
 Enter your user name, then click on OK

Adding Comments

To insert a comment:

 Click on the cell you want to add a comment to


 Click on the Review ribbon
 Click on the New Comment button in the Comments group

 A new comment will be created containing your User Name which can be selected and deleted or
edited as required
 Type the comment text
 Click on any cell in the worksheet to secure the comment

© Hewlett-Packard 2007 Page 59 of 107


Excel 2007 Advanced

Press [Shift F2] to quickly add a comment to the active cell.

Viewing Comments

A red triangle will display in the corner of a cell that contains a comment:

The comment will display when the mouse is positioned over the cell:

By default, comments are only displayed when the mouse is positioned over the cell. A single comment can
be displayed permanently as follows:

 Click on the cell containing the comment


 Click on the Show/Hide Comment button on the Review ribbon

Alternatively, display all comments in the workbook by clicking on the Show All Comments button on the
Review ribbon.

© Hewlett-Packard 2007 Page 60 of 107


Excel 2007 Advanced

Editing and Removing Comments

To edit a comment:

 Click on the cell containing the comment


 Click on the Edit Comment button on the Review ribbon
 Edit the text as required
 Click on any cell of the worksheet when complete

To remove a comment:

 Click on the cell containing the comment


 Click on the Delete button in the Comments group of the Review ribbon

You can also right-click over a cell containing a comment to see options to delete and edit the comment:

Printing Comments

Comments can be printed as they appear in the worksheet or listed together at the end of the printout.

As displayed on the sheet:

© Hewlett-Packard 2007 Page 61 of 107


Excel 2007 Advanced

At the end of the sheet:

To set how comments will print:

 Click on the Page Layout tab


 Click on the More Information button in the Page Setup group

 Click on the Sheets tab of the Page Setup window


 Click on the drop-down arrow of the Comments box and choose the required print option

 Click on OK
 Print or preview the worksheet as normal

If you wish to print comments as they appear, ensure all comments are displayed before the Print command is
used.

Sharing a Workbook
Opening Workbooks Already in Use

By default, if you open a workbook stored on a shared drive that is currently open on another user's
computer, a message similar to the following will display:

© Hewlett-Packard 2007 Page 62 of 107


Excel 2007 Advanced

 Click on Read Only to open a read-only version of the file - you will not be allowed to save any
changes you make to the workbook.
 Click on Notify to open a read-only version of the file. When the original user has closed the
workbook, you will be given the chance to switch to read/write mode so that any changes can be
saved

Sharing Workbooks

It is possible for more than one user to work on an Excel file at the same time, provided it has been set up
as a shared workbook. Some features are not available when a workbook is shared:

 Inserting or deleting cells - although entire columns/rows can be inserted or deleted


 Inserting images, shapes and objects
 Creating charts
 Creating PivotTables
 Applying conditional formatting or formatting as tables
 Importing data

To set the current workbook so that it can be shared by other users:

 Click on the Review ribbon


 Click on the Share Workbook button in the Changes group

 Check the Allow changes box


 Click on OK

 You will be told that the workbook will be saved - click on OK

© Hewlett-Packard 2007 Page 63 of 107


Excel 2007 Advanced

When a workbook has been set to shared, a new indicator will appear in the Title Bar:

Sharing Conflicts

To view a list of users currently working with the workbook:

 Click on the Review ribbon


 Click on the Share Workbook button in the Changes group
 Ensure the Edit tab is selected - a list of all users will be displayed:

Conflicts will occur when two or more users make different changes to the same cell and attempt to save
the file.

The Resolve Conflicts dialog box will display when you attempt to save a change that conflicts with another
change saved in the current session:

 Click on Accept Mine to keep the change that you made in the sheet
 Click on Accept Other to use the change made by the other user, discarding your own change
 Click on Accept All Mine to keep all changes made by yourself, with no further prompts
 Click on Accept All Others to keep all changes made by other users, with no further prompts

© Hewlett-Packard 2007 Page 64 of 107


Excel 2007 Advanced

To make the workbook exclusive again, click on the Share Workbook button and uncheck the Allow
changes box. Any users currently accessing the file will not be allowed to save their changes.

Tracking Changes
In a shared workbook you can have Excel highlight any changes that you, or any other user who has
access to the spreadsheet makes. Excel will track additions, deletions and cell changes and allow you
to review the changes and decide which ones you would like to accept.

 To highlight changes made to the workbook:


 Click on the Review ribbon
 Click on the Track Changes button in the Changes group
 Choose Highlight Changes

 Click on the Track Changes checkbox, to start tracking changes and share your workbook
 Click on the drop-down arrow of the Who box to specify the users whose changes you want to
track - leave on Everyone to track all changes
 Click in the Where box and specify the range you want to track changes in - leave blank to track
changes to the entire workbook
 Click on the Highlight Changes on Screen option to have the changes displayed on your
worksheet
 Click on OK

 You will be told that the workbook will be saved - click on OK

© Hewlett-Packard 2007 Page 65 of 107


Excel 2007 Advanced

 Once you have enabled the tracking option, any additions, deletions or edits made to the
spreadsheet will be tracked by date and user. Amended cells will be highlighted by a blue border
and corner triangle - position the mouse over a highlighted cell to view details of the change:

Accepting and Rejecting Changes


After changes have been made, and in particular if there are conflicting changes, it is necessary to
review the changes and decide which should be kept.

 To accept or reject changes:


 Click on the Review ribbon
 Click on the Track Changes button in the Changes group
 Choose Accept/Reject Changes

 Choose the changes you want to review - keep to the default options to see all changes you
haven't yet reviewed, made by all users
 Click on OK

© Hewlett-Packard 2007 Page 66 of 107


Excel 2007 Advanced

You will be asked to accept or reject each change made in the workbook:

 Click on Accept to accept this change and place the new value in the cell
 Click on Reject to reject this change and keep the original value in the cell
 Click on Accept All to make all changes without further prompts
 Click on Reject All to lose all changes and keep all values as they were
 Click on Close when complete

To stop highlighting changed cells in the workbook, click on the Track Changes button on the
Review ribbon and choose Highlight Changes. Uncheck the Track Changes box and click on OK.
Click on Yes to confirm you wish to unshare the workbook again.

Inspecting Workbooks
Before sharing a workbook with colleagues or customers, you may want to remove any personal or
hidden information, to ensure the person you pass the workbook onto will not be able to view this.

By inspecting a workbook, you can remove the following information:

Item Description
Comments and Comments you have inserted via the Review ribbon, or ink annotations you
annotations have created via your tablet PC
Properties Document properties such as status, keywords, etc.
Custom XML Data Any XML data stored in the workbook
Headers and Footers Headers and footers you have set via Page Setup or the Insert ribbon
Hidden rows or Rows or columns you have hidden by right-clicking on the row or column
columns heading and choosing the Hide command
Hidden worksheets Worksheets you have hidden by right-clicking on the sheet tab and
choosing the Hide command
Invisible content Objects you have formatted as invisible

To check for the above content:

 Save the workbook you wish to check


 Click on the Office button
 Choose Prepare, then Inspect Document

© Hewlett-Packard 2007 Page 67 of 107


Excel 2007 Advanced

 By default, Excel will search for all hidden and personal content - uncheck any items you do not
wish to locate
 Click on Inspect

Excel will alert you of any content that has been found. You can remove any items by clicking on the
Remove All button next to the item that has been found.

© Hewlett-Packard 2007 Page 68 of 107


Excel 2007 Advanced

 Click on Reinspect to ensure all hidden and personal information has been removed
 Click on Inspect
 When all items are ticked, click on Close

Note: Take care when using the Inspect command as you may end up losing data. If you remove a hidden
column or row, for example, the data in this column or row will be deleted and you will not be able to undo the
command.

Restricting Permissions
You can restrict permission on a workbook that you store on a shared drive to specify exactly which
users can view or edit the workbook. In order to be able to set restrictions, your organisation will need
to have a rights management server in place.

Restricting Permission in a Workbook

To restrict permission to a workbook:

 Click on the Office button, then on Prepare


 Choose Restrict Permission
 Choose Restricted Access

© Hewlett-Packard 2007 Page 69 of 107


Excel 2007 Advanced

 Check the box to Restrict Permission to this Workbook

 Click in the Read box


 Enter the email addresses of each person you wish to be able to read the workbook, but not print
or make any changes to the file
 Click on the Check Name button to ensure the email addresses have been entered correctly

 Click in the Change box

© Hewlett-Packard 2007 Page 70 of 107


Excel 2007 Advanced

 Enter the email address of each person you wish to be able to make changes to the workbook.
Anyone not listed in this or the Read box will not be able to open the file
 Click on the Check Name button to ensure the email addresses have been entered correctly
 Click on More Options
 To set an expiry date for the file, on which all permissions will end, click on the This workbook
expires on check box, then on the drop-down arrow under this. Choose the date on which the file
will expire
 Click on OK

A banner will display above the formula bar, showing that the workbook has restricted permission.

Opening a Workbook with Restricted Permission

When you open a file that has permissions set, you will be prompted that your credentials will be checked.
Click on OK to see if you have permission to view the file.

© Hewlett-Packard 2007 Page 71 of 107


Excel 2007 Advanced

If you have permission to view or open the file, the workbook will be displayed with a banner showing it has
restricted access:

To see your permissions for the file, click on the View Permission button:

Click on the Request Additional Permissions link to send an email message to the owner of the file. In the
email message, specify why you need full permission, then send the message as normal.

Protecting Worksheets
By protecting a worksheet you are protecting the data stored in the worksheet.

When a worksheet is protected, no numbers, text or formulas can be typed or edited in the cells of the
sheet. In addition, you can specify other content and formatting to be protected, for example:

 Formatting - no cells, columns or rows can be formatted in any way


 Inserting - no columns, rows or hyperlinks can be inserted
 Deleting - columns and rows cannot be deleted
 Data - Sort and AutoFilter cannot be used
 Objects - any drawn objects, inserted pictures or embedded charts
 Scenarios - any scenarios created in the sheet

© Hewlett-Packard 2007 Page 72 of 107


Excel 2007 Advanced

To protect a worksheet:

 Click on the Review ribbon


 Click on the Protect Sheet button in the Changes group

 Choose each task that users will be able to perform after protection - by default they will only be
able to select cells
 If you wish to add a password, click in the Password box and type this. This will mean that the
sheet can only be unprotected if the password is given
 Click on OK

 If you entered a password, confirm this by entering it again, then click on OK

Unlocking Cells for Editing

Before protecting the sheet, any number of worksheet ranges can be unlocked so that they remain
unprotected when sheet protection is applied.

 Ensure the sheet is not yet protected


 Click on the Allow Users to Edit Ranges button on the Review ribbon

© Hewlett-Packard 2007 Page 73 of 107


Excel 2007 Advanced

 Click on New to add a new edit range


 Enter a name to identify the range that users will be able to edit
 Click in the Refers to Cells box and drag over the cells in the worksheet that you wish to make
editable
 Click on OK

 Repeat the above 4 steps for each range you wish users to be able to edit
 Click on Protect Sheet to protect the worksheet when all edit ranges have been set

You can also specify a range to be unlocked after protection by selecting the range and pressing [Ctrl 1] to show
the Format Cells window. Click on the Protection tab, then remove the check from the Locked box. Click on
OK.

Unprotecting Worksheets

To unprotect a worksheet so that changes can be made:

 Click on the Review ribbon


 Click on the Unprotect Sheet button in the Changes group

 If you entered a password during protection, type this password in the dialog box displayed
 Click on OK

© Hewlett-Packard 2007 Page 74 of 107


Excel 2007 Advanced

Protecting Workbooks
Workbook protection is used to stop the workbook's structure from being changed. Once a workbook
has been protected, users will not be able to:

 Insert or delete sheets


 Rename sheets
 Hide or unhide sheets
 Resize the windows of the workbook

To protect a worksheet:

 Click on the Review ribbon


 Click on the drop-down arrow of the Protect Workbook button in the Changes group

 Choose the Protect Structure and Windows option


 Keep the Structure box ticked to stop sheets from being inserted, deleted, renamed, moved or
hidden
 Check the Windows box to stop the windows from being resized and moved in the workbook
 If you wish to add a password, click in the Password box and type the password. This will mean
that the workbook can only be unprotected if the password is given
 Click on OK

© Hewlett-Packard 2007 Page 75 of 107


Excel 2007 Advanced

If you entered a password, confirm this by entering it again, then click on OK

Unprotect the workbook by clicking on the Protect Workbook button on the Review ribbon and
choosing Protect Structure and Windows again. If you entered a password during protection, type
this password in the dialog box displayed and click on OK.

Creating a Document Workspace


If you use Sharepoint, you can create a new Document Workspace from within Excel, and save your
workbook into the space automatically. From within Excel you can add members to the workspace,
add tasks and related documents, and add links to other related information.

 To create the document workspace:


 Click on the Office button
 Click on the Publish command
 Choose to Create Document Workspace

The document workspace task pane will display, with the name of the workbook set as the Document
Workspace name by default.

 Click in the Document Workspace Name box and edit the name of the workspace if required
 Click in the Location for new workspace and type the URL of the Sharepoint site you wish to
create the workspace in
 Click on Create

© Hewlett-Packard 2007 Page 76 of 107


Excel 2007 Advanced

 Excel will create the new document workspace, showing progress of the operation:

 When the workspace is created, the Document Management task pane will show the number of
users, tasks, related documents and links in the document workspace.

 Click on the Open Site in Browser link in the Document Management task pane to open the
document workspace in Sharepoint in your browser.

© Hewlett-Packard 2007 Page 77 of 107


Excel 2007 Advanced

Saving to a Document Workspace


Once you have created a document workspace, you will need to ensure this is kept up-to-date and
always contains the most recent version of the workbook.

To save a workbook to the workspace:

 To save the local copy of the workbook, click on the Save button on the Quick Access Toolbar

 Click on the Office button and choose the Server command

 Choose the Document Management Information option to show the Document Management
task pane
 On the task pane, click on the Update Workspace Copy link

© Hewlett-Packard 2007 Page 78 of 107


Excel 2007 Advanced

The file will be uploaded to the server and the task pane will show that the document is up-to-date.

To view different versions of the workbook:

 Click on the Office button and choose the Server command


 Choose View Version History

Data Consolidation
Data that is typed in more than one sheet or workbook can be consolidated to form a single summary.
The data can be consolidated by position or by category. This means that data can be consolidated
regardless of how it is arranged in the individual sheets.

Option Description
By Position This is used if all ranges to be consolidated are laid out in exactly the same way,
and all contain the same amount of data
By Category This is used if the ranges have the same headings but different amounts of data in
different orders

For example:

The following worksheets:

© Hewlett-Packard 2007 Page 79 of 107


Excel 2007 Advanced

Could be consolidated into the following summary:

To consolidate data:

 Open all workbooks containing the ranges you wish to consolidate


 Activate the sheet to contain the summary and click on the Data ribbon
 Click on the Consolidate button in the Data Tools group

Now add each range to be consolidated, as follows:

 Click in the Reference box


 If the first range is on the active sheet, highlight this as normal
 If the first range is on a different sheet of the active workbook, click on the required sheet tab and
highlight the range
 If the first range is in a different workbook, click on the View ribbon, then on the Switch Windows
button. Choose the required workbook from the list displayed, then select the range
 Click on Add to add the range to the list

 Add all ranges in this way. If the data in each range is not arranged in an identical way, choose
the category by which you wish to consolidate:

© Hewlett-Packard 2007 Page 80 of 107


Excel 2007 Advanced

 Choose Top Row if the first row of each range contains the same labels, even if these are typed
in a different order
 Choose Left Column if the first column of each range contains the same labels
 To link to original data, so that any changes are reflected in the summary, check Create Links to
Source Data. This makes the summary file larger as each individual figure is copied and linked,
rather than the totals only
 Choose OK to insert the summary on the current sheet
 For the example above, the left-hand column contains the same labels in each sheet, so the
consolidate will be carried out using these.

Data Validation
Data validation allows you to specify the values or text that can be entered into specific cells. Error
messages will appear if invalid data is entered.

Setting Validation

To set data validation:

 Select the cells you wish to validate


 Click on the Data ribbon
 Click on the Data Validation button on the Data Tools group

Use the following options to specify the criteria:

Setting Description
Whole Allow only values without decimal places. A minimum and maximum allowed value
Number can be specified.
Decimal Allow any values with or without decimal places. A minimum and maximum allowed
value can be specified.
List Allow one of a specified list of values to be selected. The list of values should be
entered in a column of the same worksheet, this range is specified in the Source
box.
Date Allow only a date be entered. A minimum and maximum allowed date can be
specified
Time Allow only a time to be entered. A minimum and maximum allowed date can be
specified

© Hewlett-Packard 2007 Page 81 of 107


Excel 2007 Advanced

Setting Description
Text Allow letters, numbers and symbols to be entered with a minimum and maximum
Length length if required
Custom Enter a formula that must be true for the data to be allowed e.g.
=A1>AVERAGE(C1:C5) to ensure the value in A1 is greater than the average of the
values in C1:C5

The following settings would only allow the values North, South, East or West to be entered in the cell.

When the cell is clicked, a drop-down arrow will display from which a value can be selected:

Error Messages

There are two types of error messages that can be specified for cells that have validation applied.

 The Input Message will appear any time a validation cell is selected, even before data is
entered into the cell
 Error Alert messages appear when data is typed that does not meet the criteria

To add error messages to validated cells:

 Select the cells you wish to validate


 Click on the Data ribbon
 Click on the Data Validation button on the Data Tools group

© Hewlett-Packard 2007 Page 82 of 107


Excel 2007 Advanced

 Click on the Input Message tab


 Click in the Title box and enter the heading to appear in bold text. Click in the Input Message box
and type the main message text
 Click on the Error Alert tab
 From the Style box, choose the type of error alert you wish to set (see table below)
 Click in the Title box and enter the heading to appear in bold text. Click in the Input Message box
and type the main message text

The following types of error messages can be shown:

Example Description
Stop If data is typed that does not meet the validation criteria, it will not be entered into
the cell. A message will display with a Retry button that can be used to enter new
data into the cell, or a Cancel button to stop the operation
Warning If data is typed that does not meet the validation criteria, a message will display
with Yes and No buttons. If the user clicks on Yes, the data will be entered even
though it is invalid. Clicking on No will stop the operation
Information If data is typed that does not meet the validation criteria, a message will display
with OK and Cancel buttons. Clicking on OK will enter the value into the cell,
clicking on Cancel will stop the operation

To disable the input or error message, remove the check from the Show box on the appropriate tab.

For Example:

The following input message:

© Hewlett-Packard 2007 Page 83 of 107


Excel 2007 Advanced

Would show as follows when the cell is selected:

The following error alert:

Would show as follows when an invalid entry is typed into the cell:

Showing Invalid Data

If you apply validation to your cells, you can use the circle invalid data option to see if any existing cells are
invalid.

 Click on the drop-down arrow of the Data Validation button on the Data ribbon
 Click on the Circle Invalid Data command

© Hewlett-Packard 2007 Page 84 of 107


Excel 2007 Advanced

The following shows an invalid entry:

To remove validation circles from the worksheet, click on the Data Validation button on the Data ribbon, then
on the Clear Validation Circles command.

Saving in HTML Format


Pages that can be viewed on the Internet, or through a web browser, are created using a text format
called HTML - Hypertext Mark-up Language. Although Excel is not a fully functional web creation tool,
it can be used to create basic HTML pages from existing spreadsheets.

Excel 2007 uses a Web feature called "round tripping". Files saved in HTML format can be re-opened
in Excel without losing any of the original formatting of the workbook.

To allow for this feature, each file saved in HTML format will have an accompanying folder of the
same name, containing related HTML pages. It is important to remember that moving the HTML file
without the related folder could result in errors in the web pages - always keep the file and folder
together in the same location.

To save an existing Excel workbook in HTML format:

 Click on the Office button


 Click on Save As
 Click in the Save as Type box and choose Web Page (*.htm, *.html)
 Choose the location to save your web page in
 Choose to save the Entire Workbook or the Selection only

© Hewlett-Packard 2007 Page 85 of 107


Excel 2007 Advanced

 To change the page title, which will appear in the browser's title bar, click on Change Title and
amend as required. Click on OK

 Click on Save to create the web page

You can now view the HTML file in any web browser e.g. Internet Explorer. Double-click on the HTML file to
launch your default web browser and display the page.

© Hewlett-Packard 2007 Page 86 of 107


Excel 2007 Advanced

Creating Themes
You can customise Excel's default themes to hold your own choice of colours, fonts and effects.

To apply a theme to the workbook:

 Click on the Page Layout ribbon


 Click on the drop-down arrow of the Themes button and choose the required theme

 Themes can be customised if they don't follow the exact format that you require.
 To change the colours of the theme:
 Click on the drop-down arrow of the Colors box and choose a colour scheme for the theme
 To create a new colour scheme, click on the Create New Theme Colours option
 Type a name for the new colour scheme in the Name box

 Click on the drop-down arrow next to each theme colour and choose a new colour for that
element. To enter a custom colour using RGB values, choose More Colours then the Custom
tab. Enter the RGB values in the Red, Green and Blue boxes, then click on OK
 Click on Save when all colours have been entered

© Hewlett-Packard 2007 Page 87 of 107


Excel 2007 Advanced

To change the fonts of the theme:

 Click on the drop-down arrow of the Fonts box and choose a font set to use
 To choose non-standard fonts, choose the Create New Theme Fonts option
 Type a name for the font set in the Name box
 Click on the Heading Font drop-down arrow and choose the font to use for headings in the
worksheet
 Click on the Body Font drop-down arrow and choose the font to use for standard text in the
worksheet
 Click on Save

To change the shape effects of the theme:

 Click on the drop-down arrow of the Effects box


 Choose the effects to be applied to inserted objects

© Hewlett-Packard 2007 Page 88 of 107


Excel 2007 Advanced

When all theme elements have been changed, save the theme as follows:

 Click on the drop-down arrow of the Themes button and choose Save Current Theme
 Enter a name for the theme in the File Name box
 Themes are stored in the Document Themes subfolder of your AppData folder by default - click
on Save to save the theme

© Hewlett-Packard 2007 Page 89 of 107


Excel 2007 Advanced

Applying Saved Themes


Themes allow you to format a file in a number of ways.

 By applying a set colour scheme to the workbook


 By applying a font combination
 By applying formatting options to any drawn lines and shapes

When you apply a theme, it will be applied to all sheets in the current workbook, regardless of the sheet you are
on when you choose the command.

To apply a saved theme to the workbook:

 Click on the Page Layout ribbon


 Click on the drop-down arrow of the Themes button

If your saved theme is listed at the top of the themes list, click on this now to apply the theme to the
workbook

© Hewlett-Packard 2007 Page 90 of 107


Excel 2007 Advanced

If your saved theme is not listed, click on the Browse for Themes option

 Locate the saved theme, then select it in the directory listing


 Click on Open

The theme will be applied automatically and will now be listed in the Custom section of the theme list for further
use.

Customising the Quick Access Toolbar


You can customise the Quick Launch bar by adding any commands from Excel for easy access. You
can also add commands no longer available in Excel 2007, that you used in previous versions of
Excel.

To customise the Quick Launch bar:

 Click on the drop-down arrow at the end of the Quick Access toolbar
 Choose More Commands

 Choose the category you wish to see commands from e.g. Popular Commands or Commands
not in the Ribbon
 Scroll down the list of commands to find the one you wish to add to the Quick Access toolbar
 Select the command you wish to add
 Click on the Add button

© Hewlett-Packard 2007 Page 91 of 107


Excel 2007 Advanced

 To move the command up - towards the left of the Quick Access toolbar - click on the Up arrow
 To move the command down - towards the right of the Quick Access toolbar - click on the Down
arrow
 Continue adding commands as required
 Click on OK when complete

Recording Macros
A macro is a collection of Excel commands that can be run automatically by clicking on a button or
pressing a keystroke. Macros are used to automate tasks and should be used whenever a series of
commands will be executed repeatedly over a period of time.

Macros can be stored in one of two places:

 The workbook in which the macro will be run. This workbook must be open for the macro to
be available for use
 The Personal Macro Workbook - a library of global macros that can be run from any
workbook. This file is named personal.xlsb and is stored in the xlstart subdirectory under
\appdata\roaming\microsoft\excel in your user folder

Showing the Developer Ribbon

In order to record and work with macros in Excel, you need to enable the advanced settings by showing the
Developer ribbon. To do this:

 Create a new workbook


 Click on the Office button, then on the Excel Options button
 Ensure the Popular option is selected on the left-hand side of the window
 Check the box to Show the Developer Tab in the Ribbon
 Click on OK

© Hewlett-Packard 2007 Page 92 of 107


Excel 2007 Advanced

Recording Macros

The easiest way to create a macro is by recording it. Macros can be recorded by manually carrying out the
steps you wish the macro to hold.

First, ensure correct cell is the active cell - you may not want to record the selection of a cell. Before
recording macros, it is a good idea to ensure the option to move the cell down on [Enter] is switched off.
This ensures unnecessary selection commands are not recorded unintentionally.

To do this, click on the Office button, then on the Excel Options button. Click on the Advanced menu on the
left-hand side, then uncheck the After pressing Enter, move selection box.

To record a new macro:

 Click on the Developer ribbon


 Click on the Record Macro button in the Code group

 Type a name for the macro - this should contain no spaces but can be up to 255 characters in
length
 Click in the Shortcut Key box and enter a shortcut key that can be used to run the macro - this is
useful even if just for testing purposes. To avoid overwriting any of Excel's standard shortcuts,
type a capital letter in this box. This will mean the macro will run when [Shift], [Ctrl] and that letter
is pressed
 Click on the drop-down arrow of the Store Macro In box and choose the location for the macro
 Type a Description of the macro and its purpose
 Click on OK to start recording the macro

© Hewlett-Packard 2007 Page 93 of 107


Excel 2007 Advanced

The status bar will indicate that Excel is now recording all of your actions:

 Carry out the steps to be recorded


 When complete, click on the Stop Recording button of the Developer ribbon, or on the Stop
button on the status bar

Relative Recording
The default macro recording method uses absolute referencing. This means that when cells are
selected during recording, the actual cell references are recorded and the macro will always operate
on those fixed cells.

 If a macro is recorded using relative references, cell references are recorded relative to the
previous active cell.
 For Example:
 Cell A1 is active when the macro recording is started. During recording, cell C3 is clicked.

There are 2 ways in which this macro could be recorded - using absolute or relative recording.
Depending on the method used, a different result will be given when the macro is executed.

Method Result
Absolute recording Whatever the active cell when the macro is executed, cell C3 will always
be selected. If the macro is executed from cell A200, for example, cell
C3 will still be selected during the macro.
Relative recording Whenever the macro is executed, the cell 2 columns across and 2 rows
down from the active cell will be selected. If the macro is executed from
cell A200, for example, cell C203 will be selected during the macro.

© Hewlett-Packard 2007 Page 94 of 107


Excel 2007 Advanced

As the default recording method uses absolute references, you need to switch manually to relative
recording if this method is required. It is possible to toggle between the two recording methods during
macro recording.

 Click on the Use Relative References button on the Developer ribbon to turn relative recording on
 Click on the button again to return to absolute recording

Running Macros
Before a macro is assigned to a button, object or keystroke, it can be run in the following way:

 Click on the Developer ribbon


 Click on the Macros button in the Code group

 Click on the Macros In drop-down list and choose the location where your macro is stored
 Choose the required macro name from the list displayed
 Click on Run

Press [Alt F8] at any time to display the list of macros available to be executed.

© Hewlett-Packard 2007 Page 95 of 107


Excel 2007 Advanced

Assigning Macros to the Quick Access Bar


Once a macro has been recorded, it can be assigned to a button on the Quick Access Toolbar. To run
the macro once this has been done, simply click on the toolbar button.

To assign a macro to a button on the Quick Access Toolbar:

 Click on the drop-down arrow at the end of the Quick Access toolbar
 Choose More Commands

 Click on the drop-down arrow of the Choose commands from list and choose Macros
 Choose the macro you wish to add to the toolbar
 Click on the Add button

© Hewlett-Packard 2007 Page 96 of 107


Excel 2007 Advanced

 To move the command up - towards the left of the Quick Access toolbar - click on the Up arrow
 To move the command down - towards the right of the Quick Access toolbar - click on the Down
arrow
 To choose a new image for the button on the toolbar, click on macro in the list of commands
added to the toolbar, then click on Modify

 Choose a new symbol for the button


 Click on OK

 Click on OK to return to the worksheet when complete

You can now click once on the button on the Quick Access toolbar each time you wish to run the macro.

Assigning Macros to the Keyboard


If you didn't assign a keyboard shortcut to a macro during recording, you can do this at a later stage if
required.

 Click on the Developer ribbon


 Click on the Macros button in the Code group

© Hewlett-Packard 2007 Page 97 of 107


Excel 2007 Advanced

 Click on the Macros In drop-down list and choose the location where your macro is stored
 Choose the required macro name from the list displayed
 Click on Options

 Click in the Shortcut Key box and type a letter to combine with [Ctrl] to run the macro. Enter an
upper case letter to combine this with [Ctrl] and [Shift] to run the macro
 Click on OK

 Click on Cancel to return to the worksheet

© Hewlett-Packard 2007 Page 98 of 107


Excel 2007 Advanced

Creating Forms
You can add form elements to any workbook to add form functionality e.g. buttons, text boxes, radio
buttons and check boxes.

 To add form elements to a worksheet:


 Ensure the Developer ribbon is displayed
 Click on the Insert button of the Controls group

 Click on the control you want to add


 Click where the control should appear on the worksheet
 To edit the text on a label, option button or check box control, drag the mouse over the text and
type the new text
 Click away from the control to secure it on the worksheet

The following form controls are available:

Button Example Description


Button Buttons are used to perform an action, such
as sending a form via email or adding data to
a database. You need to create a macro to
perform the action, then assign the macro to
the button.
Combo box Combo boxes are used to present a set of
choices, or to allow the user to enter their
own text. The choices will only be shown
when the arrow is clicked, with the selected
option visible at all times.

Check box Check boxes are used when a question has a


choice of two answers e.g. yes or no, or true
or false. The check box can either be ticked
or not. If the form has a number of check
boxes, any combination may be selected or
de-selected.
Spinner Spinners are similar to scroll bars in that they
are used to select one of a number of
numeric values. The up arrow is clicked to
show the next value, while the down arrow is
clicked to show the previous value.

© Hewlett-Packard 2007 Page 99 of 107


Excel 2007 Advanced

Button Example Description


List List boxes are used to present a set of
choices, where all choices are visible. The
user will click on their required choice in the
list.

Radio button Radio buttons are used to give a choice of


options where only one option may be
selected. When an option is selected, all
others are de-selected.

Group box Group boxes are used to group sets of option


(radio) buttons together, so that only option in
each group can be selected. Groups can also
be used to make the form look more
organised, by framing related sets of
controls.

Label Labels are used to identify the controls on


the form - by displaying text that tells the user
what to enter into the control. Labels can be
positioned anywhere on the worksheet and
moved as required.
Scroll Bar On a form, a scroll bar is used to select one
of a number of values. The user will scroll up
to select a lower number, or down to select a
higher number. They can also drag the scroll
bar up or down to move in larger steps.

Setting Form Control Properties


Once a form control has been added to the worksheet, it can be selected for editing by holding [Ctrl]
and clicking on the control.

Linking Forms to Cells

You can link form controls to the cells of your worksheet, to record the values entered and perform
calculations based on the user's choices.

 Hold [Ctrl] and click on the control to select it


 Click on the Developer ribbon
 Click on the Properties button in the Controls group

© Hewlett-Packard 2007 Page 100 of 107


Excel 2007 Advanced

 Ensure the Control tab is selected


 Click in the Cell Link box and type the cell you want to record the value selected on the control
 Click on OK

Setting List Values

To set the values to appear in a list or drop-down list:

 Type the values in a separate range of the workbook, away from the form or on another sheet
 Hold [Ctrl] and click on the list or drop-down list to select it
 Click on the Developer ribbon
 Click on the Properties button in the Controls group

 Click in the Input Range box then drag over the list of values to make up the list
 Click on OK

© Hewlett-Packard 2007 Page 101 of 107


Excel 2007 Advanced

Adding Formulas to Show Form Results

When you select an option from a form control e.g. a value from a drop-down list, the corresponding values
will be shown in the linked cells. If you'd rather show the selected value to its number, you can do this by
entering a formula into a cell.

You can do this by adding the corresponding value next to each option in the drop-down list value range. If
the range showed town names, for example, add a value to each town name as follows:

You can now use the VLOOKUP function to find the corresponding value in the list.

 Click on the cell to show the result


 Type =VLOOKUP and open brackets (
 Type the reference of the cell linked to the form control, followed by comma
 Type the references of the range that contains the drop-down list values and their corresponding
numbers, followed by another comma
 Type 2 to specify you want to return the information in the second column of the lookup range
 Close brackets )

In the following example, cell A1 is the linked cell for the form control, while the values displayed in the
drop-down list are in cells B3:B7.

Saving Templates
Templates are master copies of workbooks that contain standard text and formatting. These standard
elements are applied automatically whenever a new workbook is created from that template.

Templates can contain:

 Standard text and graphics


 Formatting and page layout options e.g. styles, headers and footers
 Formulas and macros

© Hewlett-Packard 2007 Page 102 of 107


Excel 2007 Advanced

Creating Templates

A new template can be created by adding all of the required elements to a new workbook e.g. standard
text, page setup and other formatting.

 Ensure all standard text has been typed and any formatting options to be saved in the template
have been applied
 Click on the Office button and choose Save As
 Click in the File Name box and enter a name for the template
 Change Save As Type to Excel Template - the default template folder will be displayed
 Click on Save

If your template contains macros, change the Save as Type box to Excel Macro-Enabled Template when
saving.

Using Templates

To create a new workbook based on a template:

 Click on the Office button, then on New


 Click on My Templates in the menu on the left-hand side of the screen
 Choose the template you wish to use
 Click on OK

© Hewlett-Packard 2007 Page 103 of 107


Excel 2007 Advanced

Creating Default Templates

There are two default templates that can be created in Excel 2007:

Name Description
Book The default template to be used each time a new workbook is created
Sheet The default template to be used each time a new worksheet is inserted into the current
workbook

Create default templates as follows:

 Create a new workbook and add any features to be saved with the default template
 Add or remove worksheets as required. If you are creating the worksheet template, this should
contain only a single sheet.
 Click on the Office button and choose Save As
 Click in the Save as Type box and choose Excel Template
 The default Template folder will be selected automatically - use the navigation trail to locate the
default startup folder which is usually AppData\Roaming\Microsoft\Excel\XLSTART in your user
folder
 Click in the File Name box and type the name for the template - Book for the default workbook or
Sheet for the default worksheet
 Click on Save

© Hewlett-Packard 2007 Page 104 of 107


Excel 2007 Advanced

Ensure the sheet template only contains a single sheet. If it contains 3 sheets, three sheets will be added each
time the Insert Worksheet command is used.

Macro Security
A macro virus is a virus stored within a macro in a workbook or template. When you open the workbook
and execute the macro, either knowingly or by accident, the virus will be activated and stored in your main
Excel template. After this has occurred, each workbook you open is in danger of being infected by the virus
- and it is possible for you to transfer the virus to other user's computers by emailing workbooks or saving
files on shared network drives.

For this reason, Word Excel offers a number of security levels for the treatment of files containing macros.

Level Description
Very High Unsigned macros are disabled, and signed macros are only enabled if installed in a
trusted location
High Unsigned macros are disabled while signed macros are enabled
Medium If the macro is unsigned, the user will be prompted as to whether they wish to enable
or disable the macro. Signed macros are automatically enabled
Low All macros, signed or unsigned, are enabled

To set the level of security you wish to use:

 Click on the Developer ribbon


 Click on the Macro Security button in the Code group

© Hewlett-Packard 2007 Page 105 of 107


Excel 2007 Advanced

 Choose the macro security setting from the list displayed


 Click on OK

If you have virus scanning software installed on your computer that is compatible with Office 2007, all macros
will be scanned for viruses before they are enabled. For this reason, it is always recommended to work only on
a computer that has an active up-to-date virus scanning application.

Assigning Macros to Buttons and Images


Macros can be assigned to buttons on the actual worksheet - this is particularly useful for local macros that
are only relevant to certain parts of a workbook. You can also assign a macro to another object e.g. a chart
or image.

Assigning Macros to Buttons

To create a button on the worksheet:

 Ensure the Developer ribbon is displayed


 Click on the Insert button of the Controls group
 Click on the first button under Form Controls, to select the
Button option
 Position the mouse where the button should appear and drag to
the required shape and size, releasing the mouse button when
the correct shape and size are displayed

© Hewlett-Packard 2007 Page 106 of 107


Excel 2007 Advanced

 Choose the macro to be assigned to the button from the list displayed
 Click on OK

 Before clicking away from the button, drag the mouse over the default button text and enter new
text to appear on the button
 Click away from the button when complete

Assigning Macros to Other Objects

A macro can be assigned to any other object,


e.g. a shape, chart or picture:

 Right-click over the object you wish to assign


a macro to
 Choose Assign Macro from the shortcut
menu displayed
 Choose the macro to be assigned to the
object from the list displayed
 Click on OK

© Hewlett-Packard 2007 Page 107 of 107

You might also like