working smarter with excelexcelkurs.com/file_storage/excel-compendium2007e.pdf · 2017-09-04 ·...

43
Tore Søfting: Working Smarter With Excel 2007

Upload: others

Post on 07-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

Tore Søfting:

Working Smarter

With Excel 2007

Page 2: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 2

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

Page 3: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 3

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

Page 4: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 4

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. Norwegian vs. American/English versions. These two language versions have few problems communication with one another. A model built in a Norwegian version can be opened in an American/English version without any problems, and vice versa. There are two things we should be aware of when typing a formula manually, and that is the use of symbols in the formula, and the names of the functions. The American/English version uses comma (,) to separate sections of the formula, while a Norwegian, or metric European version uses semicolon (;). So, a formula that looks like this SUM(A1:A10,B1:B10) in an American/English version would look like this SUM (A1:A10;B1:B10) in a metric European version. Also, the function names are different, and this has to be taken into consideration when creating formulas in the respective versions. You can download practice files for this compendium from my website, www.excelkurs.com . Asker, November 2009 Tore Søfting [email protected] www.excelkurs.com

Page 5: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 5

Working smarter with Excel 2009

What is new in Excel 2007 This compendium was originally developed for Excel 2003 and older versions of Excel. As part of updating the compendium to match the 2007-version, I’d like to mention some of the highlights of the new version, and saying a few words on how to find your way around it

News

The new stuff in 2007 can be summed up as:

New user interface

New file types

New functions

New functionality

New user interface

At first sight, the new user interface looks very familiar, symbols and buttons are immediately recognizable, When you start using the program, things tend to become a little more challenging; placement and grouping of the same functions is totally new. The old and familiar toolbars and manu bar has been replaced by what is officially called The Ribbon. There is no simple “translation-key” you can use to understand the placement of the various functions in Excel 2007. The Office Team has more or less started with clean sheets when designing the new interface. There is only one way to handle the new interface, and that is - of course – by working with it and using it. Once familiar with it, the new interface will most likely feel very natural and logical, while the old interface feels exactly that way; old. 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!

New file types

Office 2007 marks the transition to new and improved file types. The most obvious property of the new file type is the size, typically identical workbooks take up half as much space in 2007-format as they do in 2003-format. Other notable improvements are improved stability, and better provisions for exchanging data with other systems. As usual when new file types are introduced, we have to deal with compatibility challenges vs older Excel versions, meaning that an Excel 2007-file cannot be opened in 2003 without a conversion add-in, and even then new functions and functionality will not work. The only 100% safe way to secure backwards compatibility is to save files in 2003-format from Excel 2007. But, by doing this, we also miss out on the improvements of the 2007-file type. So, it is important to think this through and do “the right thing” in your organization. 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).

Page 6: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 6

Working smarter with Excel 2009

Another notable feature of the new file format in Excel 2007 is the size of the sheet: Excel 2003: 256 columns 65 536 rows Excel 2007: 16 384 columns 1 048 576 rows 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:

Sales Sales Sales Sales

127 935 127 935 127 935 127 935

202 651 202 651 202 651 202 651

238 567 238 567 238 567 238 567

127 101 127 101 127 101 127 101

192 267 192 267 192 267 192 267

150 504 150 504 150 504 150 504

225 494 225 494 225 494 225 494

162 690 162 690 162 690 162 690

221 378 221 378 221 378 221 378

Page 7: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 7

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.

If we use only the Home command, the cursor moves horizontally to column A

Similarly you can navigate within your tables like this: 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) This is particularly useful when you have to move the cursor greater distances.

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.

Page 8: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 8

Working smarter with Excel 2009

Alternatively we may use the command Ctrl A to select the whole table (when the cursor is located inside the table). The first use of Ctrl A will select the table; the second use of Ctrl A will select the whole sheet. You may practice this by using other keyboard commands

for selecting parts of a table!

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:

In this case we want the table summed both horizontally and vertically, in other words we are going to make 13 formulas. We can create a formula in B9 and auto-fill it horizontally, and we can create a formula in G2 and auto-fill it vertically. But, we can do it even quicker: Select the range (or table) to be summed up, including the blank

column to the right of the table – G2:G8, and the blank row below the table - B2:G9

