Professional Documents
Culture Documents
Working Smarter With Excel 2007: Tore Søfting
Working Smarter With Excel 2007: Tore Søfting
Working Smarter With Excel 2007: Tore Søfting
Working
Smarter
With
Excel 2007
Working smarter with Excel 2009
Table of contents
Table of contents ..................................................................................................................................... 2
Introduction............................................................................................................................................. 4
What is new in Excel 2007 ....................................................................................................................... 5
News..................................................................................................................................................... 5
New user interface .......................................................................................................................... 5
New file types .................................................................................................................................. 5
New functions ................................................................................................................................. 6
Improved graphics ........................................................................................................................... 6
Conditional formatting .................................................................................................................... 6
The Basics ................................................................................................................................................ 7
Navigation ............................................................................................................................................ 7
Selection ............................................................................................................................................... 7
Smart summing-up ............................................................................................................................... 8
Copying formulas ................................................................................................................................. 8
Adjusting column width (and row height) for multiple columns ......................................................... 9
Automatic cell formatting .................................................................................................................... 9
The right mouse button ..................................................................................................................... 10
List functions ......................................................................................................................................... 11
Freeze column headings .................................................................................................................... 11
Repeat headings on print ................................................................................................................... 11
Sorting ................................................................................................................................................ 12
Subtotals ............................................................................................................................................ 12
Filter ................................................................................................................................................... 13
Advanced filter ................................................................................................................................... 14
Identifying and removing duplicates from a list ............................................................................... 14
Some easy-to.use functions .................................................................................................................. 16
The IF-function ................................................................................................................................... 16
The SUMIF-function ........................................................................................................................... 17
Useful functionality in Excel .................................................................................................................. 18
Validation and protection .................................................................................................................. 18
Validation ........................................................................................................................................... 18
Protection........................................................................................................................................... 19
Output validation ............................................................................................................................... 20
Conditional formatting ....................................................................................................................... 20
Using the IF-function to highlight cells .............................................................................................. 21
Pivot table .......................................................................................................................................... 21
Other useful functions........................................................................................................................... 22
VLOOKUP - Vertical lookup ................................................................................................................ 22
HLOOKUP - Horizontal lookup............................................................................................................ 22
PMT .................................................................................................................................................... 24
SUMPRODUCT ....................................................................................................................................... 24
Array formulas ....................................................................................................................................... 25
“Straight” array formulas ................................................................................................................... 25
Conditional Array Formulas ............................................................................................................... 25
When should I use array formulas, and when should I use Pivot Tables? .................................... 26
D-functions ............................................................................................................................................ 27
DSUM, DAVERAGE, DMAX,DMIN , etc. .............................................................................................. 27
Other ribbon-based tools. ..................................................................................................................... 28
www.excelkurs.com Page 2
Working smarter with Excel 2009
Goal Seek............................................................................................................................................ 28
Solver.................................................................................................................................................. 28
Scenarios ............................................................................................................................................ 30
Consolidation ..................................................................................................................................... 31
Single value and dual value table ....................................................................................................... 32
Importing data from the Internet and from other applications ........................................................ 32
Importing live data from the Internet ................................................................................................ 34
Split cell content................................................................................................................................. 34
Retrieving information from inside a text string................................................................................ 35
Text to columns .................................................................................................................................. 35
Hiding error messages........................................................................................................................ 37
Tracing relations in formulas ............................................................................................................. 38
New and useful features in Excel 2007 ................................................................................................. 39
New functions .................................................................................................................................... 39
Improved graphics ............................................................................................................................. 39
Conditional formatting .................................................................................................................. 40
Graphics rendering ........................................................................................................................ 40
Some keyboard shortcuts...................................................................................................................... 41
Finally – how to get help with Excel-problems .................................................................................... 42
The built in help system in Excel ........................................................................................................ 42
Internet resources .............................................................................................................................. 42
Websites............................................................................................................................................. 42
Practice files .......................................................................................................................................... 42
Copyright © ........................................................................................................................................... 42
www.excelkurs.com Page 3
Working smarter with Excel 2009
Introduction
Ever since the computerized worksheet was hatched as a concept in the late seventies, and the first
worksheet application became commercially available in 1979 (VisiCalc), it has become the
foundation for all financial calculation for companies, public institutions and private citizens all over
the world. It is indeed hard to fathom advanced calculations without the use of an electronic
worksheet. And, with an estimated worldwide market share of around 90%, a worksheet is in most
cases an Excel worksheet.
This compendium has been developed as a reference tool for Excel training beyond the fundamental
level. The content of the compendium mostly follows the progress of the course in its description of
the cases. This is no complete textbook for learning Excel; rather, it is a collection of cases for those
who are already literate in the basic use of Excel.
For those of you who want to immerse yourselves in Excel, there are several excellent books
available. I have listed some of these elsewhere in this publication.
The various versions of Excel in use today do not differ too much form each other, except for the
2007-version. If you are running Excel 2000, 2002, or 2003, there are only marginal differences. But,
if you are running 2007, you know that there are serious differences. The working of the worksheet
itself is not much different, but the interface is totally changed. Gone are the menus and the
toolbars. In their place we have gotten The Ribbon. The result is that the first few days (or weeks)
running 2007 will consist of a lot of searching for the various functions. But – having conquered the
principles of the placement of functions – things should start working very smoothly. And – after still
more time, one tends to find those earlier versions somewhat old fashioned.
You can download practice files for this compendium from my website, www.excelkurs.com .
Tore Søfting
tore.softing@excelkurs.com
www.excelkurs.com
www.excelkurs.com Page 4
Working smarter with Excel 2009
News
The new stuff in 2007 can be summed up as:
New user interface
New file types
New functions
New functionality
Microsoft has provided transition applications that show us where functions are located in the new
interface. I have linked to these on www.excelkurs,com . Scroll down to the paragraph Office/Excel
2007, and click the links for Excel, Word, PowerPoint and Access!
Excel 2007 has a built-in compatibility checker, so you will be notified of compatibility issues when
you save a 2004-workbook in 2003 file format.
The new file types are recognizable on a modified icon, and the new file extension (for standard
workbooks), .xlsx (vs .xls in 2003)
Another important, and useful, feature in Office 2007, is the ability to save documents in pdf-format.
This feature is not activated upon installation of Office 2007, you have to go through an initiation
procedure to activate this feature (Office button – Save as - Search for other file types).
www.excelkurs.com Page 5
Working smarter with Excel 2009
Another notable feature of the new file format in Excel 2007 is the size of the sheet:
This is great news for all of you working with analysis of large data volumes, for most others it
probably does not matter much.
New functions
Excel 2007 is equipped with a number of new functions. The most notable are:
Name Description
IFERROR Simplifies handling of error messages in formulas
AVEREAGEIF Calculates averages when a condition is met
AVERAGEIFS Calculates averages when multiple conditions are met
SUMIFS Sums when multiple conditions are met
COUNTIFS Counts items when multiple conditions are met
Improved graphics
Things tend to look better with every new version, and Office 2007 is no exception. Graphical
renderings look much better now, making older versions look a little “home-made”.
Conditional formatting
Conditional formatting is a well-known feature from older versions of Excel, and this tool has been
extensively re-worked for 2007, providing a vast array of visualization options for your Excel
worksheets. Here is an example:
www.excelkurs.com Page 6
Working smarter with Excel 2009
The Basics
It is very important to use the basic functionality of Excel correctly in order to work rationally. The
typical participant on this course is an experienced Excel user who may use the application for quite
complicated calculations. However, my experience tells me that the same user does not always use
the smartest ways when it comes to the basic functionality of Excel. The following describes a
collection of basic techniques that should speed up your use of Excel, even if you are an experienced
user.
Navigation
Everybody knows we can click the cursor into any position in the worksheet. Instead of clicking, we
may use the keyboard for much quicker navigation.
Jump to A1:
Wherever the cursor might be located in the worksheet – jump to A1 by pressing Ctrl + Home.
From B2 to B9 (next break in the series) using Ctrl + (arrow down), and from A6 to G6 (next break in
the series), Ctrl (right arrow)
Selection
Selection and navigation are
closely linked. Selection is done from the keyboard by pressing the Shift key while moving the cursor
by means of the navigation commands. All navigation commands can be combined with Shift,
thereby enabling selection, for example:
If you want to select the whole table (the area A1:G9) when the cursor is located in G9, you press
Ctrl+ Shift +Home, and presto, the table is selected.
www.excelkurs.com Page 7
Working smarter with Excel 2009
Smart summing-up
We all know Excel is clever when it comes to summing up numbers, but do you know that Excel can
sum up this way:
Copying formulas
Instead of creating formulas one by one, we can use the Auto-fill function to copy a formula from one
cell to several other cells. The vertical copying (or Auto fill) is normally accomplished even quicker by
double clicking the Auto Fill handle instead of grabbing ahold of it and dragging it. This is particularly
www.excelkurs.com Page 8
Working smarter with Excel 2009
www.excelkurs.com Page 9
Working smarter with Excel 2009
Prevention:
We can either:
Pre-format the cell as Text, or
Type an apostrophe (‘) before we enter whatever
needs entering. The apostrophe (‘) will format the
content to Text.
Removal:
We can apply another format, or remove both content and format (Home – Editing – Clear – Clear
All)
www.excelkurs.com Page 10
Working smarter with Excel 2009
List functions
A list in Excel-is a collection of data organized in such a way that various tools and functions in Excel
can be applied to it.
Characteristics of a list:
Each column has a heading
The heading is formatted different from the content(for example bold)
Preferably nothing above the list itself
No blank rows or columns
No information located to the right (or the left) of the list
www.excelkurs.com Page 11
Working smarter with Excel 2009
Sorting
Located in Home – Editing – Sort & Filter (Also in Data - Sort & Filter – Sort)
We select the Sorting Key by placing the cursor in the column we wish to sort by, and then clicking
the sorting buttons to sort the list in ascending or descending order.
Note! Do not select the whole column we want to sort by! If we do, we risk sorting only the selected
column, thereby messing up our list totally.
Excel through version 2003 can sort by up to three simultaneous keys, while Excel 2007 has an
unlimited number of
keys available.
Subtotals
Located in Data – Outline -
Subtotals
Practice file: Pivot og
delsammendrag.xls
We have a very quick and
easy way of extracting
information from a large
list by using the tool
Subtotals. Point your
pointer to Data – Subtotals
to use this tool. In this case,
we have asked for a sum of
www.excelkurs.com Page 12
Working smarter with Excel 2009
the columns “Antall”, “Brutto pris” and “Netto pris” at every change of “Selger”.
By clicking the
numbers (1, 2, 3)
in the top left
corner we can
change the
detailing of the
numbers. If we
want to remove
the subtotals we
point to Tools –
Subtotals and
select Remove all.
Note! Before
applying subtotals
to a list, we have
to sort it by the
key we want to
subtotal by, in this
case ”Selger”.
The Subtotals-tool works fine with limited amounts of data, but tends to be very slow executing
larger volumes. Some testing on a data list with 85 000 records shows that generating subtotals, and
changing subtotal options can take 2 . 3 minutes. Generating and changing a pivot table on the same
data takes no measurable time at all.
Filter
Located in Home – Editing – Sort &
Filter (and in Data – Sort & Filter –
Filter)
Earlier versions of Excel used the
term Auto filter. Functionality of
the filter has been vastly improved
in the 2007 version, and the term is
now simply filtering. Filtering
makes it very easy to filter out
records we have no interest in
seeing – in order to see those that
are of interest to us.
www.excelkurs.com Page 13
Working smarter with Excel 2009
Using the Auto filter is simple and intuitive. , we just deselect or select the records we want to leave
visible. We can combine as many conditions as we need to in order to secure the desired result.
Advanced filter
Located in Data – Sort & filter - Advanced
In earlier versions of Excel we had to resort to the Advanced filter function ever so often. As
described above, the functionality of the Auto filter has been expanded so much that we only very
rarely should have to use the advanced filter. Hence, I will limit my coverage of the advanced filter to
saying that it should be used when or if the desired results are not achieved by the Auto filter.
Earlier versions of Excel had no dedicated tool for this, and we had to combine various other
functions and tools to accomplish this.
Excel 2007 is equipped with a built-in tool designated to do just this. After locating (Data – Data tools
– Remove duplicates) the function and starting it, we get this dialog:
Using the
dialog, we tick
off the
parameters, or
column
headings, to tell
Excel which
fields have to
match in order
to constitute a
duplicate. Make
sure you have a
clear
understanding
of what actually
is a duplicate. A
company name
may appear
several times
due to the fact
that they have
branches in
several
locations, so if you want to keep all of these branches, you tick off both Company Name and Address.
www.excelkurs.com Page 14
Working smarter with Excel 2009
The Remove Duplicates Tool is easy and logical to use, the only obvious caveat being the fact that
Excel deletes the duplicates without asking your consent.
If you feel you have to inspect the duplicates before they are deleted, you have to resort to the “old”
way of doing this, which is described in the following paragraph.
If we start with the practice file, we first need to sort the records based on Customer ID. This will
place possible duplicates adjacent to one another. We then use the IF-function to compare each and
every Customer ID with the next one. The formula looks like this: =IF(B2=B3;”Duplicate”;””). Use Auto
fill to extend this formula to all cells in column A. As we have asked the IF-function to type the word
“Duplicates” next to a record that is equal to the one above, we can quite easily see where the
duplicates are located. However, if we have a large list with thousands of records, we would
probably want to relocate all duplicates to the top of the list. This entails a little more than just
sorting the list. First of all we need to end the dependency of the comment “Duplicates” on the
content of the adjacent column. This we do by converting the formula into value, or put in another
way, into the result of the formula.
The copied area is now pasted on top of the area we originally selected and copied, and the formulas
are converted into whatever they were showing at the time. Now we have only the text “Duplicates”
next to the duplicates, and we can sort the list (descending) without any problems. This will place all
duplicates on the top of the list, where they can be easily inspected, deleted or edited.
We can also envisage that the criteria for a duplicate is that both the Customer ID and the name-
columns have equal contents. The procedure is in principle the same, but the formula is a bit more
complicated:
=IF(B2&C2=B3&C3;"Duplicate";"").
By using this system we can ask Excel to check any columns for duplicates, either individually or in
any combination.
www.excelkurs.com Page 15
Working smarter with Excel 2009
The MIN, MAX and AVERAGE functions are basic and obvious both in their use and their functionality,
so we will not cover them here. We will concentrate on functions that require more input than just a
selection in the worksheet.
The IF-function
Practice file: HVIS-funksjon
This function enables Excel to make a choice for us, in its most basic form between two alternatives,
based on the outcome of a logical test.
=IF(TEST;TRUE;FALSE)
=IF(C9>=$C$6;$C$5;$C$4)
After entering the formula into cell C9, we use the auto-fill handle to copy it into the other cells in
the range (C10:C20), making sure we use the absolute reference-designation correctly.
Another example of the use of the IF-function can be found is the file HVIS-lønn.xls. Here we test
for the value of the sales of each person in order to decide if they should have a bonus, and what it
should amount to.
www.excelkurs.com Page 16
Working smarter with Excel 2009
The IF-function can be used to select between up to 7 alternatives when we use the technique of
nesting the functions, that is to say putting them inside each other. An example of such use is located
in the file Nested IF-functions. ,
The SUMIF-function
Practice file: Ordrer.xls
The SUMIF-function sums up a given column based on a matching criteria in a column to the left.
What is the total value for the field Beløp for the customer Alfreds Futterkiste? We can easily answer
that question using this function.
COUNTIF – counts the number of occurrences of a text or value, for example how many occurrences
are there of the customer Alfreds Futterkiste in column A.
www.excelkurs.com Page 17
Working smarter with Excel 2009
Validation
Located in Data – Data Tools – Data Validation
By using the validation tool, we can decide what can be entered into a cell. The practice file depicts a
case of reporting financial info. The user can enter information into the input cells. These are the
only cells where information can be entered, and we have decided what kind of information can be
entered. In the cells C3 and C6 only predetermined alternatives from a drop-down list can be
entered, while in cells B7 and B8 only numbers within a given range can be entered.
To set the limitations on what may be entered, point to Data – Data Tools – Data Validation. Here we
can see that initially we can enter anything
into a cell.
Cell C3:
Here we are to register one out of five
departments, and to make this job as easy as
possible for the user, we select:
Allow: List
www.excelkurs.com Page 18
Working smarter with Excel 2009
We can choose to visit the tabs Input Message and Error Alert and type an instruction and an error
message.
Cell C6:
Here we select Allow list and enter the names of the “reporters”, in the same way we entered the
alternative departments for the first cell, or by referring to a range within the worksheet that
contains the list of months.
Cell C9:
This is the cell where we are to enter the revenue figures. To keep the user from entering a digit too
few or too many, we can set a lower limit of 30 000 000 and an upper limit of 40 000 000, based on
empirical data, as shown on the right:
Protection
Step one - unlock cells is located in Home – Font – Open group - Protection
Step two – protect sheet is located in Review – Changes – Protect Sheet
Now that we have decided what can be entered into the cells, it is time to make sure nobody
tampers with the validation – or with the
formulas, for that matter. Before we do that,
two things must be clear:
www.excelkurs.com Page 19
Working smarter with Excel 2009
The final step is to activate the Protect Sheet function in Review – Changes – Protect Sheet
We have decided which cells are available for data entry, and
We have decided what can be entered into the same cells.
Output validation
We first and foremost use data validation to control and limit what is entered into a cell. But, we can
also use validation on an output cell, which is a cell containing a formula. The scenario is then
somewhat different. It would be unthinkable to deny the display of whatever values appear in such a
cell, so we use this function to accentuate values that are outside what we deem an acceptable
range.
The screenshots are from the file Validering og beskyttelse.xls. You can also find examples in the file
Analyseeksempel.xls.
Conditional formatting
Practice file: Analyseeksempel.xls
Located in Home – Styles – Conditional formatting
The tool Conditional formatting can be used to focus on values that are remarkable in a positive or
negative way.
www.excelkurs.com Page 20
Working smarter with Excel 2009
Pivot table
Practice file: Pivot og delsammendrag.xls
Located in Insert – Table – PivotTable.
Earlier, we have looked at the use of the tools Subtotals, Auto filter, and Advanced filter to retrieve
information from large lists. The Pivot Table is a tool that does many of the same things, usually even
more elegantly than the other tools.
Once more we can open this file and ask ourselves the inevitable question: How are our salespersons
actually doing?
www.excelkurs.com Page 21
Working smarter with Excel 2009
The Pivot table is an extremely powerful tool, maybe the most powerful analysis tool in Excel. Data
can be analyzed in innumerable ways using this tool. The example described here is definitely the
short version of the saga of the Pivot Table, and should be considered as a quick introduction to the
subject.
Example:
By entering the employee number,
the VLOOKUP-function will search
vertically in the designated column
for the value that corresponds to
the employee number.
www.excelkurs.com Page 22
Working smarter with Excel 2009
we count columns from left to right (within the matrix), and the index 2 will give us the first name of
the employee.
This file also contains an example on the use of the function .HLOOKUP.
Have a look at the file Nested IF and VLOOKUP.xls for an example of this use of VLOOKUP.
www.excelkurs.com Page 23
Working smarter with Excel 2009
PMT
Practice file – Målsøking.xls
This function calculates the payment per term for an annuity based loan, and as such is useful to
everybody involved in financial calculations.
When the function is set up properly, the parameters can be changed, and we can see the result on
the payment directly.
Note! The interest rate that is referred to from cell B2 must be divided by the number of terms per
year in cell B3.
Also, the total number of payments (B5) must be the result of a formula. If it is typed into the cell, it
won’t update when parameters are changed, and the payment will not be correct.
SUMPRODUCT
Practice file – Pivot og delsammendrag.xls
The SUMPRODUCT function seems to lead a somewhat anonymous life. The function is a true power-
function, and it can do the most amazing things. From that perspective, it may not be very
sensational to be able to multiply two arrays with each other and give us the sum. What is more
impressive, is its ability to do these things while taking multiple conditions into consideration.
Somewhere else in this
compendium I have
mentioned the new-for-
2007 function called
SUMIFS, which is also able
to do that trick. A more
general way of saying this
is that SUMPRODUCT can
do some of the tricks of an
Array Formula without
www.excelkurs.com Page 24
Working smarter with Excel 2009
Array formulas
Practice file: Array formulas.xls
So, what is an array formula? Consider that a normal formulas basically deals with relationships
between individual cells, whereas we cans ay that an array formula deals with arrays of numbers,
and can do arithmetic operations directly on the arrays, without taking a detour to each individual
cell.
www.excelkurs.com Page 25
Working smarter with Excel 2009
So, all it takes is one FALSE/ZERO in a calculation, to give the calculation the outcome of FALSE or 0.
What this means in practice, is that only records where all conditions come out with TRUE or 1, will
be retrieved.
We can extract Herbert Schulz’ sale of “bukser” with the following array formula:
=SUM((A2:A12=”Herbert Schulz”)*(B2:B12=”Bukser”)*(H2:H12)). Remember to close with Control +
Shift + Enter!
When should I use array formulas, and when should I use Pivot Tables?
Different people have different preferences, but the general answer would be this:
Use pivot tables for quick analysis of static data. Nothing beats pivot tables for speed and ease!
Use formulas when you design a model that will live over some time, and where the data changes, or
grows. The (array) formulas will make sure you always have updated and correct calculations, no
manual action is required.
www.excelkurs.com Page 26
Working smarter with Excel 2009
D-functions
Practice file D-funksjoner 2.xls
Example:
In the file D-funksjoner.xls,on the sheet
Uttrekk_1, we have a dump from an
accounting system. The records all have three references; Avdeling, Periode, and Prosjekt. We wish
to match these three criteria to be able to answer a question like:
First we enter the criteria, see the sheet Uttrekk_2. We then set up the function in B4 in the same
sheet. Then we start the function wizard, and enter parameters this way:
Database is the sheet Data, select the area with contents, including the heading.
Field is the data we want to sum up. We identify this column by selecting the heading – and only
that.
Criteria is the area of the sheet where we have entered out criteria. Make sure you select both yje
criteria and the headings. The headings are used to identify the columns, so they have to be included.
Excel has D-functions corresponding to many of the better-known functions, DSUM, DAVERAGE,
DMIN, DMAX, etc.
In most cases we would probably be better off creating a pivot table, so the D-functions should be
used when the layout of a pivot table does not fulfill our needs, or when we need immediate and
automatic update of the results, without having to run a manual update of a pivot table.
A drawback of the D-functions is their very specific requirements for setting up the criteria ranges in
the worksheet. If you need t analyze many different combinations of criteria, it will take a lot of work
so set this up, and you might want to have a look at other ways of solving this; conditional array
formulas, SUMIFS, pivot table.
www.excelkurs.com Page 27
Working smarter with Excel 2009
Goal Seek
Practice file – Målsøking.xls
Located in Data – Data Tools – What-if-analysis – Goal Seek
This is a simple and easy-to-use tool that calculates backwards by simulating alternate input
arguments in a function
much quicker than we are
able to do this.
Example:
We are buying a new house.
We have calculated that we
can manage 8000 per
month in payments. The
interest rate is 6%, and the
bank says the maximum
number of years for re-
payment is 15. How much
money can we borrow?
Locate Tools – Goal Seek on the menu, and enter parameters as shown:
Solver
Practice file: Solver.xls
Located in Data - Analysis - Solver
Goal Seek is ok for its intended use, but in many cases we have problems with multiple variables.
These variables have to be optimized simultaneously and against each other, and that is not possible
with Goal Seek. We have to use a much more advanced tool, the Solver.
Example:
www.excelkurs.com Page 28
Working smarter with Excel 2009
We have a budget for next year for our company. This is no common budget where we calculate
values outside the budget-model and enter the values into the model. This is a “live” budget
application where we want to optimize the use of our advertising money. The idea is that spending
money for advertising will increase our sales, up to a point. When a certain level of spending has
been reached, more spending will not increase sales sufficiently to leave is a profit. Thus, beyond this
point, we will lose money by spending even more for advertising. The real-world challenge is of
course to know the
formula that relates
Sammenheng mellom reklameinnsats og overskudd
these two The profit culminates
parameters. 120000 here?
Graphically we can
render it like this: 100000
80000
60000
40000 Reklameinnsats:
Advertising spending
Profits
Overskudd
20000
0
Alt 1 Alt 2 Alt 3 Alt 4 Alt 5 Alt 6 Alt 7 Alt 8
Note! If you can’t find the Solver-tool at the described location, it has not yet been installed. In that
case you have to run the installation routine. Click the Office button and point to – Excel options –
Add ins, and select Excel Add-ins. Select the Solver Add-in in the lower part of the window and click
Go. Excel 2007 should normally not ask for the installation disk.
We will now
maximize the
profit (F14) by
letting Solver re-
distribute
advertising
spending
between the
quarters, but at
this stage we do
not accept an
increase in the
total advertising
spending. To
illustrate how we
do this, we set a
limitation to
total advertising
spending (F13):
in the
constraints
group, click add
www.excelkurs.com Page 29
Working smarter with Excel 2009
We also have to tell Solver that advertising expenditure in any given quarter cannot be less that 0,
that is to say that negative numbers are not accepted. The constraint looks like this: $B$13:$E$13>0.
With these criteria the profit is maximized to around 109 000. If we run the simulation without
setting any limitations on advertising spending, the profit will go up to 145 000, and advertising
spending will be more than 160 000. This is the point where the graph for profits starts pointing
down.
The Solver is a very powerful tool, b it in order to use it meaningfully, we need models that describe
reality in a realistic way. To design such models is often the problem.
Scenarios
Practice file: Budsjettscenario.xls
Located in Data – Data Tools – What-if-analysis – Scenario Manager
The term scenario is a familiar term to everybody working with accounting and finance. We often
have three scenarios, one worst case, one best case, and one middle-of-the-road. Technically
scenarios can be handled in many different ways, even with adjacent columns in the budget. Excel
has a built-in tool that enables storing several different values in one cell, and retrieving these values
based on selecting the different scenarios.
Example:
Here we have a small and simple budget consisting of one cell for income and one for expenses.
These two cells have three alternative values connected to three scenarios, and we will now enter
and store these values in their respective cells. We start by entering the numbers for the scenario
Worst Case. In order to keep track of the different scenarios, it is a good idea to enter the name of
the scenario in a cell – here B7. The next step is to select the cells in the scenario, B3:B4 and B7. Go
to the scenarios tool (see location above) and click Add in the dialog. Type the name of the scenario
and click ok until we
have closed the
dialog. Next, we
deal with the other
two scenarios the
same way. After
entering the three
scenarios, we can
point to the
different scenarios
the Scenario
Manager, and
change scenario for
our budget by
selecting the
appropriate scenario
and clicking show.
www.excelkurs.com Page 30
Working smarter with Excel 2009
Consolidation
Practice files: Konsolidering Oslo.xls, konsolidering Bergen.xls, konsolidering
Trondheim.xls
Located in Data – Data Tools - Consolidate
These three files all show sales figures for our branches in these three different cities. Now, we want
to total the numbers. There is however, a problem with that; the three worksheets we need to total
are not equal. We have different brands of cars, and they are placed haphazardly in relation to each
other. We could build formulas to sum up all
this, but with a large number of cells, we
would be lucky to get everything right, and we
would spend quite some time accomplishing
this.
Example:
www.excelkurs.com Page 31
Working smarter with Excel 2009
sequence, we should sort the columns. Start by selecting the columns C through G. Go to Data – Sort
and Filter – Sort. Clikc the Options button and select Sort left to right:
Example:
We want to analyze the cost
of borrowing with two
variables; interest rate and
amount borrowed.
A description of the
procedure can be found in
the practice file:
When looking at this process from the Excel-side, we use the Import features of Excel to get the
various reports into Excel..
Example:
www.excelkurs.com Page 32
Working smarter with Excel 2009
We wish to import a table from a page at the website of Norwegian Statistical Office. The address is
http://www.ssb.no/fobhusinnt/tab-2003-12-18-01.html
Some of us may have tried to ”import” by just selecting and copying data from a web page and
pasting into a worksheet. In most cases this is highly unsuccessful. The correct way of doing this is to
use the Import Wizard in Excel. The Import Wizard can be engaged two ways, either from Excel, as
described below, or simply by right-clicking (Export to Microsoft Excel) the web page we wish to
import.
Start by opening the web page referred to above. Here you may right-click the page, or do the
following:
Select the URL (the web address) and copy it to the clipboard (Ctrl C)
Go back to Excel and point to Data – Get External Data – From Web
A “mini”-browser appears, and we now paste the address that we just copied into the address field
at the top, replacing the start page address that is there.
Hit Enter (or click Go)
Klikk og merk
her!
Next, click Import, then select destination cell, and presto, everything is nicely imported into the
worksheet. The numbers are correctly formatted, and we can now proceed in our analysis of the
numbers.
In most cases you can accomplish this result by simply right-clicking in the web table and select
Export to Microsoft Excel. The caveat with the right-click method is that you are not given a choice to
select parts of the web page, you will in most cases get the whole web page imported into Excel.
Note! This works only with Internet Explorer – tests with other browsers have all been
unsuccessful.
www.excelkurs.com Page 33
Working smarter with Excel 2009
In the following example we will create a live link from Dagens Næringsliv’s currency rate website to
a workbook. The address is http://www.dn.no/finans/valuta/
Procedure:
First we locate the website from where we want to import live data
Then we select and copy the URL (web address)
Browse to Excel and place you cursor in a blank worksheet
Point to Data – Get External Data – From Web.
Paste the address you copied into the address field of the mini browser.
Select the table(-s) you want to import by clicking the selection handles.
You may go to Options and select HTML formatting for a nicer look.
Click import
In the next dialog, click Properties, and set the update frequency as you want it.
Click ok, and the data is in the worksheet!
Now we have a live link into a web page and our calculations will update when new information is
retrieved from that web page!
Note! You can start the import process by right-clicking the web table and select Export to
Microsoft Excel.
There are several ways of dealing with this in Excel, here are some examples:
We can use the functions LEFT and RIGHT to solve this. These functions are easy to use as long as we
are to split at a given number if digits. In this case all numbers have four digits, so it is easy to say
that the first four digits should be extracted and placed in a separate cell. It is harder to extract the
name, but it can be done.
The example is
elaborated on the
sheet Høyre_Venstre
in the workbook
Hente data fra
Internett.
www.excelkurs.com Page 34
Working smarter with Excel 2009
MID(Cell reference of text string; Number of characters from the left; Number of characters to be
extracted)
Text to columns
Using the built-in tool Text to columns is normally the easiest way to accomplish the splitting. This
tool is located in Data – Data Tools – Text to Columns.
Example:
In the worksheet Tekst til kolonner we want to split the municipality number and the name and place
these in separate cells:
Procedure:
Insert two new columns between cols A and B
Select the cells you want to split(A9:A26)
Point to Data – Data Tools - Text to Columns
Here we have the choice to split on a character or on fixed width, and as the municipality number has
four digits, we can use both ways. As some of the municipalities have hyphenated names we get the
best and easiest results by going for fixed width. Next, we see the dividing line between number and
name. If we select B9 as destination cell, we won’t overwrite any of the present information in the
worksheet.
To avoid losing the leading zero in the number, select the column and format it as Text:
That’s it, we have split number and name and placed them in separate cells.
www.excelkurs.com Page 35
Working smarter with Excel 2009
Procedure:
Select the cells in question
Point to Format- Cells –Custom
Type four zeros into the field Type.
As long as the numbers are to continue living their lives in Excel, we can keep the described
formatting. However, if we want to work on these numbers in certain ways, notably merging the
numbers into a Word document, we will run into trouble. The merging process will once more
remove the leading zero. The solution to this is to do as described above, format the number as text
during the import procedure.
The numbers will now be stored as text, and the leading zeros will survive any abuse we might
subject them to.
But, they will be text, and we can’t use them for any kinds of calculations.
www.excelkurs.com Page 36
Working smarter with Excel 2009
There are times when we are annoyed by cryptic error messages in our worksheets. In an otherwise
stellar set-up we get this error message if we try to divide by zero:
#DIV/0!
The reason may simply be the fact that the cell we try to divide by doesn’t contain any information at
all:
Error messages can be hidden (or dealt with) in two different ways
Conditional formatting
The function IFERROR – which is new to Excel 2007, and greatly simplifies this procedure.
Earlier versions of Excel need a formula where we use a combination of IF and ISERROR.
Conditional formatting
We simply use conditional formatting go give the cell contents white color when a condition is met,
thus making it look “invisible”. This solution only cures the symptom, and if this is not good enough,
we have to resort to solution number two.
Procedure
Select the cells you what to apply conditional formatting to
Point to Home – Styles - Conditional Formatting
From the drop-down list you select New rule and after that Use a formula to determine….
Type the following formula into the formula field:
=ISERROR(C2)
– where C2 is the cell with the calculation where the error message may appear.
Click Format and set the character color to white.
The error messages will now be invisible.
www.excelkurs.com Page 37
Working smarter with Excel 2009
Let’s say we are looking at the Resultat cell and we are wondering where this number actually comes
from. Place your cursor on the cell, click the Trace precedents button, and arrows will tell you where
the input to this formula. Click once more, and you will see where the contents of those cells stem
form, and so on. If you get a dotted arrow with an icon depicting a worksheet at the end, point to the
arrow, and double click. You will now get a dialog showing the origin, and you can follow it by
selecting the reference and clicking ok. Using this technique, we can follow the “trail” all the way to
the end. or rather, the start of the model.
www.excelkurs.com Page 38
Working smarter with Excel 2009
IFERROR
AVERAGEIF
AVERAGEIFS
SUMIFS
COUNTIFS
IFERROR simplifies handling of error messages substantially. As we have seen earlier in this
publication we have had to use a combination of IF and ISERROR to make Excel (2003 and earlier
versions) type a free text in case of an error message. This can now be accomplished directly by
using this function.
AVERAGEIF corresponds to SUMIF and COUNTIF, and it calculates the average from a
series of values while taking into account a given criteria. The following formula gives the
average of values that are greater than 100 in the selected range:
=AVERAGEIF(A2:A5;”>100”;B2:B5)
SUMIFS
In earlier versions of Excel we have the function SUMIF (and COUNTIF). These are great
for their intended use, but what if we need to sum while testing for multiple criteria? This
can be done in these versions, but it is a rather daunting task. This has become very
simple in Excel 2007.
Improved graphics
I guess we all expect things to look a little nicer in the new version of an application. This hope is
fulfilled in the newest Excel. Among other things, the graphics engine – that makes graphs, has made
great leaps, for unrivalled graphics rendering.
www.excelkurs.com Page 39
Working smarter with Excel 2009
Conditional formatting
We have discussed conditional formatting at length before. This functionality has been dramatically
improved for 2007. This is an example on how we can use CF to render numbers more
understandable in relation to each other.
Graphics rendering
The improvements mostly consist of a nicer look to graphics. A graph in Excel 2007 may look like this:
300 000
Salg
250 000
Kostnader
200 000
150 000
100 000
50 000
-
1 2 3 4 5 6 7 8 9 10
www.excelkurs.com Page 40
Working smarter with Excel 2009
127 101
238 567
www.excelkurs.com Page 41
Working smarter with Excel 2009
Internet resources
What you can’t find on the internet, is hardly worth finding. You can feel certain that whatever
problems you are faced with have been encountered by a few thousand, or even a few million users
somewhere else in the world. The search engines are great for retrieving this information, so just go
ahead and type in keywords.
Example:
Let’s say I don’t know how to split cells. I will therefore try a Google search like this:
Excel split cells
In less than a second I am presented with more than 194 000 references to this subject.
Websites
There are several websites dedicated to Excel. Just pay them a visit and do a search if you have a
problem. You can find lot of great tips here.
http://www.j-walk.com/ss/ - this is John Walkenbach’s website, the author of The Excel Bible
http://www.cpearson.com/excel.htm
http://www.mrexcel.com
And, my own website is also updated regularly with new Excel tips:
http://www.excelkurs.com
Practice files
This compendium is accompanied by a package of practice files. You can download this package from
www.excelkurs.com . The link yopu should look for is called Zippede øvingsfiler.
Copyright ©
All rights to this compendium, other compendiums published on www.excelkurs.com , practice files,
and other downloadable material, belong to Tore Søfting. You are granted a license to use this
material for developing your Excel skills, solving Excel-related problems and related activities. Use of
this material for training third parties is prohibited.
www.excelkurs.com Page 42
Working smarter with Excel 2009
Index
A G O
Advanced filter, 14 Goal Seek, 28 Output validation, 20
Array formulas, 25
Auto filter, 13 H P
AVERAGE, 16
help, 42 Pivot table, 21
hiding error messages, 37 PMT, 24
C HLOOKUP, 22 protection, 18
cell formatting, 9 Protection, 18, 19
column headings, 11 I
column width, 9 R
Conditional Array Formulas, IF, 16, 21
25 IF-function, 16 Remove duplicates, 14
Conditional formatting, 20, Importing, 32, 34 Repeat heading, 11
37, 40 Internet, 32 Right mouse button, 10
Consolidation, 31 Internet resources, 42 row height, 9
Copying formulas, 8 ISERROR, 37
COUNTIF, 17, 39 S
K Scenarios, 30
D keyboard shortcuts, 41 Selection, 7
Database, 27 Solver, 28
DAVERAGE, 27 L Sorting, 12
D-functions, 27 Subtotals, 12
list, 11, 14, 15, 18 SUMIF, 16, 17
DMAX, 27 List functions, 11
DMIN, 27 summing-up, 8
live data, 34 SUMPRODUCT, 24
DSUM, 27
duplicates, 14, 15 M T
E MAX, 16 Text to columns, 35
MID, 35 Tracing, 38
error messages, 37 MIN, 16
F V
N
Filter, 13 Validation, 18
Navigation, 7 VLOOKUP, 22
formatting, 20
functions, 16
www.excelkurs.com Page 43