Using Microsoft Excel: Advanced Skills
Using Microsoft Excel: Advanced Skills
Using Microsoft Excel: Advanced Skills
Naming Cells
In a large spreadsheet, cell referencing and selection may be simplified by making use
of names. You can assign a unique name to an individual cell or to a range of cells.
This can make it quicker and easier to refer to the cells in charts and functions.
Additionally, functions that make use of names are easier to read. For instance, a
formula that says =B4-B5 doesn’t make as much sense as a formula that says
=Sales-Expenses.
5) Type Date in the box and press [Enter] to create the name for that cell.
Note Whenever you select a cell or range of cells that is named, the name will appear in the names
box.
9) Select the cell range B6:B7 which should contain the cells with the income amounts.
10) Click in the Names box, type Income and press [Enter].
Note If you type a name in the names box without pressing [Enter] afterwards, the name might not be
created.
11) Select the cell range B11:B25 which should contain the expense figures.
12) Click in the Names box, type Expenses and press [Enter].
13) Test the new named ranges by selecting them from the names dropdown list. Each
range should become selected when you select its range.
14) Click in cell D8. This cell will contain the formula to calculate total income.
15) Enter the following formula.
=Sum(Income)
Excel will make use of the range name to add up all of the cells in that range.
16) Click in cell B26 which will contain the total expenses.
17) Click on the Autosum icon.
When the Autosum tool completes the function, it will use the range name you
have created instead of the less meaningful cell references.
18) Press [Enter] to complete the function.
19) Save the changes to the workbook.
3) We want the data cells to be named based on the cells in the left column so make sure the
Left column option is selected and then click OK.
4) Click in cell B6, B7 or B8. Look in the Names box to see the names that
have been created. Notice that names with more than one word have been created using an
underscore. E.g. cell B8 will now have the name Total_Income. This is because names
cannot contain spaces. Names must also begin with a letter.
5) Select the cell range B11:B25. This will contain the expenses data and labels.
6) From the Insert menu select Name and Create.
7) Click OK to define names for these cells.
We can view, modify or delete the names that have already been created by using
the Define Names options.
8) From the Insert menu select Names and then Define. A dialog box like the one
below will appear.
This dialog lists all the names in the current workbook. From here you can delete names and
modify the cells that a name refers to.
9) Click one some of the names to view the cell references that the names refer to.
10) Click Close to close the dialog without making any changes.
4) From the list select Total_Income and click OK. The name will be inserted in to the formula.
5) Type a minus sign. –
6) From the Insert menu select Name and then Paste.
7) Select Total_Expenses from the list and click OK.
The formula should appear as =Total_Income-Total_Expenses
8) Press [Enter] to complete the formula.
Cell Comments
Cell comments can be used to guide a user who is using your spreadsheet. They can contain tips,
and other information that may be helpful. They are indicated by a small red triangle in the top
right corner of the cell. When the mouse is moved over the cell, the note will appear for the user.
Comments can be formatted to match the look of the rest of the spreadsheet.
4) Click outside the comment to finish editing it. A red mark is visible in the top right corner of
cell B20.
5) Move your mouse over the cell to view the comment.
8) Use the Fill Colour icon on the formatting toolbar to change the background
colour of the comment. You can also resize the comment box if you want.
9) Save the changes to the file.
Note In the page setup options, you can choose to have comments shown when you
print the sheet.
Conditional Formatting
Conditional formatting allows you to create rules that will change the formatting in a cell based
on the values in the cell. It can be useful for highlighting certain parts of the spreadsheet when
certain conditions are met. In our table we will apply conditional formatting to highlight
different expenses.
The drop down box allows you to specify the conditions that must be met if the formatting is to
change. In this case we are telling Excel to change the formatting of cells where the value is
greater than or equal to 500.
4) Click the Format button so we can specify how the cells meeting the criteria will look.
5) When the format options appear, set the format to Italic style and dark red colour. You can
also change the border and pattern/background of cells which match the criteria.
6) Click OK to apply the formatting and return to the conditional formatting options.
7) Click the Add button to add an additional criterion for formatting.
8) Change the additional criteria to Less than 70.
9) Set the formatting for the additional criteria to italic and green. The conditional formatting
options should now look like the example on the following page.
10) Click OK to apply the conditional formatting. Any cells with a value of 500 and above will
be italic and dark red. Cells with a value of less than 70 will be italic and green.
11) Change the numbers in some of the cells to see the changes in formatting.
12) Save the changes to your workbook.
Data Validation
If you are creating an Excel spreadsheet that will be used by other people it is
important to make it as easy to use as possible, especially if the eventual users will
be people who are not skilled at using Excel. Reducing the possibility of errors
can make a workbook easier to use and this is where Excel’s data validation
feature can be useful. Data Validation can be used in the following ways.
• Restrict the data that can be entered in to certain cells.
• Provide a list of accepted values to assist in data entry.
• Provide prompts to assist a user in data entry.
• Produce meaningful error messages when incorrect data has been added.
Cells A1:C23 contain the information for generating a ticket. Print Preview the workbook and
you will see that only these cells will print, due to the settings in Page Setup. The ranges
E27:F31 and E34:F38 won’t print but both provide information that is used in 2 lookup functions.
We can also use some of this information in our data validation. Look at
these lookup functions in cells B11 and B12. Notice the comment in cell B9.
The function in B11 checks what type of ticket has been entered in C11 and then uses a Vlookup
to insert a matching ticket price. The function in B12 operates in a similar way to check the seat
type and then return an amount to multiply the ticket price by. The formula in B14 calculates the
final ticket price.
We are going to use Data Validation to both restrict and assist data entry.
3) Change Allow to Whole Number. This will restrict the cell so that only whole numbers with
no decimals can be entered.
4) Change Data to less than or equal to.
5) When the Maximum box appears, enter 200 in the box to set that as the upper limit. In
addition to entering a number in this box you can also select a cell in your workbook which
has a suitable value. The options should now look like the example below.
The Input Message tab allows us to enter a popup prompt that will appear when the cell is
selected. Since the cell already has a comment, we’ll leave the Input message for this cell blank.
6) Click the Error Alert tab.
In this tab we can create a custom error message that will appear if the user enters a value not
allowed under the Validation Criteria. In this case, the error message will appear if a number
greater than 200 is entered, so we can create an error message appropriate for that situation.
The Style options determine the type of error message that will appear. For instance, a
Stop style error message will prevent the entry of invalid data while the other types are
only warnings.
7) Make sure the Style is set to Stop.
8) In the Title enter Invalid Duration.
9) For the Error Message type, “This cell must contain a number of minutes no greater than
200”.
The options should look like the example on the following page.
Note We have only created a validation rule for a single cell. If you have several cells that are all going
to contain similar data, you can select them all so that you can create a validation rule for them
all at the same time.
7) Change the Input Message options so that they look like the example below.
8) Change the Error Alert options to look like the example below.
10) Select a ticket type from the dropdown list. Notice that all of the formulae in the worksheet
recalculate based on the changed information.
11) Select C12 – the Seating type cell.
12) Create a validation rule with the following options.
13) Test the validation rule in cell C12 by using the list and entering invalid data.
Notice that the Sample area above the Type box shows how the data in the selected cell will
look with the custom format you are creating.
7) Click OK to apply the custom format. The date in the cell will now take on the new format.
The format should make the time in the cell look like the following example.
7:30 PM
As you saw in the date and time formats, several symbols can be used in number formats to
represent certain types of formats. Additionally, there are a couple of other guidelines to
remember.
• Any text that is to appear as part of the format needs to be enclosed in quotation marks.
• Any colours that will be included as part of the format need to be enclosed in square
brackets. [ ]
1) Select B9, the cell with the show’s duration.
2) Create the following custom format.
0 "Minutes"
The contents of the cell should now show a number (at least one digit) followed by the word
Minutes. E.g. 120 Minutes
3) Select B11, the ticket type amount cell.
4) Create the following custom currency format.
$0
5) Select cell B14, the ticket price cell and enter the following custom format.
$#,##0.00;[red]”Error”;"0"
This format will result in positive numbers having a dollar sign with two decimal places. For
negative numbers, the text Error will appear in red (since the total shouldn’t result in a negative
number). If the value of the cell is zero a 0 will appear.
6) Change the number of tickets in B13 to test the format for the ticket total.
7) Save your workbook and try these custom formats on a blank worksheet and enter data in to
the cells to test the formats.
Tip Custom number formats can also be used in some other applications. For instance, they are very
useful for formatting data in Microsoft Access.
The information on the following page is taken from Excel’s online help and lists some of the
symbols that can be used in number formats.
• # displays only significant digits and does not display insignificant zeros.
• 0 (zero) displays insignificant zeros if a number has fewer digits than there are zeros in the
format.
• ? adds spaces for insignificant zeros on either side of the decimal point so that decimal
points align when formatted with a fixed-width font, such as Courier New. You can also use
? for fractions that have varying numbers of digits.
Tip For more information about custom formats and examples, search the online help for, “Create or
delete a custom number format”.