One click on the Auto Sum Button will create the 13 formulas instantly. You tell Excel whether you want to sum up the table horizontally, vertically or both ways by selecting the empty column to the right or the empty row below the table.

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

Page 9: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 9

Working smarter with Excel 2009

useful when you want to auto fill a formula vertically over a large number of rows. If you have tried this you will know that you will often end up several hundred rows down on the sheet, and then you have to reverse your motion, and so on. This won’t happen if you double click as Excel will only auto fill as far down as there are corresponding cells to the left of the formula. Notice that the auto-fill stops if there is a breach in the series –that is an empty cell in the closest column on the left.

Adjusting column width (and row height) for multiple columns

By selecting all columns (or only the columns that are to be adjusted) you can give them the same width by dragging on one column, or you can automatically adjust them according to the size of the

content by double clicking (Auto Fit function). If you drag – left or right – in the indicated location, the selected columns will get the same width.

Automatic cell formatting

Initially a cell in Excel has no particular formatting. When we type something into a cell, Excel will interpret this and apply the formatting it deems correct. This works like a charm 99% of the time, but there are occasions where undesired formatting is applied, thereby making problems for us.

Page 10: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 10

Working smarter with Excel 2009

Example: We have a reference number like this: 30-8. If we enter this into a cell, it will be transformed into 30. August. As we understand, the entry is interpreted as a date, and the cell is formatted accordingly. That gives us two challenges: How do we prevent this from happening, and how do we get rid of the date formatting of this cell? 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)

The right mouse button

Experienced users are well familiarized with the right mouse button. In any case, I take this opportunity to remind you of it. Instead of searching for solutions on a number of possible locations on the ribbon, we can simply point to “the problem” and get a limited number of choices by right-clicking. An example: You may wonder whether you can minimize The Ribbon. You get the answer

when you point to the ribbon and right-click:

Page 11: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 11

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

Practice file: Ordrer.xls

Freeze column headings

What happened to the column heading when you scrolled down your worksheet? Excel 2007 offers some new ways to freeze the headings. You can find the alternatives under View – Window – Freeze

panes

Repeat headings on print

Here we have the same problem, but an entirely different solution. Since this is related to the print format, you point to Page Layout – Page Setup – Print titles, place your cursor in the field Rows to

repeat at top .and click on row 1 in the worksheet. If your table is too wide for the sheet you are printing on, you can also repeat the key-column on the left by placing your cursor in the field Columns to repeat at left and clicking on the column(-s) you want to have repeated.

Page 12: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 12

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. If you want to sort by another system than alphabetically or numerically top to bottom or bottom to top, you can click the Order dropdown menu on the sort setup dialog. This option gives you access to all your Custom Lists, and they can be used as sorting keys.

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

Page 13: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 13

Working smarter with Excel 2009

the columns “Antall”, “Brutto pris” and “Netto pris” at every change of “Selger”. The Subtotal-function groups the salespersons and totals their sales : 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. The procedure is as follows: Place your cursor inside the list, point to Home – Editing – Sort & Filter, and filtering buttons will be placed at the top of each column.

Page 14: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 14

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.

Identifying and removing duplicates from a list

Practice file: Liste med dubletter.xls Located in Data – Data tools – Remove duplicates Many Excel users are familiar with the task of “washing” a customer list (or other data list) that may have been exported from the CRM-system. How can we automate the process of removing duplicates from such a list? If we have a hundred records we may just handle this manually, by first sorting, and then going through the list. If we have a few thousand records, we can’t do that. 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.

Page 15: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 15

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.

1. Select the cells that are to be converted 2. Copy the selection (leave the selection) 3. Point to Home – Clipboard – Paste – Paste values

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. The practice file shows this case in detail.

Page 16: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 16

Working smarter with Excel 2009

Some easy-to.use functions Practice file: Liste med dubletter.xls MIN – finds the lowest value in a selection MAX – finds the highest value in a selection AVERAGE – calculates the average value of a selection IF - Makes a choice based on the outcome of a test SUMIF – Sums up numbers from a column based on a criteria in another column. 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)

