Excel Tools & Techniques: September 2017
Excel Tools & Techniques: September 2017
Excel Tools & Techniques: September 2017
Assumptions
It is assumed that students have already used Excel and are familiar with formulae,
functions, relative and absolute cell addressing and creating charts. Any student not
possessing this knowledge should undertake the Excel Precursor Tutorial available
on the Introductory Computing Course for MSc Students Learn site.
Data can be sorted into either ascending (A-Z, -999 - 999, 1/1/00-
31/12/99) or descending (Z-A, 999 - -999, 31/12/99-1/1/00) order.
Clicking on either of the sort buttons (shown right) under the Data
tab on the ribbon will sort on one column. By selecting Sort from the ribbon you can
increase the complexity of the sort by adding several Levels.
Pivot Tables
Note: In previous versions of Excel, pivot table creation was done through a Wizard.
This has now been deprecated in the current version and is replaced as outlined
below.
1. Select the data source and range for the data. This is most likely to be the Excel
spreadsheet you are working with (the default choice); although could, for
instance, be a database table. You can choose a subset of the data using the
Range box. Generally it is best to place it on a new worksheet unless both the
original data set and the pivot table are quite small and you want to change the
original data.
2. At the right hand side of the pivot table you will see the Field List. This is the key
to the whole concept of the pivot table. The Field List allows you to select data
fields to be the page, row and column headings of the new table. Click and drag
the fields you want from the list to the required position in the pivot table layout at
the bottom right.
Once a pivot table is set up it is very easy to rearrange ("pivot") the data into another
configuration. Fields that you no longer need can be dragged back up into the Field
List.
You can also filter out field values to show only those you need to see.
Looking up Values in a Table
Values in a table (not just a pivot table - any Excel data block can function as a table)
can be found using the HLOOKUP and VLOOKUP functions. HLOOKUP finds
values in columns, VLOOKUP finds values in rows. The format for both functions is
shown below.
lookup-value is the title of the column or row that you are looking in.
row/column-index is the number of the row or column from which the value is
returned. (Note: Column number, not reference letter!). This
need not be a fixed value - values can be calculated based
on an offset from a known first value.
Example:
A B C D E F
1 UK France Germany Spain Italy
2 1999 500 376 865 675 342
3 2000 796 978 984 788 438
4 2001 876 348 734 788 623
5 2002 985 854 234 685 757
6 2003 658 986 974 976 365
Excel has a number of useful built in tools to speed up and simplify complex tasks.
You must first ensure that the Analysis Toolpack is enabled - see the separate notes
for how to do this.
Using the Linear Regression Analysis Tool
Select Data Analysis Data Analysis from the ribbon then select Regression
from the dialogue box that appears (you may need to scroll down to find it) and click
on OK. You now need to select the cell ranges for the x and y values by either typing
them in or clicking and dragging on the worksheet. When you click on OK, Excel will
automatically perform the regression and presents the results in tabular form on a
new worksheet. You will learn more about this important technique later on your
course, but for the moment the important values to pull out of the table are the
intercept and the gradient (referred to as X Variable 1). These are the two values at
the bottom left of the table.
SUMMARY OUTPUT
Regression Statistics
Multiple R 0.9238009
R Square 0.8534081
Adjusted R Square 0.8411921
Standard Error 6.509361
Observations 14
ANOVA
df SS MS F Significance F
Regression 1 2960.088313 2960.088 69.8599 2.39441E-06
Residual 12 508.4613649 42.37178
Total 13 3468.549678
Excel contains a linear programming/optimisation analysis tool called Goal Seek that
looks for the best possible ("optimal") solution to a given problem. You set an answer
cell (the target) and Excel will provide the best answer based on the numbers you
set and a constraint (for example that the answer must be a positive integer).
The first thing to do is to build the model that you wish to solve. You will need to
provide an approximate "best guess" answer to complete the model, but it doesn't
matter if this is way off the mark.
1. The reference to a cell containing a constraint value. The cell must contain a
formula or function (Set cell box).
2. The value of the constraint that the cell is to converge to (To value box).
3. The reference to a cell to contain the solution. This cell must contain a value,
not a formula or function (By changing cell box).
Sensitivity Analysis
This is a technique, rather than a tool, which lets you see how changing one value in
an equation alters the result. Several copies of the equation or model are created
and a different value is given to one of the parameters in each instance. Usually, as
with linear programming, you start with a best guess for the parameter's value and
then add and/or subtract from that value to see how the result changes.
Statistical Tests
Sometimes you will want to check that the data you have is valid. This is usually
done by comparing it with a known set of benchmark data. Two particular tests are of
relevance: Chi-square and t-Test.
Chi-square Test
t-Test
A t-test is used to determine the similarity, or lack thereof (the variance), between the
means of two sets of normally distributed data. Select Data Data Analysis t-
Test: Paired Two Sample for Means from the ribbon. The two data ranges to be
compared are then selected and the Mean Difference set to be 0. You must also set
an Alpha value, which is the error probability threshold that you are prepared to
accept. This defaults to 0.05 (95% confidence); which is fine in most cases, but to
get a more accurate result can be set to 0.01 (99% confidence). The important
values to look for are the P(T<=t) values. If these are greater than your chosen Alpha
value, then the null hypothesis (that the distributions are similar) can be accepted.
The two-tailed value tests if the distributions are equal and the one-tailed value tests
if the second mean is bigger or smaller than the first.
Variable 1 Variable 2
Mean 5.598171693 6.090785193
Variance 0.637024397 2.337461184
Observations 12 12
Pearson Correlation 0.100506038
Hypothesized Mean
Difference 0
df 11
t Stat -1.032949922
P(T<=t) one-tail 0.161901816
t Critical one-tail 1.795884814
P(T<=t) two-tail 0.323803633
t Critical two-tail 2.200985159
Monte Carlo Simulation
A Visual Basic Applet is a small program that automates a complex repetitive task;
for instance incrementing a year value, then conducting a series of annual
calculations and presenting the result(s) before moving on to the next year, and so
on.
To enable the use of applets (sometimes called macros) in Excel a further tab (the
Developer tab) must be added to the ribbon:
Click on the File tab and select Options then Customize Ribbon (sic.). Find the
entry for Developer in the right-hand window and click in the checkbox then click on
OK.
Teaching Visual Basic is beyond the scope of this course. If you wish to learn more
there are ample teach yourself books (for instance Visual Basic for Dummies or
Using Excel VBA) available in most bookshops.