Centre for Staff & Educational
Development (CSED)
Discover your potential
Excel
Next Steps in
Next Steps in
Excel
Version 6.03
Dave Knock (CSED)
February 2016
This document is produced by the Centre for Staff and Educational
Development at UEA. It provides further instruction in the use of Excel (part
of the Microsoft Office suite of programs) for those who have some experience
of Microsoft Windows and Excel.
---------- University of East Anglia 1999-2016 ---------This material may not be used in part or whole for financial gain without prior permission. It
may otherwise be freely copied provided that due acknowledgement is given to the Centre for
Staff and Educational Development, UEA Norwich, and that the wording of this statement of
copyright is reproduced.
CONTENTS
1 - Introduction
1
Using these notes ....................................................................................1
Setting up course files .............................................................................1
Conventions and symbols used in this tutorial........................................1
Practical work .........................................................................................2
Ribbons ...................................................................................................2
2 - Absolute References
3
Absolute References ...............................................................................4
The absolute reference shortcut key........................................................5
Exercise ...................................................................................................6
3 - Copy and Paste in Excel
8
Paste Special ...........................................................................................9
Pasting Formats .......................................................................................9
Pasting Values .......................................................................................10
Pasting with Operations ........................................................................10
Pasting With Operations - One to Many ...............................................11
4 - Functions
12
The Components of an Excel Function ................................................ 12
The SUM function ................................................................................ 12
AutoSum Options ................................................................................. 12
The Formula Palette ............................................................................. 13
Insert Function ...................................................................................... 14
Nesting Functions ................................................................................. 15
Multiple ranges as arguments ............................................................... 17
Multiple Functions ............................................................................... 17
String Arithmetic .................................................................................. 17
Date Functions ...................................................................................... 19
EDATE Function .................................................................................. 20
The WEEKDAY Function ................................................................... 21
5 - Custom Formatting
22
Custom Formats ................................................................................... 22
Placeholders .......................................................................................... 23
Colours ................................................................................................. 24
Inheritance ............................................................................................ 24
Using Placeholders and Colours........................................................... 25
Thousands ............................................................................................. 25
Currency ............................................................................................... 25
Text ....................................................................................................... 25
Percentages ........................................................................................... 25
Special Width Spaces ........................................................................... 26
Dates ..................................................................................................... 26
Times .................................................................................................... 27
Elapsed time ......................................................................................... 27
Using Formatted Dates in String Arithmetic ........................................ 28
6 - Conditional Formatting
29
Highlighting Values ..............................................................................29
Creating a Custom Conditional Format ................................................30
Highlighting Highest or Lowest Values................................................32
Data Bars ...............................................................................................33
Managing Conditional Formats ............................................................33
Icon Sets ................................................................................................34
7 - Lists and Sorting
36
About Data Lists in Excel .....................................................................36
Simple Sorting.......................................................................................37
The Sort and Filter Control ...................................................................37
Sorting on Multiple Columns ................................................................38
Sorting a Section of a List .....................................................................39
Sorting in Rows .....................................................................................40
Sorting in an Alternative Order .............................................................41
Sorting by Format .................................................................................42
Next Steps in Excel
1 - Introduction
Using these notes
This document provides self-paced tuition in the use of Excel for Windows beyond that
provided in the Introduction to Excel. Alternatively it can be used as a basic reference guide.
Previous experience of using Excel spreadsheets is assumed and a basic understanding of
Microsoft Windows is required.
Setting up course files
The best way of working with the course files is to extract them to an easily identified directory
on your computer’s hard disk or your central file store but a memory stick or other removable
drive is sometimes a useful alternative.
You will find your computer more responsive if you do not open too many files at one time so
it is best to close files when you finish with them. If you need to save them for later you will be
prompted to do so in the text otherwise you may like to preserve the original so you can repeat
the section later.
Conventions and symbols used in this tutorial
In this document keyboard instructions are given in the following way:
Press: [Ctrl] & b or [Ctrl] + b means hold down the [Ctrl] key then press the b key once
Press: [Spacebar], []
means press the [Spacebar] then press the [] (enter) key
Type: “The cat sat”
means type the text within the quotes but not the quotes
Commonly used keys are indicated as follows:
[]
The Enter or Return key
[Ctrl]
Either Ctrl key (bottom left or right of the alphabetic keyboard)
[Alt]
The Alt key (just left of the spacebar)
[Fn]
The function key numbered n, e.g. [F5] (across the top of the keyboard)
[][][][]
The left, right, up, down cursor keys
Centre for Staff and Educational Development UEA
1
Practical work
At various points in the course you are expected to do practical work in Excel and these
places are indicated by boxed and shaded text like this. Numbered instructions should be
followed in sequence and care should be exercised not to miss any lines of instruction.
Ribbons
Ribbons provide access to the various features available. The Ribbon is a band that runs across
the top of the window and it contains commands that are divided into sets of commonly used
features. Ribbons are selected by clicking on a tab. For example, the main set of frequently
used commands is displayed on the Ribbon selected by the Home tab.
When isolated reference is made to controls on Ribbons the Ribbon name will be given
followed by the Group and then the Control name e.g.
Home, Font, Bold
References to controls made in the text of an exercise or example will give information
according to the context so if the font is being modified the ribbon and group would be
assumed and reference will just be made to Bold, Italic or Underline.
2
Centre for Staff and Educational Development UEA
Next Steps in Excel
2 - Absolute References
Under normal circumstances, when you enter cell references into a formula in Excel, they are
stored relative to the cell in which you enter them, that is, they are Relative References. In the
example below, the formula in B5 tells Excel to "sum the cells in the three rows above the
active cell in the same column".
In this way, when the formula is copied to another location, it works in its new position.
Copied to cell C5, for example, the formula shown above will automatically adjust to read
=SUM(C2:C4).
Sometimes, however, the cell reference contained in a formula needs to refer to the same cell
wherever it is placed. In order to achieve this you must use an Absolute Reference.
1. Open the workbook called ABSOLUTE
2. Select B14
3. Enter a formula to calculate the total number of weeks let for En-Suite rooms in the
period Sept-Dec.
4. Copy the formula across to complete Jan-Mar and Apr-Jun.
5. Examine the formulas in the cells C14 and D14. Notice that they have adjusted to fit in
their new positions.
6. Select B14:D14
7. Copy the range down to row 16 to complete the number of weeks let for Standard and
Paired unit rooms. (Use the fill handle on the selection or copy and paste.)
Here is a situation where using relative references in a formula has not produced the desired
result. The cell addresses have been adjusted and the weekly income calculation is incorrect.
NOTE: The error #VALUE! appears when a cell used in a formula contains text, in the
example above the contents of cell B12 are text so B16 returns the #VALUE! error. The rest of
the cells return zero because empty cells have a numeric equivalent of zero.
Centre for Staff and Educational Development UEA
3
Absolute References
To produce the correct results the formula must multiply the number of rooms let for each
room type by the correct number of weeks in each case, always from row 10. This is an
occasion for using something other than a Relative Reference.
Absolute References
Absolute references do not change as the location of the formula is changed, they are also
sometimes referred to as static or fixed references.
1. Select cells B14:D16 with B14 as the active cell
2. To create the correct reference you must place a $ sign before the element of the cell
reference which must remain static or absolute, like this B$10.
The $ sign before the row number ‘fixes’ this value so even if the formula is copied to a
different row the reference will always be to row 10. The column is not absolute and will
still change as we move the formula to different columns.
3. In the formula bar type a dollar sign before the 10 so that the formula reads
=B5*B$10
4. Use the control key and Enter ([CTRL] + [Enter]) to update the formula in all nine cells
Notice that the formula is correctly adjusted for each column and row in the relative
references but the reference to row 10 remains static.
Strictly speaking B$10 is a mixed reference, mixed references contain a combination of
absolute and relative elements so just one component of the reference is fixed, either the row or
the column. An absolute reference is when both elements are fixed, for example if we were
referring to a single cell containing the VAT rate and wanted all the formulas to use the same
cell.
The cell reference options are:
B10
-
both column and row are relative
$B$10 -
both column and row are absolute
$B10 -
column reference is absolute, row reference is relative
B$10 -
column reference is relative, row reference is absolute
The formula required in our example contained the Mixed Reference B$10 which allows the
column reference to vary but ‘fixes’ the row reference to 10.
4
Centre for Staff and Educational Development UEA
Next Steps in Excel
The absolute reference shortcut key
1. Clear the contents of all the cells in the range B14:D16
2. Select B14
3. Enter the formula =B5*B10
4. As soon as you have typed the reference B10 Press [F4] on the keyboard
5. The cell reference B10 becomes an absolute reference $B$10
6. Pressing the [F4] key repeatedly will scroll through the Absolute Reference options.
7. Press [F4] enough times so the formula reads =B5*B$10
8. Copy the formula to the remaining cells in the Number of Weeks Let table as above
9. Look at the formula in B21
10. Using the shortcut key or just typing the $ sign, alter the formula so it can be filled into
the range B21:E23
TIP: The weekly rates are arranged in a single column and three rows.
11. Fill the formula to the range B21:E23
You should end up with the formula =B14*$G5 in B21 resulting in all the formulas referring
to column G for the weekly rates.
Centre for Staff and Educational Development UEA
5
Absolute References
Exercise
Open the workbook called NS EXERCISE
You have a sheet containing the hourly rates of pay for General and Supervisory Staff and
another sheet containing their worked hours. You need to calculate their gross pay based on the
appropriate rates for the four shifts and each person’s hours worked in each shift. You will
need to enter absolute or mixed references as necessary to obtain the correct results.
The Hourly_Rates sheet looks like this:
The Hours_Worked sheet looks like this:
6
Centre for Staff and Educational Development UEA
Next Steps in Excel
On the Gross_Pay sheet you need to enter the formulas using the correct references to calculate
the pay due to each person. Write two formulas; one for General Staff and one for Supervisors.
The resulting sheet should look like this:
Centre for Staff and Educational Development UEA
7
Copy and Paste in Excel
3 - Copy and Paste in Excel
Open the workbook called PASTE
When you use the clipboard to copy and paste information using the Home, Clipboard, Paste
command, Excel pastes all the components of the copied cells: contents, formats, cell
comments and formulas by default.
1. Select January Sheet, Range A14:E14
2. Select Home, Clipboard, Copy
3. Select Cell A17
4. Press [ ]
Look at the contents of the
copied cells in turn. Notice that
all the components of the
copied cells have been pasted
into the selected range.
As
Excel
uses
relative
referencing by default, where
the contents of the cells are
formulas they have been
adjusted to reflect their new
position.
When pasting using the shortcut keys, right click, or Ribbon, you will be
presented with a set of icons representing the various paste options.
These icons are initially colapsed and you can expand them by clicking
on the Option button or by pressing the [Ctrl] key.
Each icon (the ones offered may vary from those shown here) has a
tooltip showing its function and a shortcut key which can be pressed
after using the control key or clicking to open the list.
The same icons and shortcut keys apply when you expand the Paste
button in the Clipboard group of the Home Ribbon.
In the following table the function of each icon is described and the
letter key which invokes that function is identified.
8
Centre for Staff and Educational Development UEA
Next Steps in Excel
ICON
Key
[Ctrl]+
Description
ICON
Key
[Ctrl]+
Description
P
Paste entire cells as
they are
V
Paste values only, no
formulas or formatting
F
Paste formulas and
values only, no
formatting
A
Paste values and number
formatting, no formulas
O
Paste formulas,
values and number
formatting
E
Paste values and all
formatting, no formulas
K
Paste formulas,
values and all
formatting
R
Paste formatting only, no
values or formulas
B
Paste formulas,
values and formatting
without borders
N
Link to the original cell
W
Paste formulas,
values and formatting
with column width
U
Paste a picture
(embedded)
T
Rotate through 90˚
(Formulas don’t work)
I
Paste a picture (linked)
Paste Special
Paste Special is a feature which allows you to choose to paste only the aspects of the cell you
require. For example, you may wish to paste the value of the cells rather than the formula, or
contents without formatting. These features are the same as the Paste Options although they are
slightly more limited. In addition to these, Paste Special also offers the option of pasting with
operations so that you can add, subtract, divide or multiply the contents of the copied and
destination cells.
The following examples illustrate the options available when using Paste Special and are not
intended to suggest a viable method for processing data.
Pasting Formats
Still on the January sheet
1. Select the range A2:E14
2. Select Home, Clipboard, Copy
3. Select Totals sheet, A2
Centre for Staff and Educational Development UEA
9
Copy and Paste in Excel
4. Select Home, Clipboard,
Paste, Paste Special
5. Click on Formats
6. Click on OK
7. Press [Esc] to end the operation
All the cell formatting from the copied range is applied to the Totals sheet range.
Pasting Values
1. Select January Sheet, Range B6:E14
2. Select Home, Clipboard, Copy
3. Select: Totals sheet, B6
4. Select Home, Clipboard, Paste, Paste Special
5. Click in Values in the Paste section of the Paste Special dialogue box.
6. Click on OK
7. Press [Esc] to end the operation
Observe that the range B14:E14 on the totals sheet contains the values of the copied
range rather than the formulas.
NOTE: You could have used the Paste Values option on the Paste control or on the Paste
Options to achieve the same effect.
From this point on instructions will be to use Copy, Paste and Paste Special without the
full procedure being written each time.
Pasting with Operations
1. Copy the range B6:E14 on the February Sheet
2. Select Totals sheet, B6
3. Select Paste Special
4. Click in Values in the Paste section of the Paste Special dialogue box.
5. Click in Add in the Operation section
(If None is selected in the Operation section, the contents of the destination cells will be
replaced by the values of the newly copied cells.)
6. Click on OK
7. Press [Esc] to end the operation
8. Repeat this technique to add the values of March B6:E14 to the Totals sheet.
10
Centre for Staff and Educational Development UEA
Next Steps in Excel
The Paste Options button appears after a Paste Special allowing many combinations of effects
to be used whilst pasting.
Pasting With Operations - One to Many
It is also possible to use the Paste Special procedure in one to many situations.
1. Copy the Range B6:E14 on the Totals Sheet
2. Select Year Forecast sheet, B6
3. Paste Special, Values
4. Click on OK
5. Press [Esc] to end the operation
To forecast the Departmental Costs for the year you could multiply each of the items by 4 in
one operation using Paste Special.
Making sure that the Year Forecast sheet is the active sheet:
1. Select B18
2. Enter 4
3. Copy B18
4. Select the range B6:E14
5. Paste Special
6. Select Values
AND
7. Select Multiply
8. Click on OK
9. Press [Esc] to end the operation
Each of the values in the range is multiplied by 4.
Centre for Staff and Educational Development UEA
11
Functions
4 - Functions
The Components of an Excel Function
Microsoft Excel contains a large range of built-in functions which can be used in formulae to
perform a variety of automated calculations ranging from simple arithmetic, such as SUM, to
complex formulae such as PMT to calculate the repayments on an interest bearing loan.
Any numerical, textual or control input to a function is called an ARGUMENT and is always
enclosed within the function’s parentheses, multiple arguments are separated by commas. The
output of the function (displayed in the active cell) is the RESULT and is referred to as being
RETURNED by the function.
The exercises below illustrate some of the more commonly used functions.
Open the workbook called FUNCTIONS
The SUM function
You will probably have already used AutoSum to enter the SUM function to calculate totals.
To insert a formula to calculate totals in column H using the SUM function in this way:
1. Select H2
2. Click-on AUTOSUM in either Home or Formulas
3. Excel assumes that you wish to sum the figures in the cells to the left of the active cell
and indicates the selection with a moving border.
4. Press []
Look at the formula contained in cell H2. =SUM(E2:G2) This is an example of the SUM
function.
The function is SUM and the ARGUMENT, contained in parentheses, is the range E2:G2.
5. Copy the formula down to cell H7
AutoSum Options
The AutoSum button has a pull down list of options alongside it
allowing you to select a different function to be applied. This is a
quick way to apply one of the popular functions included in the list.
12
Centre for Staff and Educational Development UEA
Next Steps in Excel
1. Select I2
2. Select Average from the AutoSum Options (Notice the selection Excel makes this time
is incorrect as it has included cell H2 in the function)
3. Correct the formula by selecting the range E2:G2 using the mouse.
4. Press []
The formula in Cell I2 now displays the average of the three numbers in the selected range.
The Formula Palette
It is also possible to type a function directly into a cell, however, as there are over 300
functions built into Microsoft Excel, some of which are quite complex, Excel provides the
Formula Palette to simplify the process.
5. Select I2
6. Clear the contents of the Cell
7. Type “=”
Notice that the name box has changed to
display the last function used
(In the case of this example it is SUM)
8. To select an alternative, click on the down arrow to the right
of the function box.
9. Select AVERAGE from the list to display the ‘Formula Palette’.
Centre for Staff and Educational Development UEA
13
Functions
Observe the following:
Excel has again assumed a range and displays the values contained in that range to the
right of the box.
A description of the function and its components is displayed.
The formula result based on the selected arguments is displayed.
In this case the range Excel has selected is again not the range required to produce an
average of the course scores. To choose an alternative range on the worksheet using the
mouse:
1. Click on the small coloured icon (window icon) in the right hand side of the box
containing Excel’s selected range.
The formula palette contracts to allow access to all cells on the worksheet. Now it is
possible to drag across the range you required.
2. Select the Range E2:G2
3. Click on the window icon at the right of the range box again to return to the formula
palette
4. Click on OK to complete the operation
Insert Function
The drop down list of functions displayed in the name box contains a selection of commonly
used functions. If the function you require is not in the list, you can select More Functions…
to display the ‘Insert Function’ dialogue box.
The ‘Insert Function’ dialogue box can also be displayed using the
control alongside the
formula bar and on the Formulas ribbon, or the ‘More functions…’ Autosum Option.
Note: If the active cell already contains a function these actions will open the Formula Pallette.
14
Centre for Staff and Educational Development UEA
Next Steps in Excel
Notice the search facility in which you can type a description of the function you require, keep
these descriptions short and concise for the best results. Below this is a pull down list of
categories such as Financial, Math and Trig, Text and Statistical. Either searching or selecting
a category will display a list of functions in the selection box, selecting one of these will
display its syntax and description below the selection box. The underlined link to the help
system will give a more detailed description of the function and its application, often with
examples.
You can also access these lists directly from the Formulas ribbon alongside the Insert Function
button and the Autosum button.
To illustrate Insert Function, we will enter a formula into cell J2 to calculate the minimum
value in the range E2:G2.
1. Select J1
2. Type “Minimum”
3. Select J2
4. Click on
5. Type “smallest number” in the search box
6. Click on Go
7. The Select a Function box displays all the appropriate functions.
8. Select MIN
9. Click on OK
The Formula Palette is displayed.
10. Enter the range E2:G2 into the Number 1 box.
11. Click on OK
The function is completed and the minimum value in the range E2:G2 (58) is displayed in the
cell.
Nesting Functions
Functions can be used as part of a larger formula which can also include other functions. For
example, if you wished to calculate the average score rounded to 2 decimal places you could
use a formula containing nested functions to do so. =ROUND(AVERAGE(E2:E7),2).
This may look a little complicated but you can use the formula palette to assist.
Centre for Staff and Educational Development UEA
15
Functions
1. In cell C8 enter Unit Average
2. In cell E8 type “=”
3. Select ROUND from the function list
Notice that the ROUND function requires different arguments to those we have used so
far. In the number box the function AVERAGE and its arguments must be entered, in the
Num_digits box the number of decimal places to which we want to round the result must
be inserted.
Make sure the cursor is flashing in the Number box.
4. Select AVERAGE from the name box
5. Look at the formula bar to confirm that Excel has inserted the function AVERAGE into
the formula.
The Formula Palette has changed to show the arguments for the Average function and
has guessed that the range required is E2:E7. This could be amended if necessary using
the techniques you have already practised.
6. Now the ROUND function must be completed
7. Click in the word ROUND displayed in the Formula Bar
8. The Formula Palette displays the ROUND function
9. Type “2” in the Num_digits box
Take a few moments to read the explanation of this box shown on the formula palette.
10. Click on OK
11. The average unit result rounded to two decimal places is displayed in the cell.
12. Use the fill handle to extend this formula to cell H8.
16
Centre for Staff and Educational Development UEA
Next Steps in Excel
Multiple ranges as arguments
Multiple ranges can be used as arguments either by selecting them with the mouse ([Ctrl] +
Click or [Ctrl]+Drag ) or by typing the ranges/cells separated by a comma.
1. Select C10
2. Type “Overall Average Without Essays”
3. Select F10
4. Type “=Average(“
5. Select E2:E7 with the mouse
6. Hold down the [Ctrl] key
7. Select G2:G7 with the mouse
8. Release the mouse button and the [Ctrl] key
9. Press [Enter] or [Tab] to finish the formula (The closing parenthesis is added for you)
Use the formula bar to observe the formula now in F10;
=AVERAGE(E2:E7,G2:G7)
The two ranges are separated by a comma indicating that they are separate arguments and they
will be evaluated as one average.
Functions which can accept a range will generally accept multiple ranges. Average (and most
numeric functions) will accept up to 255 ranges separated by commas in this way.
Multiple Functions
In addition to nesting functions as described earlier it is also sometimes useful to use more than
one function in a formula combined arithmetically.
In cell E9 enter the formula shown below
=ROUND(SUM(E2:E7)/COUNT(E2:E7),2)
The result should be the same as that in cell E8 but this time we are calculating the
average using the total value (SUM) divided by the number of items (COUNT)
Using functions in this way allows us to create complex formulas without using ‘spare’ cells
for subtotals. Often it is easier to develop the formula using subtotals, or intermediate
calculations, and then to combine these into one final formula.
String Arithmetic
String arithmetic is the term used to describe the manipulation of text data as opposed to
numbers. Whilst it’s not ideal, Excel’s flexibility and range of functions make it a popular
application for handling large amounts of text based data.
Open the workbook called STRING ARITHMETIC
Take a moment to look at the data and observe the following:
Centre for Staff and Educational Development UEA
17
Functions
Some of the names are not in the correct case.
The Unit code contains information about the school in the first three characters and the year
when the unit was last revised in the fourth and fifth characters.
During this exercise we will extract the separate items from the unit code and correct the
formatting of the names. We will also derive an initial and combine this with the last name and
school to generate mailing list information.
Note the headings in columns I to N, these are the columns we will calculate using string
arithmetic.
1. In Cell I4 enter “=PROPER(B4)”
2. In cell J4 enter “=PROPER(A4)”
The PROPER function changes text into proper case which means a capital letter at the
start of each word and everything else in lowercase.
3. Fill these formulae down the range to row 61 to see the effect on names which have
been entered inconsistently
The initial in column K is just the first letter of the first name, we will use the function LEFT
to derive this value. LEFT has two arguments; the text and the number of characters to be
returned from the left of that text.
If we use the value in column B as the first name we will have to correct the case of the
initial as it always needs to be in upper case. We can do this with a function called UPPER
which always returns upper case but we can save some work by using column I which
already has the correct case initial.
4. In K4 enter “=LEFT(I4,1)” (that’s one character from the left of the first name)
We can use LEFT to extract the school name as well, this time we need the first three
characters of the Unit code.
5. In L4 enter “=LEFT(E4,3)”
6. Again fill these formulae down to row 61 and observe the effect
The Last Revised column is a little more involved as we need to extract characters from
the middle of our text. Fortunately Excel has a function called MID to do just that.
MID has three arguments; the text, the position of the first character required and how
many characters are required.
7. In M4 enter “=MID(E4,4,2)” and fill the formula to row 61 as before
Finally we want to create a mailing list showing the name with initial and the school
separated with appropriate spaces and comma between name and school.
8. In N4 enter exactly what is shown below
=K4&" "&J4&", "&L4
Note the spaces carefully
18
Centre for Staff and Educational Development UEA
Next Steps in Excel
This warrants some explanation; the & will concatenate or join text together and " is used
to denote literal text or text in the formula which is simply to show in the cell as it is.
By putting the space and then the comma plus a space in quotes and then concatenating
these with the cell contents our formula will return the string of text we wanted.
9. Fill this last formula down the column to finish the work on string arithmetic
There are many more string or text functions but the most commonly used ones are: LEFT,
RIGHT, MID, UPPER, LOWER and PROPER. The ampersand is used extensively to
concatenate text and it is quite common to have nested functions such as UPPER(LEFT,A1,1))
concatenated with other cell values..
Date Functions
Simple date calculations can be achieved using ordinary arithmetic as dates are stored as a
number of days in Excel and just formatted as dates for our benefit. The number of days is
actually the number of days counting from 01/01/1900 as day1 but this makes no difference to
these calculations.
1. On a blank worksheet enter today’s date in Cell A1
TIP: hold down [CTRL] and press ; to enter the current date as a static value.
2. In cell A2 type “=A1+1” to add one day to today’s date
3. Test this formula with 31/12/2009 in A1
this proves that Excel is ‘aware’ of the end of the year and end of the month
4. Try 28/02/2012 – this proves that Excel is aware of leap years
More complex date calculations require special functions because of the complicated way dates
work, particularly the variable length of months.
The functions in Excel which are most commonly used to manipulate dates are: DATE, DAY,
MONTH, YEAR, WEEKDAY but you will also find EDATE useful when trying to add a
number of months to a date and TODAY for returning the current date as a dynamic value.
1. In cell B1 type “=DAY(A1)”
2. In cell C1 type “=MONTH(A1)”
3. In cell D1 type “=YEAR(A1)”
None of these are very surprising, they simply return the component parts of the date in
numeric form.
These three functions can be useful when you need to work with parts of dates for example
identifying someone’s birthday from their date of birth or examining figures obtained over
several years by month.
Centre for Staff and Educational Development UEA
19
Functions
DATE is a function which returns a date from three numeric values. The three arguments are
year, month and day.
1. In cell E1 type “=DATE(D1,C1,B1)”
This will reconstitute the parts of the date in A1
Try a few different dates in A1
2. In cell E2 type “=DATE(D1,C1,B1+10)”
3. In cell E3 type “=DATE(D1+5,C1,B1)”
These formulae add ten days and five years respectively to the original date
Note: We could have nested the DAY, MONTH and YEAR functions inside the DATE
function to achieve a neater result without the intermediate formulas.
4. In cell A4 enter 5
We will use this cell in a nested version of the formula above
5. In cell F3 enter this formula:
=DATE(YEAR(A1)+A4, MONTH(A1), DAY(A1))
The result should be a date five years after the date in A1 calculated without using the
intermediate formulas.
6. Change the number of years added (or subtracted if you use a negative number) by
altering the value in A4
These examples work well because days and years are predictable in a simple way, adding ten
days is a clear and precise instruction to Excel, as is adding five years.
Adding months is less obvious, do we mean add months containing the number of days in the
starting month, the number of days in the ending month, an average of all the months involved
or calendar months with a variable length of 28-31 days?
In cell E4 type “=Date(D1,C1+1,B1)
This adds one month to the date.
Test it with a few dates to see which behaviour it has adopted.
The actual behaviour is easier to work out if you try a few different numbers of months to add
but in a nutshell if the “result” month does not have enough days to use the day value of the
original date it carries over and adds an extra month. This is sound arithmetic and may be
exactly what you want but often we would consider one month after the 31st of January to be
the 28th (or 29th) of February not the 2nd or 3rd of March.
EDATE Function
The EDATE function is designed to fill this gap in Excel’s date arithmetic, it has two
arguments; the date and how many months (positive or negative) you want to add.
20
Centre for Staff and Educational Development UEA
Next Steps in Excel
1. In Cell E5 type “=EDATE(A1,1)”
The result may not look like you hoped initially because EDATE returns a number not a
date.
2. Format E5 as a date
3. Test the result with different dates in A1 and comparing cells E4 and E5
Fortunately the requirement to perform complex date calculations is not common; these
calculations are usually dealt with by specialised software or database queries. You can,
however, perform most date calculations in Excel with a little patience and ingenuity.
The WEEKDAY Function
The WEEKDAY function is a quick and simple way to identify what day of the week any
particular date falls on, like many date functions it returns a number but this one represents the
day of the week. The two arguments are; the date, and a Return Type.
The return type takes one of the values 1, 2, 3, 11, 12, 13, 14, 15, 16 or 17 which produce the
results shown in the table below.
Value
Effect
Blank
Sunday = 1 to Saturday = 7
1
Sunday = 1 to Saturday = 7
2
Monday = 1 to Sunday = 7
3
Monday = 0 to Sunday = 6
11
Monday = 1 to Sunday = 7
12
Tuesday = 1 to Monday = 7
13
Wednesday = 1 to Tuesday = 7
14
Thursday = 1 to Wednesday = 7
15
Friday = 1 to Thursday = 7
16
Saturday = 1 to Friday = 7
17
Sunday = 1 to Saturday = 7
The values 1-3 are included for compatibility with earlier versions of Excel, you should use the
values from 11-17 by preference.
In cell A3 type “=WEEKDAY(A1,11)” and observe the result
This function is particularly useful when used to identify dates in a list which occur on
particular days, perhaps the weekends or checking sickness patterns for Mondays and Fridays.
Centre for Staff and Educational Development UEA
21
Custom Formatting
5 - Custom Formatting
Open the workbook called CUSTOM
Custom Formats
Sometimes data needs to appear in a certain format which is not one of the standard Excel
formats. This is easily achieved using a custom format. Custom formatting allows decimal
places and number separators to be set as well as controlling the display of negative and zero
values. It also allows text and numbers to be combined and for special characters to be
included.
Examples of where this can be useful are quantities measured in units (other than currency), for
example kilograms, miles, hectares, litres, etc. Without custom formatting these would either
become text, making it difficult to perform calculations, or would just be numbers with the unit
shown in a header or implied by context.
1. Select B1:B6, these cells contain various data values
2. In the Number tab of the Format Cells dialogue box select Custom
Note: There is a useful keyboard shortcut to open this dialogue; [Ctrl]&[1]. During this
section using the shortcut may save you some time.
Take a moment to look at the pre-set formats listed in the list box and then consider the syntax
and structure of a custom format as shown below (spaces added for clarity).
22
Centre for Staff and Educational Development UEA
Next Steps in Excel
Placeholder for
Number
Semicolons used to
separate areas of custom
format
0 ; -0 ;
Format for
Positive numbers
Formatting
component
Placeholder
for Text
0 ; [GREEN] @
Format for
Negative numbers
Format for Zero
values
Format for Text
The semicolons separate the sections which refer to the types of cell content. A semicolon
alone indicates a following blank format section.
Placeholders
The characters representing the cell contents in each section of the format are known as
placeholders and they mark the location of the actual typed numbers or text in the cell. The
allowable placeholders are:
#
Any significant digit
(ie. Not leading zeros before or trailing zeros after the decimal point)
0
Any digit including insignificant zeros
(Will add extra insignificant zeros to numbers to fit the format as in currency)
?
A space to replace insignificant zeros either side of the decimal point
(will add spaces to make the decimal points line up in a column)
(Also works either side of the / in fractions)
@
Whatever text has been typed into the cell
Many characters such as decimal points and commas as separators are simply typed in the
appropriate place within the format. The other characters which can simply be typed in this
way are:
[Space] - + / ( ) Single quotes ! ^ & ~ { } = < and >
Any text to be included in a custom format must be enclosed in double quotes “like this”.
If there are no placeholders in a section then data of that type cannot be displayed although it
can still be used in calculations and will appear in the formula bar.
Centre for Staff and Educational Development UEA
23
Custom Formatting
Colours
Colours are specified by enclosing the colour name in square brackets and must be the first
item in a section.
The eight colours available are:
[Red]
[Green]
[Blue]
[Yellow]
[Cyan]
[Magenta]
[Black]
[White]
Inheritance
Empty sections at the end of a format will inherit formatting from elsewhere according to these
simple rules:
Text: If the text format is left blank without the preceding semicolon it will simply display the
text as normal. With the preceding semicolon the text is formatted without a placeholder so it is
effectively hidden.
Zero: If the zero format is left blank without the preceding semicolon it will inherit the positive
format. With the preceding semicolon the zero is formatted without a placeholder so it is
effectively hidden.
Negative numbers: These behave exactly as zeroes do.
Positive numbers: If a valid format is defined (at least one placeholder or semicolon) but no
placeholders are in the positive part of the format then positive numbers are effectively hidden.
The process of inheritance is best understood by trying some examples. In each case simply
type the example format into the “Type:” box on the formatting dialogue then click on OK.
3. 0.00
This is a positive format, no semicolons are used therefore negative and
zero values inherit the positive format. Text is unaffected.
4. 0.00;
This time the negative number is rendered invisible as it has a format but no
placeholders. The zero still inherits the positive format and text is still unaffected
5. 0.00;;
Now a format has been defined for negative and zero values but no
placeholders have been allocated, both negative and zero values are hidden.
6. 0.00;;;
Here the text format has been set as well, with the expected result that only
positive numbers are now visible.
7. ;;;
This format effectively hides the contents of the cell by specifying no
placeholders for any data.
8. ;
Perhaps a little bit trickier, this one formats positive and negative numbers
with no placeholders. Zero inherits the positive format and text is unaffected. Only text
cells are left visible.
It is important to remember that formatting does not affect the contents of the cell, in all the
above cases the cell contents can still be seen using the formula bar and will still be used in
calculations. This makes the technique useful when suppressing the contents of subtotal cells
so they are not visible on screen or paper.
24
Centre for Staff and Educational Development UEA
Next Steps in Excel
Using Placeholders and Colours
Following the same procedure as above try these examples of custom formats.
1. 0.00;[Red]0.00 This one shows Positive and Zero values in black but Negative
values in red. Note the missing minus sign which you may want to include in the format
for clarity
2. [Blue]#,###.??;;0.00
Much trickier; Positive numbers in blue with thousand
separator commas if appropriate and spaces representing insignificant zeroes after the
point. Negative numbers are suppressed and zeroes have their own two decimal place
format.
Thousands
The comma also acts as a scale of 1000 if placed after the number format so 0.00, will display
fractions of a thousand to two decimal places (eg. 12345.678 will display as 12.35).
Multiple commas can be used in this way to produce figure in millions or billions.
Currency
The built in currency format is usually more than adequate but if required currency symbols
can be included in a number format, the common ones do not need to be enclosed in quotes but
if in doubt you can use quotes anyway.
Text
As mentioned earlier additional text can be included in the format using double quotes to
enclose it, this can be combined with the above use of the comma to show figures in £k for
example whilst retaining accurate numerical values in the cell. This text is in addition to any
other formatting such as placeholders so text from the format can replace the number or text
contents in a cell.
Percentages
Percentages are displayed by multiplying the value in a cell by 100 and adding a % symbol, to
format a number as a percentage place the % symbol after the rest of the number format. The
custom format will take care of the multiplication as part of the formatting.
Note: This means a value of 10 will display as 1000%, 0.05 as 5%, etc.
To display a number with the % symbol but without changing the number display use "%"
(quotes around the % symbol make it appear as text)
Here are a few more examples to try, feel free to experiment with these or your own ideas.
3. 0.0, "£k";[Red]0.0, "£k";0.00
4. 0.00;"negative";"Zero"
5. ?.???;[Red]"Minus" ?.???;"Nothing"
6. #,###.00;;"Zero";"text"
7. #;#;#;"You typed" @
Centre for Staff and Educational Development UEA
25
Custom Formatting
Special Width Spaces
Due to the use of proportional fonts different characters occupy different amounts of space.
This is what makes aligning columns using spaces quite difficult in word processed documents.
In Excel custom formats a special space the width of any character can be included in a number
format by preceding that character with an underscore. Eg. _) produces a space the width of a
closing bracket.
This allows spaces to be included in the place of characters to keep different formats aligned
when using proportional fonts such as Arial and Times New Roman.
This particularly useful when negative numbers are enclosed in brackets as it allows the
decimal points to be properly aligned in a column.
£0.00_);[Red]£(0.00)
Notice the decimal points are aligned by the extra narrow space after the positive numbers
being the same width as the bracket after the negative number.
Dates
Custom formatting can be used with date serial numbers (dates recognised by Excel) to display
them in many new and useful ways.
Date placeholders are often multiple characters for example:
Placeholder
Display
Placeholder
Display
m
Month from 1-12
d
Day from 1-31
mm
Month from 01-12
dd
Day from 01-31
Month from Jan - Dec
ddd
Day as Sun-Sat
mmmm
Month in full (e.g. January)
dddd
Day in full (e.g. Monday)
mmmmm
Month as JFMAMJJASOND
yy
Two digit year
yyyy
Four digit year
mmm
1. Cell D1 contains the date 01/01/2012
2. Try the following custom formats in cell D1
d.m.yy
dd mm yyyyy (spaces between placeholder groups)
dddd dd mmmm yyyy
"The day is " dddd
"The year is " yyyy
The date is formatted according to the same rules applied to number formats so text in
quotes is included and regardless of the format used the original data remains intact
and displayed in the formula bar.
26
Centre for Staff and Educational Development UEA
Next Steps in Excel
Times
The placeholders for time values are simpler:
Placeholder
Display
Placeholder
Display
h
Hours from 1-24 (or 12)
s
Seconds from 1-60
hh
Hours from 01-24 (or 12)
ss
Seconds from 01-60
m
Minutes from 1-60
mm
Minutes from 01-60
AM/PM
12 hour clock
1. Cell F1 contains the time 14:30
2. Try the following custom formats in cell F1
hh:mm:ss
hh.mm (dot time separator)
"The time is " h:mm AM/PM
Elapsed time
The display of elapsed time is sometimes quite difficult, in part due to the way Excel records
time as the fraction of the day after midnight so 0.75 represents18:00.
1. In cell F3 enter 08:30
2. In cell F4 enter 13:45
3. In cell F5 enter =F4-F3
The result in F5 is, as you would hope 05:15 (5 hours and 15 minutes)
To make this more readable we can apply a custom format to show “5 hours and 15
minutes”
4. Format F5 with these placeholders and text: h " hours and " m " minutes"
This works well until the start and end times span midnight.
5. Change the time in F4 to 08:00
The result is a row of hashes because the time difference is now negative, with just a time
in the cell Excel assumes a date of zero, hence the two times appear to be on the same
day. We can include the dates to overcome this problem.
6. In F3 enter 01/01/2012 08:30
7. In F4 enter 02/01/2012 08:00
8. F5 now correctly displays 23 hours and 30 minutes
Another problem arises if the duration exceeds 24 hours.
Centre for Staff and Educational Development UEA
27
Custom Formatting
9. In cell F4 enter 02/01/2012 10:45
The result is now 2 hours and 15 minutes but should be 26 hours and 15 minutes
There are two possible formats to solve this problem:
10. Format F5 with the custom formats below:
d " days " h " hours and " m " minutes"
[h] " hours and " m " minutes"
The first one will display days, hours and minutes, the second displays just hours and
minutes but the square brackets allow Excel to use numbers greater than 24.
It should be remembered that in all cases the durations are stored in Excel as a fraction of a 24
hour day and this is the value being formatted or used in further calculations.
Using Formatted Dates in String Arithmetic
Unfortunately formatting is not carried through when dates are included as part of a
concatenated string of characters.
11. Format D1 using the Custom Format dddd
12. In cell D2 enter this formula:
="New year’s day was a " & D1
The result is the text “New year’s day was a 40909”
40909 is the unformatted serial number representing the date in D1, Excel has failed to use the
custom format because it only applies to the cell D1.
Applying the date format to D2 doesn’t help because this cell contains text, not a date.
Fortunately there is a very powerful function in Excel to allow us to apply formatting as a
formula. The function is called TEXT and it has two arguments; the value to be formatted and
the formatting string to apply.
In D2 enter the new formula:
="New year’s day was a " & TEXT(D1, "dddd")
Note the format placeholder is enclosed in quotes
The result is now: “New year’s day was a Sunday”
The TEXT function works with many but not all custom formats to return a formatted value as
text, it is particularly useful when dealing with dates and times.
28
Centre for Staff and Educational Development UEA
Next Steps in Excel
6 - Conditional Formatting
Open the workbook called CONDITIONAL FORMATTING
Conditional formatting in Excel is the process by which the format of a cell i.e. its colour, font,
border, etc. is determined by the contents of that cell or the result of a formula.
Conditional formatting can be conveniently used to highlight certain sets of circumstances in a
spreadsheet such as extremes of performance or conformity with certain parameters.
In this example sheet we will be formatting cells according to marks achieved, but the same
techniques can be applied to any numeric data and most text as well. For the purposes of this
exercise we will use several methods of conditional formatting and examine different ways of
applying the formatting to a range of cells.
Highlighting Values
Using conditional formatting to highlight particular values or ranges of values is a very useful
technique when dealing with large amounts of similar information.
In our example we will use coloured text to highlight individual marks falling above 70 or
below 40.
1. Select the individual values in semester 1, this is the range E5:G25
2. Select Home, Conditional Formatting, Highlight Cell Rules, Greater Than
This opens the Greater than dialogue box
3. Complete the dialogue box by typing the value 70 and selecting Green Fill with Dark
Green text
4. Click on OK
The cells containing values over 70 are now highlighted in Green.
To complete the required highlighting we must now repeat the process to colour those marks
below 40 in Red and apply the same formatting to the other semesters
Centre for Staff and Educational Development UEA
29
Conditional Formatting
5. Select E5:G25
6. Select Home, Conditional Formatting, Highlight Cell Rules, Less Than
7. Complete the dialogue box by typing the value 40 and selecting Light Red Fill with
Dark Red text
8. Click on OK
9. Change one or two values to check that the conditional formatting works as expected
10. Copy the range E5:G25
11. Paste the formatting only onto I5 and M5
All three semesters now feature the same conditional formatting
The formatting on the sheet now makes it easy to identify high or low marks.
Creating a Custom Conditional Format
Excel can’t always provide exactly what we need so there is a simple dialogue to create a
customised conditional format using formulas.
In this exercise we will highlight the names of those people whose year average mark is above
the overall year average.
We don’t have the overall year average on our spreadsheet but the formula to calculate it is
AVERAGE(E5:G25,I5:K25,M5:O25). To decide which names to highlight we will compare
this value with the individual values in column Q.
This time to avoid having to copy and paste the formatting we will format the whole range of
cells in one go. This means that we will have to take into account the effects of relative
references and must apply suitable mixed or absolute referencing in our formula.
As the overall year average is a useful figure to have on our spreadsheet it would be better to
add it to the sheet now and use this in the formatting rather than entering the entire formula.
Always consider options such as this or using subtotal columns when working with conditional
formatting as they can make the job much simpler and can speed up the process considerably.
30
Centre for Staff and Educational Development UEA
Next Steps in Excel
1. In Q26 enter the formula:
=AVERAGE(E5:G25,I5:K25,M5:O25)
This is the overall average which we will use in the comparison for the formatting.
2. Select the range containing the names to be formatted, A5:B25 making sure A5 is the
active cell
3. Select Home, Conditional Formatting, New Rule
4. Select Use a formula to determine which cells to format
5. In the dialogue box type the formula =$Q5>$Q$26
This formula reads as “The value in Q5 is greater than the value of the year average”.
The $ symbols are there to make sure that when the format is applied to two columns and
several rows the references remain correct.
6. Click on the Format Button and make the font bold and bright green
7. Click on OK in both dialogues
The names of those students who meet our criteria are now coloured green.
Centre for Staff and Educational Development UEA
31
Conditional Formatting
Highlighting Highest or Lowest Values
We might want to highlight the top five students in each semester based on their average mark.
Excel makes this very easy to accomplish.
1. Select H5:H25
2. Select Home, Conditional Formatting, Top/Bottom Rules, Top 10 Items
3. In the dialogue box change the spinner to show 5 values and select Custom Format
4. Format the font bold and the fill yellow
5. Click on OK in both dialogue boxes
6. Repeat the process for L5:L25 and P5:P25 or use Copy and Paste Special or Paste
Options to copy the formatting.
The top 5 students in each semester’s results are now highlighted, other options include
highlighting lowest rather than highest results or highlighting a percentage rather than a fixed
number of values.
32
Centre for Staff and Educational Development UEA
Next Steps in Excel
Data Bars
Data Bars show a graphic representation of the ranking or order of values in a range. We can
apply this technique to the year average column to indicate the ranking of our students.
7. Select Q5:Q25
8. Select Home, Conditional Formatting, Data Bars
9. Click on the Orange Data Bar icon
10. The length of the bar in each cell indicates the ranking of the value from lowest
(shortest) to highest (longest) providing a quick way to spot high or low achievers.
Managing Conditional Formats
We have seen how conditional formats are very easy to apply and, in the first exercise, how
they can be ‘stacked’ to produce different effects. This can result in a confusing number of
rules being applied to a range of cells and can possibly make it difficult to understand what is
happening.
The Conditional Formatting control has self-explanatory tools to clear rules from a selected
range or the whole sheet but it also has an option to manage rules which is a versatile and
powerful tool.
We will use this tool to review our formatting rules and remove one of them to allow us to
explore another type of Conditional Formatting.
Centre for Staff and Educational Development UEA
33
Conditional Formatting
1. Select the range E5:Q25
2. Select Home, Conditional Formatting, Manage Rules
3. Select the Top 5 rule we created for the range P5:P25 as shown
4. Click on Delete Rule to remove this rule from the list
5. Note the up and down arrows allowing rules to be prioritised and the options to create
or edit rules from here, this dialogue is the core of the Conditional Formatting system
6. Click on OK to return to your spreadsheet
The rule we applied to P5:P25 is no longer in place so the conditional formatting has been
removed, the normal formatting such as borders however remains intact.
Icon Sets
We can show a special icon in cells to indicate their status using the Icon Set option in
Conditional Formatting.
For this exercise we will use icons to indicate good, bad and typical averages in column P
replacing the format we just removed in the exercise above.
1. Select P5:P25
2. Select Home, Conditional Formatting, Icon Sets and click on the set called Rimmed
Traffic Lights in the Shapes collection
34
Centre for Staff and Educational Development UEA
Next Steps in Excel
The icons have been added to the cells and indicate the good, bad or typical scores but
these are the default values and we already have our own thresholds of 40 and 70 which
we used earlier. We can edit the rule to use these thresholds instead so our work is more
consistent
3. Select P5:P25 again
4. Select Home, Conditional Formatting, Manage Rules
5. Select the new rule
6. Click on Edit Rule
Observe that the thresholds are at 33 and 67 percent and are both inclusive. We can alter
these settings to match our earlier exercise.
7. Change the values to those shown here:
Notice we have used >= 40 as we are setting the lower amber threshold not the upper red
one which would be <40
This dialogue also allows the icon set to be changed and even for the individual icons to
be selected from different sets.
NOTE: To save having to open this dialogue from the Manage Rules screen you can
choose More Rules when selecting the Icon Set which will take you here directly.
8. Click on OK in both dialogue boxes
The traffic lights now show the red signal for those whose average is below 40, green for those
above 70 and amber for all the rest.
Centre for Staff and Educational Development UEA
35
Lists and Sorting
7 - Lists and Sorting
About Data Lists in Excel
A list is a series of rows and columns containing similar data. Data Lists (also known as data
ranges) in Excel can be used as simple databases, where each row contains a record and each
column is a field. There is no special limit to the size of a data list; it can fill an entire
worksheet if required.
When creating a data list it is best to bear the following characteristics in mind:
A list is bounded by empty cells or the edges of the worksheet
A list is a series of rows and columns that contain similar data.
The first row contains unique column headings that identify the data in the rows
immediately below (known as field names).
These features of a list dictate that we observe the following rules:
Do not leave any complete rows or columns empty within the range of your list.
Leave at least one blank row and one blank column between your list and any other
data in your worksheet.
You can think of a list as a simple database table, where each row is a record and each column
is a field.
Providing you set your list up in this way, Excel will automatically recognise it as a data list in
your worksheet as soon as the active cell is inside the range of the list. This makes many of
Excels data features easier to use.
Open the workbook called LISTS
36
Centre for Staff and Educational Development UEA
Next Steps in Excel
Simple Sorting
Take a few moments to read the following important points:
Excel enables you to sort any rectangular range in a worksheet, including lists. If you want to
sort an entire list, you only need to select a single cell inside the range of that list. If you want
to sort only a section of a list, you must select the required section.
If you are sorting a list with properly defined labels in the first row, Excel does not include the
label row in the sort.
Each sort can be in ascending or descending alphanumeric order. (0-9 then a-z or z-a then 9-0)
When you sort your data list, you change the structure of your data. It is always a good idea to
save your workbook before you start so that you can restore the saved version if necessary.
The Sort and Filter Control
A quick and easy way to sort a list based on one field is to use the Sort & Filter control located
on the Home tab of the ribbon.
1. Click on a cell in the range A3:A22 (the last names)
2. On the Home tab click on Sort & Filter
3. Select Sort A to Z
The names are now in alphabetical order and all the associated data
has been rearranged to remain in the correct rows.
The column headings have not been changed as this row was recognised as field names.
Centre for Staff and Educational Development UEA
37
Lists and Sorting
Notice the slight problem with the two entries with the last name of Jones. As a rule we would
expect Angelina to precede Martin in this list but Excel’s simple sorting does not allow a
second column sort to be added to the existing sort.
Feel free to experiment by selecting cells in different columns and sorting the data but be
careful to only select one cell at a time.
Sorting on Multiple Columns
1. Select any one cell in the list range A3:F22
2. Select Home, Sort & Filter, Custom Sort OR Data, Sort & Filter, Sort
3. The previous sort may be displayed as shown here, if not use the drop down lists to
select an A to Z sort on Last Name as shown
4. Click on Add Level and modify the new sort to look like the one above. We will now be
sorting by both Last and First Name.
5. Click OK to see the result
38
Centre for Staff and Educational Development UEA
Next Steps in Excel
In preparation for the next exercise and to practice this technique:
Use Home, Sort & Filter, Custom Sort to sort the list by Job Title in Ascending order and
then by Salary in Descending order.
Note that descending order is referred to as largest to smallest because Excel recognises
the numeric values and changes the label to suit.
Sorting a Section of a List
Occasionally you may wish to sort only a part of your list or part of a range which does not
comply with the ‘rules’ we defined above and is therefore not a proper Excel list.
1. Select the range A11:F15 (This range should contain all the receptionists in your list)
2. Select:
Home, Sort & Filter, Custom Sort
3. When you select only a portion of your list, Excel may incorrectly assume that there is
a header row. To work with this selection we must make sure that the “My data has
headers” check box is deselected
4. Now the columns are described by their identifiers so you can select your sort options
5. Select and Delete the second level sort
6. In the remaining sort, select Column C and A to Z order to sort the receptionists in the
list by department
Centre for Staff and Educational Development UEA
39
Lists and Sorting
7. Click on OK
The receptionists in the list are now sorted in order of their departments.
Sorting in Rows
Occasionally you may store the data in your worksheet in rows rather than in columns i.e. the
labels will be in the left column rather than in the top row. Such data is not strictly a list in
Excel although as a rectangular range it can still be sorted using the same procedures.
We will use a simple technique to transpose some of our data through 90 degrees in order to
demonstrate sorting in rows. More commonly you would use this technique to arrange your
row oriented data in columns which is usually better practice.
1. Select the range A3:F7
(Field Names and all the Accounts Clerks).
2. Copy this range
3. On a new sheet select cell A1
4. Select: Home, Paste, Transpose
Now the field names are contained in Column A and the data is stored in rows.
Reformat the data (particularly column widths) to make it easier to see what happens.
5. Select the range B1:E6
NOTE: When sorting data stored in rows make sure that you select the whole range you
want to sort before choosing the Sort & Filter command. Do not include labels.
40
Centre for Staff and Educational Development UEA
Next Steps in Excel
6. Select Home, Sort & Filter, Custom Sort
7. Click on Options
8. Select Sort left to right
9. Click on OK
10. In the Sort by drop-down list:
11. Select Row 1, Values, and A to Z
12. Click on OK
The data is now sorted by Last Name across the range.
Note: The case sensitive option sorts lowercase letters before uppercase like this aAbBcC in an
ascending sort and places upper before lower in a descending sort, like this ZzYyXx.
Sorting in an Alternative Order
So far we have only sorted data alphanumerically which is by far the most common sort order
but occasionally we need to sort in orders which are not alphanumeric such as Monday to
Friday, January to December or by geography (e.g. department names for a post drop or
security round). Other examples might be awards of Gold, Silver and Bronze which do not
arrange logically when sorted alphabetically or the seasons of the year; spring, summer,
autumn and winter.
1. Return to Sheet1
2. Make sure that the active cell is in the data list
3. Select Home, Sort & Filter, Custom Sort
4. Make sure that the “My data has headers”
check box is ticked
5. Select Sort by Department
6. Select Sort order Custom List to open the custom list dialogue
Centre for Staff and Educational Development UEA
41
Lists and Sorting
Notice the lists for days of the week and months of the year are already available for
selection
7. Make sure that NEW LIST is selected
8. Click in the box labelled List entries
9. Type:
“HTG ”
10. Type:
“ADC ”
11. Type:
“SSG ”
12. Click on Add
The new list is added to those already displayed and allows us to sort our departments in
the order we want them.
Any list can be entered this way to perform a custom sort.
13. Click on OK in both dialogue boxes
The list is now sorted in order of departments HTG then ADC then SSG
Custom sorting can be applied to as many fields as you wish and combined with alphanumeric
sorting to arrange your data exactly how you want it.
Sorting by Format
Excel also allows sorting by format which can be used for selective arrangements of data.
In our list let’s assume that each department assigns and employee of the month award to one
of its employees and to distinguish this award we colour the employees record using the Good
style from the built in styles.
42
Centre for Staff and Educational Development UEA
Next Steps in Excel
1. Select the multiple range A4:F4,A10:F10,A16:F16
This should select the entire records for three individuals, one from each department
2. Select Home, Styles, Good to highlight these records in green
3. Click on a single cell in the list to deselect the multiple selection
4. Select Home, Sort & Filter, Custom Sort
5. Add a level and raise it to the top of the list with the move up control
6. Choose to sort the department by font colour
7. In the Order column, drop down the first list and choose the green colour, make sure
the second list shows On Top (unless you want the highlighted cells to be at the
bottom of the list)
In this case the only other option is Automatic which would put the unformatted data at the
top; if we had several colours in the list we would have a greater choice.
8. Click on OK
The three highlighted records now appear at the top of the list and both the highlighted and
plain sections of the list are in the departmental order we defined earlier.
Centre for Staff and Educational Development UEA
43
CSED has delivered staff development courses in practical computing for many
years. These help people from a wide range of backgrounds to get to grips with
using computers in their jobs.
Our small team of skilled tutors comprises computing practitioners who actually use
the IT in their work, so the sessions are based not only on theory but on practical
experience. Our IT workbooks, which are designed for self-paced learning, are
available from the ‘Resources’ section of our website.
Centre for Staff & Educational Development
The Registry, Floor 0,
University of East Anglia,
Norwich Research Park,
Norwich, NR4 7TJ
01603 593039
www.uea.ac.uk/csed
© Copyright 2026 Paperzz