A test (or a claim) has two possible outcomes, either it is TRUE or it is FALSE. This example shows how we can use the IF-function to assign the correct membership fee to the members of the homeowner’s association based on a test of their age: If the age is greater than (or equal to) 67, the fee is 75, is it is less than 67, the fee is 150. This is the formula: =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. Please refer to the file for all details on this example.

Page 17: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 17

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.

Range is the range where the criteria is located Criteria is in this case the name of the customer. To make a more flexible solution we prefer to refer to a cell where we enter the criteria instead of typing the criteria into the dialog. Sum_range is the range that we wish to sum up. 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.

Page 18: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 18

Working smarter with Excel 2009

Useful functionality in Excel

Validation and protection

Practice file Innrapporteringsskjema.xls In any (real) database much effort is put into minimizing the possibility of incorrect entries in the various fields. If a year is to be entered into a field, there are always limitations as to which years can be entered, and you will also not be able to register something entirely different in the field, like a name or similar. This is a common practice for entering any kind of information into a database. As long as we are working on our own stuff in Excel, we usually do not put much consideration to this. But, when we create models others are to enter data into, we should start thinking about this. We have two tools in Excel that help us reduce the chances of messing up things; Validation and Protection. The Validation tool limits what can be entered into a cell, and the Protection tool makes sure nobody can change the parameters in validation or formulas in the worksheet.

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. Then we can set the validation parameters: 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 Source: here we can type the alternatives, separated with a semicolon, and when we tick In-cell dropdown, the alternatives will appear on a dropdown-list. We can also refer to a list that we have typed somewhere else in the same worksheet. There is a way around having to place the list in the same worksheet, and that is naming the location of the list and referring to that in the Source-field.

Page 19: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 19

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: Cells C11, C12: Expenses can be validated in a similar way. The other cells contain formulas that retrieve their information from the input cells, so we do not place any validation criteria on these.

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: On the menu Home – Font – Open group – Protection: Any cell is by default set to Locked. This setting has no effect until we protect the sheet. Any cell with the formatting set to Locked will be unavailable after Protect Sheet is activated. Consequently, we have to deselect the Locked setting before we activate Protect Sheet.

Page 20: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 20

Working smarter with Excel 2009

The final step is to activate the Protect Sheet function in Review – Changes – Protect Sheet We have now achieved two things: 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. To show which cells put out values outside an acceptable range, we set the validation as described earlier. To circle unacceptable values we point to Data – Data Tools – Data Validation – Circle invalid data. This will make Excel circle unacceptable values with a red circle. We click the next button to remove the circles.

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. This function has been refined and developed substantially in Excel 2007. The illustration shows one example on how it can be used, showing data bars in each cell in the selected range:

Page 21: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 21

Working smarter with Excel 2009

Using the IF-function to highlight cells

We can also use the IF-function to test values of numbers and render a comment like ”Bad”, or ”Good” based on the outcome of the test. Examples can be found in the practice files Analyseeksempel.xls, on the sheet Løsningseksempel4.

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? The procedure is as follows: Place your cursor inside the list Point to Insert – Table - PivotTable and check the proposed selections in the dialog. When you are satisfied they are as desired, click ok and the template for the Pivot Table is created. To move our data into the Pivot Table, tick the appropriate boxes in front of the column headings shown on the right. Let us start with a simple request; we want to know what each salesperson has sold of the various products, and the value series is the net price. To answer this question, we tick off Selger, Produkt and Netto pris. This produces a table like this: We are not too happy about this configuration, so we wish to re-arrange the table to make a cross table with the salespersons as row labels and the product as column labels.

Page 22: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 22

Working smarter with Excel 2009

To do this, we grab ahold of the field “Produkt” in the area Row Labels on the right and move it to the area Column Labels. This renders a table like this: This is better, now we have a great outline of what the various sales persons have sold of the different products. We can experiment my moving the fields around in the table, thus rendering other displays. 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.

Other useful functions Excel has several hundred built-in functions. Many of these are very specialized, requiring extensive knowledge of a subject to be of any use, while others are more general, and may be useful to many users.

VLOOKUP - Vertical lookup

HLOOKUP - Horizontal lookup

Practice file – Finn.rad.xls These are two lookup-functions that respectively search by column or by row for a value defined from our input. 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. One notable feature with this function is that we designate the column it should look for the name in by entering an Index. That means

Page 23: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 23

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. Note! Two important considerations:

You should make sure you enter the parameter FALSE into the field Range_lookup, like this: If we do not do that, Excel will return the closest value to the one we asked for, and this may have unforeseeable consequences. If we enter 120 instead of 102 as we intended, Excel will return the name of the number closest to 120, which is 110. This is somebody entirely different from the person we were looking for! The sorting sequence doesn’t mayyrt

when we use VLOOKUP with the FALSE logic. There are, however, times when we want to use VLOOKUP with the TRUE logic, meaning we want the closest match with the lookup value. In such a case, the lookup column has to be sorted in ascending order. or the lookup will return wrong results. Have a look at the file Nested IF and VLOOKUP.xls for an example of this use of VLOOKUP.

Page 24: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 24

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

Page 25: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 25

Working smarter with Excel 2009

behaving like and being an array formula. In the example above, we can use SUMPRODUCT to extract information about the sales of one or more products for a given salesperson, or for multiple salespersons, for that matter.

Array formulas Practice file: Array formulas.xls

“Straight” array formulas

We can find the answer to such a questions in several ways. We can use functions like SUMIFS, DSUM, or use a pivot table. Personally, I am a fan of array formulas, as this is a technique that can be used on several different functions to solve all kinds of complex problems. 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. This is an example of how we normally get the grand total by multiplying each row, units * unit price, and finally summing up the line totals for the grand total. Now, if our sole interest is the grand total, we could go straight to that by using an array formula. An array formula must be entered in a particular way, by hitting Control + Shift + Enter If you close it the normal way, with only Enter, you will sometimes get an error message, and sometimes the wrong answer, so make sure you remember this!

Conditional Array Formulas

Practice file: Salgsdata_stor.xlsx, sheet LøsningMatriseFormel. Array formulas really come into their right when we use them for extracting data, or doing other kinds of operations while taking multiple conditions into consideration. Using array formulas this way means using Boolean logic. An approximate definition of Boolean logic that it reduces a mathematical problem down to a TRUE or FALSE outcome. Also, bear in mind that TRUE can be substituted by the digit “1”, and false can be substituted with “0”. Boolean logic is used in array formulas to make them retrieve information from database-like worksheets. Have a look at these basis calculations:

Page 26: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 26

Working smarter with Excel 2009

TRUE * TRUE = TRUE TRUE * FALSE = FALSE 1 * 1 = 1 1 * 0 = 0, or 1 * 1 * 1 * 1 * 0 = 0 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. This is a screenshot of the file Pivot og Delsammendrag.xls:

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.

Page 27: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 27

Working smarter with Excel 2009

D-functions Practice file D-funksjoner 2.xls

DSUM, DAVERAGE, DMAX,DMIN , etc.

Excel has a series of functions with the D-prefix. The “D” comes from Database, so these are functions designed to retrieve data from large collections of structured data. Setting up these functions is very similar to the set-up of advanced filter. We type the arguments of the function somewhere in the worksheet and refer to them, instead of typing them directly into the function. 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: What is the total result for the combination of Avdeling 2, Prosjekt 2? 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.

Page 28: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 28

Working smarter with Excel 2009

Other ribbon-based tools. In Excel we solve problems partly by using functions in formulas, and partly by using tools located on the ribbon. Let us take a look at some of these ribbon-based tools:

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? We have looked at the function PMT earlier. We might use this and simply type in amounts until we were close to our 8 000 per month. This would take some time, and we would never be able to get an accurate amount. However, if we use Goal Seek, we can get the exact amount immediately: Locate Tools – Goal Seek on the menu, and enter parameters as shown: Set cell B9 to value 8000 by changing cell B3 - and we have the answer immediately.

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:

Page 29: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 29

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 these two parameters. Graphically we can render it like this: 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

Sammenheng mellom reklameinnsats og overskudd

0

20000

40000

60000

80000

100000

120000

Alt 1 Alt 2 Alt 3 Alt 4 Alt 5 Alt 6 Alt 7 Alt 8

Reklameinnsats:

Overskudd

The profit culminates here?

Advertising spending Profits

Page 30: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 30

Working smarter with Excel 2009

and type/select: F13<=40000. 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.

Page 31: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 31

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. This is where the tool Consolidation shines. It is able to sum up sheets based on referring to column and row headings, not the usual cell references! Example: First, open all three files, and then open another blank workbook. Point to the consolidate tool to start the dialog. Leave the cursor in the field Reference, browse to the first open workbook (Oslo), select A3:D10, and click Add in the dialog. Next, browse to Bergen and Trondheim do the same procedure. Make sure you select correctly, you need to include the column and row headings. The dialog should look like the illustration above: Note! We have ticked off all three tick boxes for labels and for links to the source data! The new workbook is now showing the totals, and we have accomplished this very quickly! Clicking the plus-signs in the left margin will display the specification behind every consolidated number. As the months do not appear in their correct

Page 32: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 32

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: Then you go to Order, select Custom List and locate the months in the list: This will re-arrange the columns, and the months will be placed in their correct sequence.

Single value and dual value table

Practice file: Datatabell.xls Located in Data Data Tools – What-if-analysis – Data Table The Table function allows us to analyze alternatives very quickly, and have the results lined up for side-by-side comparison. 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:

Importing data from the Internet and from other applications

Practice file: Hente data fra internett.xls Excel ”talks” very well to many other applications. Thus we can import information from other applications into Excel for further analysis and calculation. When exporting to Excel from any administrative system, we use the features in that respective system. In many cases we just click an Excel-button to create an Excel file from whatever query or report we have created. When looking at this process from the Excel-side, we use the Import features of Excel to get the various reports into Excel.. Example:

Page 33: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 33

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)

After a few seconds the page will open, and we get these yellow selection handles that enable us to import only the stuff we want form the page. We just select the table(-s) we want to import by clicking the yellow arrow.

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.

Klikk og merk her!

Page 34: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 34

Working smarter with Excel 2009

Importing live data from the Internet

In many calculations we have to take into account ever changing outside factors, for example currency rates, interest rates or stock values. 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.

Split cell content.

Practice file:the result of the import from the Statistical Office When importing data we don’t always get the data separated the way we want. In this case we have both the ID number and the name of the municipality in the same cell. We have the same challenge when a customer name and number both are in the same cell. 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.

Page 35: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 35

Working smarter with Excel 2009

Retrieving information from inside a text string

In addition to the two functions LEFT and RIGHT, we have the function MID that is used for extracting digits from inside a string The syntax is: 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.

Page 36: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 36

Working smarter with Excel 2009

If we had not formatted the number as text, we would have lost the leading zero. If we are presented with material where this has happened, we can use the following procedure to rectify the situation: Procedure:

Select the cells in question Point to Format- Cells –Custom Type four zeros into the field Type.

A few words on text vs. numbers in the postal (zip) code. 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.

Page 37: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 37

Working smarter with Excel 2009

Hiding error messages

Practice file: Skjule feilmeldinger.xls 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. The function IFERROR In this example we have added the text No data:

Page 38: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 38

Working smarter with Excel 2009

Tracing relations in formulas

Practice file: Løsningsforslag Totalresultat for Bedriften AS_startslutt.xls Most of us are familiar with this scenario: You have inherited an Excel model from a colleague (who of course has quit), and you are trying to decipher the relations, and also the basic logic in the model. Point to Formulas – Formula Auditing for tools to help you get the understanding of an Excel-model. 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.

Page 39: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 39

Working smarter with Excel 2009

New and useful features in Excel 2007

New functions

The examples in this compendium are based on use of Excel 2007. Excel 2007 has gotten a thorough overhaul, mostly in the interface and looks departments, but also when it comes to functionality. Notably:

New user interface

New functionality The number if new functions is limited. Altogether there are less than ten new functions; some of them are really something we have been waiting for. These are:

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:

Practice file: Averageif.xlsx

=AVERAGEIF(A2:A5;”>100”;B2:B5)

AVERAGEIFS works with more than one criteria.

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.

Practice file: Countifs.xlsx and Countifs2.xlsx

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.

Page 40: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 40

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:

Salg Salg Salg Salg

127 935 127 935 127 935 127 935

202 651 202 651 202 651 202 651

238 567 238 567 238 567 238 567

127 101 127 101 127 101 127 101

192 267 192 267 192 267 192 267

150 504 150 504 150 504 150 504

225 494 225 494 225 494 225 494

162 690 162 690 162 690 162 690

221 378 221 378 221 378 221 378

-

50 000

100 000

150 000

200 000

250 000

300 000

1 2 3 4 5 6 7 8 9 10

Salg

Kostnader

Page 41: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 41

Working smarter with Excel 2009

Or, we may go to war with a partly transparent data point in a graph. All in all, the possibilities for spending hours and days “improving” the looks of your graphs have taken a great leap forwards.

Some keyboard shortcuts Many users find the use of keyboard shortcuts very challenging. The problem is often the sheer number of shortcuts, so we should try to keep the number of shortcuts limited. I have listed some that I use regularly below!

Action Shortcut Comment

Copy Ctrl+C general, works in all apps

Cut Ctrl+X general, works in all apps

Paste Ctrl+V general, works in all apps

Save Ctrl+S general, works in all apps

Print Ctrl+P general, works in all apps

Open Ctrl+O general, works in all apps

Close Ctrl+W general, works in all apps

Auto sum Alt += same as clicking

Browse to next sheet Ctrl PageUp/PageDown

Select row Shift+ Space

Select column Ctrl +Space

Insert(Cells/row/column) Ctrl ++

Delete (row or column) Ctrl+ – (minus)

Formatting Ctrl +1 Opens formatting dialog

Undo Ctrl +Z

Undo undo Ctrl +Y

Today’s date Ctrl +;

Time right now Ctrl+:

Select table Ctrl + A

Select all cells in worksheet Ctrl +A Ctrl+A Ctrl+A twice

Move cursor to next breach in series

Ctrl +→ (arrow in the desired direction)

Select from here to next breach in series

Ctrl +Shift+ → (arrow in the desired direction)

Move a column with the mouse Select column, press left mouse button and drag

Copy column/ row Same as above, but press Control, too

127 935

202 651

238 567

127 101

192 267

150 504

Salg

Page 42: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 42

Working smarter with Excel 2009

Finally – how to get help with Excel-problems This little leaflet and the corresponding course have both hopefully advanced your knowledge of Excel a few steps. None of them can give The Final Answer to Excel problems. This means that the advanced and interested Excel user will run into problems from time to time. The more you learn, the more you realize how much there is you don’t know. Therefore, it is very useful to know here you can turn to get some assistance:

The built in help system in Excel

The help system has been getting steadily better over time, and I find many of the examples described there very useful. It is also easily searchable, so go ahead, try it out!

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.

Page 43: Working smarter with Excelexcelkurs.com/File_storage/Excel-compendium2007E.pdf · 2017-09-04 · Microsoft has provided transition applications that show us where functions are located

w w w . e x c e l k u r s . c o m

Page 43

Working smarter with Excel 2009

Index

A

Advanced filter, 14

Array formulas, 25

Auto filter, 13

AVERAGE, 16

C

cell formatting, 9

column headings, 11

column width, 9

Conditional Array Formulas,

25

Conditional formatting, 20,

37, 40

Consolidation, 31

Copying formulas, 8

COUNTIF, 17, 39

D

Database, 27

DAVERAGE, 27

D-functions, 27

DMAX, 27

DMIN, 27

DSUM, 27

duplicates, 14, 15

E

error messages, 37

F

Filter, 13

formatting, 20

functions, 16

G

Goal Seek, 28

H

help, 42

hiding error messages, 37

HLOOKUP, 22

I

IF, 16, 21

IF-function, 16

Importing, 32, 34

Internet, 32

Internet resources, 42

ISERROR, 37

K

keyboard shortcuts, 41

L

list, 11, 14, 15, 18

List functions, 11

live data, 34

M

MAX, 16

MID, 35

MIN, 16

N

Navigation, 7

O

Output validation, 20

P

Pivot table, 21

PMT, 24

protection, 18

Protection, 18, 19

R

Remove duplicates, 14

Repeat heading, 11

Right mouse button, 10

row height, 9

S

Scenarios, 30

Selection, 7

Solver, 28

Sorting, 12

Subtotals, 12

SUMIF, 16, 17

summing-up, 8

SUMPRODUCT, 24

T

Text to columns, 35

Tracing, 38

V

Validation, 18

VLOOKUP, 22