Guide to excel


Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Guide to excel

  1. 1. Guide to Excel
  2. 2. ContentsPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v1 Getting started with Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 What is a spreadsheet? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 A trip around the interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Opening, saving, closing, reopening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Working with worksheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Bending Excel to your will. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Adding document details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Shortcut keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 Getting help on Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Working with spreadsheet data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 How Excel interprets data entries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Editing cell data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 Searching for data, replacing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Sorting data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .363 Using spreadsheet formulae . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Using Excel formulae . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Using relative and absolute cell references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Using mixed cell references. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Understanding Excel error messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Using conditional functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504 Improving a sheet’s appearance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Setting display formats for data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Setting display formats for text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Using cell borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65
  3. 3. iv Contents Protecting a sheet’s contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5 Working with charts and graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 What’s a chart, what’s a graph? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Creating a simple chart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Creating other types of chart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Adding legends to your chart or graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Editing charts and graphs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Copying and moving charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Adding charts to Word documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 6 Preparing and printing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 How Excel prints workbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Preparing a worksheet for printing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Printing a worksheet or workbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Saving Excel data using different file types . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Glossary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
  4. 4. PrefaceT hese self-paced units aim to provide you with all the information you need to train yourself in basic Excel skills. They do this by covering Excel in six individual steps. At the end of each step, you have an opportunity to pause and review what youhave learned. To help you pace your study to suit your available time and circumstances,each step is self-contained.What do you need?To make use of the material, you need access to a personal computer running MicrosoftWindows XP on which a copy of Microsoft Office XP Professional or Microsoft Excel 2002has been installed.OverviewWe have tried to design the steps so that many of them can be completed in a minimum ofabout thirty minutes, although a few are more complex and may take longer.Steps 1–6 cover working with data in spreadsheets, using predefined formulae, sprucing upthe appearance of a spreadsheet, for example for a presentation, working with charts andgraphs, and finally preparing and printing spreadsheet data.
  5. 5. vi PrefaceLayout and featuresYou shouldn’t try to get through all the steps Notewithout a break. After each step there arequestions you can use to check your knowledge It’s important to remember this.and to practise what you have learned.The book also gives you signposts to help you Tipkeep track of your progress and to highlightinteresting or important points. To allow you to This can make your life easier.chart your progress, you’ll find icons like this inthe margin to show you how far you have Warningprogressed through each step. Be aware of this.We also use the panels shown on the right tohighlight special or important pieces ofinformation. Stop! Don’t do this.Conventions used in the stepsApart from the graphics mentioned above, thefollowing conventions are used in the steps:■ To indicate a choice from a menu, we use the ➪ character, as in: Choose File ➪ Save to save your work.■ To indicate text that you must enter, for example into a dialog, we use a different font, like this: Enter =$G$5 in the second cell■ We also use the same font to indicate multiple lines of text you must enter. For example: Enter the following information into column A: Mary Joe Peter Frank Sue■ To indicate keys that you must press, for example when entering data into a spreadsheet, we use a bold coloured font, like this: Enter Eggs Tab 1.25, then press Return Here ‘Tab’ means press the Tab key.■ To show a new term that’s defined in the glossary at the back of the book, we put it in italics.
  6. 6. Getting started STEP with Excel 1 Checklist ■ Introduction to spreadsheets ■ Excel’s basic user controls ■ Creating, opening and saving workbooks ■ Working with worksheets ■ Customising Excel ■ Getting helpT he next program in the Microsoft Office suite you are going to learn about is Excel. This step is aimed at giving you a first taste of what a spreadsheet is and what you can do with it. The steps that follow go into more detail about working withspreadsheet data, charts and graphs, as well as preparing spreadsheets for printing.What is a spreadsheet?Just as a word processor is a tool for working with words, a spreadsheet is a tool for workingwith numbers—although not only numbers.Why would you want to do that? There are few aspects of business that don’t involveworking with numerical data in some way. Although formal accounting is done using special-purpose software, there is still a huge amount of calculation, prediction, costing, estimationand so on in the work of most businesses. This is where spreadsheets excel (no punintended).The term ‘spreadsheet’ comes from traditional accounting practice. It was used to describethe format used in book-keeping ledgers, in which expenditure categories were arranged as
  7. 7. 2 Step 1—Getting started with Excelcolumns, and amounts were added in the relevant columns, with each row representing atransaction. This organisation of rows and columns is carried over into today’s software.But what exactly is a spreadsheet? If you start a program such as Excel, you seesomething like Figure 1.1. Do it now using Start ➪ All Programs ➪ Microsoft Excel . Itlooks a bit like a table, and that’s a useful way of thinking about it. Figure 1.1 A blank Excel documentLook at the blank document on your screen. As you can see, it is divided into cells, each ofwhich corresponds to the intersection of a column (A–K in the picture) and a row (1–22).First of all, we’ll consider what a cell is and what it can do. We’ll do this by analogy:■ Suppose first that you want to add some numbers. You would probably do this by finding a pocket calculator and using it to add the numbers.■ Suppose however that instead of adding a few numbers, you wanted to solve a fairly complicated calculation, such as working out the total cost of a loan with compound interest (or any other complex calculation you like to think of). Clearly now your simple pocket calculator, while it helps you with addition, subtraction, multiplication and division, is not enough by itself. The least you will have to do is use a pencil and paper as well to write down intermediate totals.
  8. 8. What is a spreadsheet? 3■ At this stage you might go off and find a programmable calculator, and write yourself a little program to work out your calculation—although this might take you longer than the method above!■ Now suppose that you want to do this complex calculation many times, using different sets of numbers, perhaps experimenting with different interest rates or repayment periods for a loan?Enter the spreadsheet. Every cell in a spreadsheet is like that programmable calculator!Every cell can contain any formula, of almost any complexity, and reference numbers inother cells. This means that once you have defined your formula, merely changing thenumbers in the other cells allows you to freely experiment with your data, instantly.A cell is not restricted to numbers. In fact, a cell can contain any of:■ Text■ Numbers■ Logical values (true or false)■ Formulae (that is, calculations), which include references to other cells.The best way to see how this works is to try it. You’ve already opened a blank Exceldocument. Now try this:1. You’re going to create a simple shopping list. Click in any cell to start—say B5. That’s the cell where the B column intersects row 5. (All cells are equal, so you can start at A1 if you like—it doesn’t matter.)2. Enter Eggs Tab 1.25, then press Return. Notice that the cell below your starting cell is now highlighted. This is because Excel has decided—because you pressed Return—that you are probably entering a list of items.3. Enter Flour Tab 1.1 Return Potatoes Tab 0.85 Return Meat Tab 2.26. Here’s what things should look like now.4. “So what?”, you may be thinking at this stage. Now click in the cell two below Meat and type Total Tab.5. Now enter the following carefully in the highlighted cell: =SUM(C5:C8) Return, where C5 and C8 are the cells of the first and last numbers in your list. Can you see what’s happened?
  9. 9. 4 Step 1—Getting started with ExcelLet’s explain what’s going on here. Entering ‘=’ as the first item in a cell tells Excel that youwant that cell to contain the results of a calculation. SUM(C5:C8) is an Excel function,which tells Excel to calculate the total of all the numbers in the cells between and includingcells C5 and C8, that is: C5 + C6 + C7 + C8and display the result in the cell that contains the function. We will go into more detailabout functions in Step 3.You may still be wondering what all the fuss is about. But now go back to your shopping listand try entering different values for the costs of individual items. Can you see that the totalupdates itself automatically? Now imagine a large sheet with much more complexcalculations and many more totals—change any input information, and all the calculationsare updated automatically, just as with this simple total. Now imagine the results plotted ona graph within the spreadsheet, and seeing that updated automatically. That is where thepower of a spreadsheet program lies.That, in essence, is what spreadsheets are all about—ensuring that calculations of almost anycomplexity only have to be defined once, but can be repeated endlessly just by entering newnumbers.Keep your shopping list open, as we’ll use it again shortly.Some clarity and some confusionSo far we’ve been referring to Excel as a ‘spreadsheet’, or ‘spreadsheet program’. This isbecause ‘spreadsheet’ is the term in common use. In fact the term Excel itself uses isworksheet, usually shortened to sheet. A new Excel document, by default, contains threeworksheets—for no particular reason other than it’s more than two and less than four—andthe entire document is referred to as a workbook. These are the terms we will use from nowon.You can see this if you look at the open Excel document on your screen—it lists Sheet 1,Sheet 2 and Sheet 3 on the tabs at the lower left. Later we’ll see why having multipleworksheets in a workbook can be useful, but for the moment just note that:■ All the worksheets in a workbook are identical and equivalent■ Any cell in a worksheet can reference any other cell in the worksheet■ Any cell in a worksheet can reference any cell in any other worksheet.In fact, any cell in any workbook can reference any cell in any other workbook too, but that’sfor later.
  10. 10. A trip around the interface 5A trip around the interfaceFigure 1.2 shows a labelled version of Figure 1.1, and below we’ll explain the purpose of themajor controls. This time we’ve re-enabled the task pane using View ➪ Task Pane. Menu bar More tools hiding here… Help …and here The formatting toolbar Formula bar Cell selector The standard toolbar Column titles Task pane Row titles Vertical scroll bar (obscured by task pane) Worksheet selector widgets Worksheet tabs Horizontal scroll bar (obscured by task pane) Figure 1.2 Excel’s user interfaceTravelling around the figure clockwise:■ The cell selector allows you to highlight any cell by name. This is often faster than scrolling around a large worksheet. Try entering a few values now: B5, C7, C10.■ The menu bar houses most of Excel’s commands. Click on each one now to see the commands it contains: File Saving and printing Edit Cutting and pasting, filling and clearing cells, deleting cells, columns and rows, searching View Viewing a document in different ways, enabling and disabling toolbars, headers and footers
  11. 11. 6 Step 1—Getting started with Excel Insert Inserting cells, rows, columns, worksheets, charts, functions, objects, diagrams Format Applying styling and formatting to cell contents, rows and columns, defining styles Tools Checking spelling, mathematical consistency, protecting cell contents and whole sheets, high-level tools, options Data Sorting, filtering, grouping, data tables Window Handling multiple windows plus of course a Help menu. Some of the above will be unfamiliar to you—don’t worry. Excel contains some very high-powered mathematical tools indeed, but you don’t need to know about them at this stage.■ The formula bar provides you with somewhere to edit the data in a cell when the cell is highlighted, a real help when you are working with long formulae.■ Column titles are alphabetic, starting A, B and so on, through AA, AB to IV, 256 in all.■ The toolbars—Figure 1.1 shows two of Excel’s toolbars, the Standard toolbar and the Formatting toolbar, displayed on the same row. We’ve shown it like that because that’s the default, but you can display the toolbars in full on two separate rows if you want. Excel’s toolbars, of which there are many, are designed to give you quick access to often-user commands. You can create your own toolbars, too, just as you can with Word.■ The task pane is displayed here because we’ve just done a File ➪ New command.■ The horizontal scroll bar allows you to move forward and backward through the columns in a worksheet.■ The vertical scroll bar (here obscured by the task pane) allows you to scroll a worksheet vertically through its rows.■ The bottom border of the window contains information about the status of the current cell. It displays Enter if you are typing data into a cell, otherwise it displays Ready. Tips are also displayed here when you are engaged in an editing task such as copying a group of cells.■ The worksheet tabs allow you to switch between the different worksheets in a workbook.■ The worksheet selector widgets allow you to scroll the worksheet tabs if necessary.■ Row titles are numeric, from 1 through to 65,536—that’s 16 million cells to a single worksheet!
  12. 12. A trip around the interface 7As with your work with Word, this may seem a lot to remember. Don’t worry—it willbecome more familiar as you work with the application.Enabling and disabling toolbarsExcel has twenty-nine toolbars, most of which are for special purposes. Those that you willprobably find most useful initially are the Standard, Formatting, Tables and Borders andDrawing toolbars.Here’s how to enable, disable and move them:1. With your shopping list document still open, select View ➪ Toolbars. Here you can selectively enable or disable toolbars as you need to. The Custom… setting is where you can build your own toolbars.2. Release this menu option, then click and hold on the menu bar. The mouse cursor changes to Drag downwards—the menu bar and the other two toolbars change position. Click and drag again to restore them. This is how you rearrange toolbars. (Remember from your work with Word that Office applications treat the menu bar as just another toolbar.)3. Now right-click in the blank area at the right of the menu bar. The toolbars menu is displayed—this is a shortcut that has the same effect as selecting View ➪ Toolbars. Try deselecting the Formatting toolbar. Now you can see all the tools on the Standard toolbar. Repeat the process to redisplay the Formatting toolbar.4. Click on either of the toolbar options widgets to display the tools in the toolbar that are obscured. Try selecting Show buttons on two rows to see the effect.This short exercise should give you an idea of how you can customise the toolbars to suitthe way in which you want to work with Excel. There’s more about toolbars later in thisstep.Using different viewsExcel allows you to use zooming to change the magnification of your worksheet in much thesame way as Word does with documents. The zoom/magnification setting applies to thecurrent worksheet only. Try this:1. Using your shopping list document as an example, right-click to the right of the menu bar and deselect the Formatting toolbar. You can now see all the tools on the Standard toolbar, which includes the zoom field.2. Try selecting different zoom values. The Selection value zooms the view to the size of the currently-selected cells, if any.3. Now select View ➪ Full Screen. Excel zooms the sheet to take over the whole area of your screen. It also displays a small floating toolbar to allow you to close this view mode.
  13. 13. 8 Step 1—Getting started with Excel Full screen viewing is useful when you are Tip working with large worksheets, or if you are working only in Excel. A quick way to scroll around a4. Now select File ➪ New and click on Blank worksheet is to click in a cell near the workbook in the task pane to open a new top, bottom or side of the sheet and blank workbook. drag in the direction you want to scroll. Excel moves the hidden cells5. Select the Window menu. Note that Excel into view as you do so. now has two workbooks open within the same application window. The Window menu allows you to switch between them.6. Close the blank workbook using the close Warning icon in the workbook window—not the entire application’s close icon. Note that Excel has two Close icons, one for the foreground workbook, andLocking rows and columns one for the entire application window. Don’t confuse them.Much of the work you will do in Excel consists ofhandling tables of information. If you use a rowat the top of a worksheet for titles, it’s really useful to be able to keep that on screen whilescrolling the worksheet. Here’s a short exercise that demonstrates how to do it:1. Select File ➪ New and click on Blank workbook in the task pane to open a new blank workbook.2. Click in cell A1 and then enter: Title A Tab Title B Tab Title C Return to simulate the start of a table of data.3. Add some numbers to cells A2 to C8—it doesn’t matter what they are.4. Click on the row title for row 2, then select Window ➪ Freeze Panes. Excel places a line below row 1 to indicate that this row is locked on screen.If you now scroll the worksheet using the vertical scroll bar, you will see that the title rowremains locked on screen. Remember:To lock a row Select the row below the row you want to lock, then select Window ➪ Freeze PanesTo lock a column Select the column to the right of the column you want to lock, then select Window ➪ Freeze PanesTo unfreeze panes, select Window ➪ Unfreeze Panes .
  14. 14. Opening, saving, closing, reopening 9Opening, saving, closing, reopeningIf you worked through the steps on Microsoft Word, you’ll be familiar with the operationsof opening, saving and closing documents. Excel is very similar.Assuming you have your shopping list example worksheet open, try the following:1. Select File ➪ Save. Excel displays its Save As dialog, which is the same as Word’s. It’s shown in Figure 1.3. As with Word, Excel defaults to your folder My Documents, but gives the workbook the default name of ‘Book 1’. Figure 1.3 Excel’s Save As dialog2. Enter ‘Shopping List’ in the File name field. Remember that you can use the Save in field to specify a different location to save the workbook. Notice the widget to the right of the Save as type field. This allows you to select file types other than the default, which is Microsoft Excel Workbook .3. Finally, click on Save, then close Excel by selecting File ➪ Exit or by clicking on the application window’s close icon .4. To re-open your file, select Start ➪ My Documents and double-click on the workbook you just saved, or select Start ➪ My Recent Documents and select the workbook you just saved.After you have named and saved your workbook, selecting File ➪ Save again saves theworkbook without requesting a name (it already has one). If you want to save a copy of theworkbook under another name, select File ➪ Save As… This displays the dialog shown inFigure 1.3 again, allowing you to supply a new name for the copy of the document.
  15. 15. 10 Step 1—Getting started with ExcelExcel’s alternative file typesExcel offers a variety of alternative file types in addition to Workbook. Other file typesinclude Web page format and text. You need to know about several of these. For themoment, be aware of the fact that there is a Save as type field in the Save As dialog—we willreturn to alternative file types in Step 6.The alternative format that is likely to be most Tipuseful to you is Template. Excel templates provide you with an easy way to create new workbooksWorking with worksheets with the same formatting and layoutYou have already seen how a default workbook as an original. If you are likely to wantcontains three worksheets. You might be to create several workbooks with thewondering at this stage why you would want same formulae and layout, it’s worthmore than one worksheet. Here are a few things saving the first one as a can use separate worksheets for:■ Keeping related sets of data together, for example expenditure figures for each month of a financial year, one month per worksheet.■ Storing and accessing ‘look up’ data that you don’t want cluttering up your main worksheet, for example currency conversion rates.■ Using a second worksheet to hold complex calculations, and using the first, or ‘front’, worksheet to present only important data and results.We’ll do a few short exercises to show you how to manipulate whole worksheets. Use yourshopping list example, or a blank worksheet—it’s up to you.Adding a new worksheetTo add a new worksheet, do this:1. Right-click on any of the existing worksheet tabs.2. Select Insert… from the pop-up menu. Excel displays the Insert dialog, as shown in Figure 1.4, which lists all the installed Excel templates.3. Select Worksheet and click on OK.The new worksheet is always inserted before the worksheet whose tab you selected. Tomove the new worksheet, do this:1. Right-click on the worksheet tabs of the worksheet to be moved.2. Select Move or Copy… Excel displays the Move or Copy dialog, as shown in Figure 1.5.
  16. 16. Working with worksheets 11 Figure 1.4 Excel’s Insert dialog Figure 1.5 The Move or Copy dialog3. Select (move to end) and click on OK.Excel moves the selected worksheet to the end of the list of worksheets.Renaming a worksheetWhen you first start Excel, the default worksheets are called Sheet 1, Sheet 2 and Sheet 3.This is not really very descriptive, but fortunately it’s easy to rename them. To do this:1. Double-click on the name in the worksheet tab. Excel highlights the worksheet’s name.2. Enter a new name.3. Click anywhere outside the worksheet tab to deselect it.
  17. 17. 12 Step 1—Getting started with ExcelDeleting a worksheetAs you have probably noticed by now, the worksheet tab pop-up menu has a Delete option.If the worksheet is not empty, Excel displays the following warning dialog when youselect it. Figure 1.6 Deleting a non-empty worksheetClick on Delete to delete the worksheet. WarningCopying a worksheet to another Once you click on Delete, the data thatworkbook the sheet contained is gone for good— there is no Undo operation!To carry out this exercise, you first need tocreate a new workbook. To do this:1. With your shopping list example workbook open, select File ➪ New. Excel displays the New Workbook task pane.2. Click on Blank workbook in the task pane.You now have two workbooks open in Excel. The new one, which Excel has called ‘Book 1’,is probably obscuring your original workbook. To bring the original workbook to theforeground, either click on its title bar or select it using the Windows menu.To copy the first worksheet from the shopping list to the new workbook, do this:1. Right-click on the worksheet tab labelled Sheet 1 in the shopping list workbook.2. Select Move or copy… Excel displays the Move or Copy dialog, as shown in Figure 1.5 on page 11.3. Select Book 1 from the To book pop-up menu.4. Click in Create a copy to enable this option, then click on OK.Excel copies the selected sheet to the new blank workbook. Figure 1.7 shows the result. Touse the same procedure to copy a worksheet within a workbook, don’t make any selectionin the To book pop-up menu.
  18. 18. Bending Excel to your will 13 Figure 1.7 Worksheet after copyingBending Excel to your willAs with Microsoft Word, many features of Excel are customisable. This section lists a fewof the things you might want to change, and also gets you familiar with how to changeExcel’s many options. Many, but not all, of these options lurk behind the Tools ➪ Optionsand Tools ➪ Customize commands. Take a look at what’s there while you follow thefollowing simple exercises.Partial or full menus?By default Excel only displays partial menus, which adapt to list the commands you usemost often. This is to make it easier to use on monitors with small screens (presumably).However, menus tend to be easier to use if commands stay in the same relative position inthe menu.
  19. 19. 14 Step 1—Getting started with ExcelHere’s how you turn this feature off, so that you get whole menus all the time:1. Select Tools ➪ Customize…2. Click on the Options tab.3. Click in Always show full menus to enable the option. Note in passing that there’s an option here to control whether the Standard and Formatting toolbars are shown on one row or two.4. Click on Close.From now on, you’ll always get whole menus unless you disable the option again.Disabling automatic recalculationBy default, Excel recalculates all formulae every time you change any data in a worksheet.For complex calculations or big worksheets, this may slow down your editing.Here’s how to change the automatic recalculation option:1. Select Tools ➪ Options… and select the Calculation tab.2. Click in Manual to enable this option.3. Click on OK.Excel will now only perform a recalculation of the formulae in the current worksheet whenyou press the F9 key, rather than whenever you enter new data.Setting the default location for documentsBy default, Excel will offer you your My Documents folder in open and save dialogs. If thisis ok for you, you don’t need to change anything. If you decide that you want a differentdefault folder, here’s how to change it:1. Select Tools ➪ Options.2. Click on the General tab.3. In the Default file location field, enter the full pathname of the folder you want to use as the default for your Excel document.4. Click on OK to close the Options dialog.Now, whenever you save a new workbook, or use the File ➪ Save As… or File ➪ Open…commands, Excel will offer you the folder you have chosen as the default location.Using and customising Excel’s toolbarsAs with Word, Excel displays the Standard and Formatting toolbars by default. It displaysother toolbars in specific circumstances, such as the Drawing toolbar if you insert a drawinginto a worksheet. In Office XP Excel has twenty-nine toolbars, plus the menu bar, and on
  20. 20. Bending Excel to your will 15top of that, you can create your own. Many of Excel’s toolbars are for special purposes, andyou are only likely to come across them if you start using Excel for complex mathematicalor financial work.If you are a ‘visual’ person, someone who works easily with icons, toolbars will be useful toyou. Not everyone is, so you need to know how to control Excel’s toolbars so that you canadapt it to match the way you want to work. The following sections are very similar to thoserelating to Word’s toolbars, but we repeat them here so that you can refresh yourknowledge.Displaying a toolbarTo display a concealed toolbar, select View ➪ Toolbars… and then select the toolbar youwant to display. The usefulness or otherwise of the various toolbars will become clearer asyou work with Excel.Notice that toolbars can be fixed or floating:■ To ‘park’ a floating toolbar at the top or bottom of the screen, click on its title bar and drag it to the position in which you want it.■ To float a ‘parked’ toolbar, hold down the Ctrl key, click in the toolbar and drag it free.Setting toolbar defaultsIf you find yourself working with the same toolbars all the time, you can tell Excel to displaythem by default when you start it. To do this:1. Select Tools ➪ Customize…2. Click on the Toolbars tab if it’s not already displayed.3. Click to select the toolbars you want. Notice that there are toolbars here that aren’t even displayed in the View menu!4. Click on Close.Excel displays the toolbar(s) you have chosen, and will also redisplay them the next timeyou start up the application.Customising a toolbarTo complete our discussion of toolbars, we’ll see how easy it is to add or remove commandsfrom them:■ To remove a button from a toolbar, hold down the Alt key, click on the button you want to remove, and drag it off the toolbar.
  21. 21. 16 Step 1—Getting started with Excel■ To add back the default buttons, click on Note the toolbar options widget and select Add or Remove Buttons ➪ Standard, then reselect As Excel treats the menu bar as just the button you want to replace. (This another toolbar, it’s possible to Alt- requires a bit of menu gymnastics!) drag an entire menu off the menu bar! If you do this, you will need to use aIf you accidentally remove an entire menu, use different method to replace the menu.this method to replace it:1. Select Tools ➪ Customize…2. Click on the Commands tab.3. Select Built-in Menus from the Categories list.4. Click on the missing menu in the Commands list, then drag it back into position in the menu bar.Note that you can use this method to add new commands to the menu bar if you wish.When you select Built-in Menus in the Categories list, all of Excel’s commands are organisedinto menus for you in the Commands list. Figure 1.8 shows a handy Clear menu added in thisway. Figure 1.8 A new Excel menuThis method can be used with Word too, of course, as the handling of toolbars is identicalto Excel’s.Adding document detailsExcel saves extra information with worksheets in the same way that Word does withdocuments—a worksheet’s title (not the same as its file name), subject, author, categoryand so on. This can be useful for several reasons:■ Microsoft Office applications have their own search tool that allows you to search for this information. This might allow you, for example, to find all workbooks by the same author quickly.■ You can define your own workbook properties. You might use this, for example, to track the progress of something like a financial report, using sequential version numbers.
  22. 22. Shortcut keys 17Try this now with your shopping list workbook:1. Select File ➪ Properties. It’s quite likely that you’ll see something like Figure 1.9. Figure 1.9 Document properties2. Enter something like ‘Trial Excel shopping list’ in the Title field and click on OK.3. Re-save the document by selecting File ➪ Save.Shortcut keysAs an alternative to using the menu commands, Excel offers you shortcut keys. These arekey combinations, typically including a modifier key, that perform a specific function suchas selecting a menu command. See the table on the next page for the essential shortcut keysyou need to know in Excel.Getting help on ExcelIf you did not disable the Office Assistant when you worked throughthe steps on Word, all you have to do to get help in Excel is to clickon it, popping up a dialog into which you can type your question.If you disabled the Office Assistant, you can get the same results bytyping a question into the help field in the menu bar.
  23. 23. 18 Step 1—Getting started with Excel Excel’s essential shortcut keys As you work with programs like Microsoft Excel, it’s a really good idea to try to become familiar with the shortcut keys, at least for commonly used commands. This is because it takes far less time and effort to type, say, Ctrl + V than to take your hands off the keyboard, reach for the mouse, go to the Edit menu, click and select Paste. We won’t slavishly give all the shortcut keys when we introduce a menu command, as this would clutter up the book, but as you work with Excel, try to become familiar with the shortcuts you find useful. Here are the absolute minimum that you need to know— and they work in all Office programs: ■ Ctrl + X Cut selection ■ Ctrl + C Copy selection ■ Ctrl + V Paste ■ Ctrl + Z Undo last command ■ Ctrl + Y Redo last command ■ Ctrl + S Save workbook (do this frequently!) ■ Ctrl + P Print worksheet ■ Ctrl + O Open a workbook ■ Ctrl + W Close current workbook Shortcut keys are displayed next to each menu command when the menu is displayed. You can also select Help ➪ Microsoft Excel Help to display a help window with more help options, including a table of contents and index for Excel’s help. Finally, most of Excel’sDone! dialogs also have contextual help, which you can access by clicking on the icon.
  24. 24. Getting help on Excel 19ReviewIn this step, you learned:■ What spreadsheets are and what they are for.■ Excel refers to spreadsheets as worksheets, which are bound into workbooks.■ Excel has controls a little like those of Word.■ Excel has many toolbars, which are customisable in the same way as Word’s.■ You can zoom to enlarge any part of a worksheet.■ You can lock a row or column on screen so that it stays in view as the worksheet is scrolled.■ Worksheets are made up of cells.■ A cell can contain text, a numerical value or a formula (a calculation).■ Formulae can reference the contents of other cells.■ Worksheets can reference data in other worksheets.■ A cell containing a formula displays the formula’s total.■ Excel lets you add, delete, or copy worksheets, either within a workbook or between workbooks.■ Excel has comprehensive built-in help.■ Almost everything about Excel’s user interface can be changed.Quiz1. How is a cell defined in Excel?2. How do you tell Excel that the contents of a cell is a formula?3. Can a formula in a worksheet make use of data stored in another worksheet?4. What is the editing field used for in Excel?5. How many rows does an Excel worksheet have?6. How do Excel templates differ from workbooks?7. Suggest two uses for multiple worksheets within a workbook, and try and think up one of your own.8. How do you move a worksheet within a workbook? Try to do so.9. It’s possible to turn off Excel’s automatic recalculation. Why might you want to do this?10. Suggest a use for Excel’s document properties.
  25. 25. Working with STEP spreadsheet data 2 Checklist ■ Entering data into Excel ■ Editing data in cells ■ Searching for and replacing data ■ Moving and copying data between cells and worksheets ■ Sorting dataT he last step introduced you to Excel’s basic user controls. Now it’s time to look in more detail at how Excel handles numerical and text data, and the features it offers you for working with data.How Excel interprets data entriesMany computer applications have been described as ‘intelligent’, but Excel is one that hassome claim to this title. It adopts the approach that a tool designed to work with numbersshould be good at understanding numbers. For example, Excel applies a formatautomatically to every number you enter, based on its best guess of what the number is.To see how this works, try the following short exercise:1. Open a blank workbook in Excel.2. Click in cell A1 to highlight it.3. Enter the following: 12 Return 12.25 Return
  26. 26. 22 Step 2—Working with spreadsheet data 12e2 Return 12/12/04 ReturnYou should now see something like this:Can you see what Excel has done? Here’s a step-by-step description:1You entered What Excel did12 Excel interprets this as a number and determines that it does not require any special formatting. It applies its default format to the number, which is called ‘General’.12.25 Excel interprets this as a number, and applies its General format to display only as many decimal points as are required.12e2 Excel interprets this as a number in scientific notation1, and applies its ‘Scientific’ format automatically to display it as 1.20E3.12/12/04 Excel interprets this as a date, and formats it accordingly as 12/12/2004. It has also made the column a little wider to accommodate this format.Now do another short exercise:1. Click again in A1 to select it.2. Enter the following: 14 Return 14 Return 14 Return 14 Return 1. In scientific notation, numbers are expressed as a mantissa and an exponent. The mantissa con- tains the significant digits of the number in the range 0–9, and the exponent contains the power of ten to be applied to the mantissa. For example, 12.25 is ‘1.225E1’ in scientific notation, while 1001 is ‘1.001E3’. For numbers less than 1 a negative exponent is used, for example 0.0033 is written as ‘3.3E-3’. If this seems hard to understand, try mentally moving the decimal point in the mantissa by the number of places after the ‘E’ in the exponent, to the left if negative, and to the right if positive. Scientific notation provides a convenient way to handle very large or very small numbers.
  27. 27. Editing cell data 23You should now see something like this:Here’s what’s happened:Cell contains Why?14 When you originally entered 12 in this cell, Excel interpreted it as a number and determined that it did not require any special formatting. The default format is General. This cell therefore still has the format General, so the data is displayed as ‘14’.14 As above, Excel interpreted your original entry, 12.25, as a number, and applied the General format. This cell therefore still has the format General, so the data is displayed as ‘14’.1.40E1 Excel interpreted your original entry, 12e2, as a number in scientific notation, and applied its Scientific format automatically. This cell there- fore still has Scientific format applied to it, so your entry of 14 is displayed as ‘1.40E1’.14/01/1900 Excel interpreted your original entry, 12/12/04, as a date, and so applied a date format to the cell. This format is still applied, so Excel interprets an entry of 14 as ‘the 14th day of the date format’. Excel’s dates start from 1st January 1900, so the cell displays ‘14th January 1900’.Excel has retained the formatting it applied automatically to these four cells. This may seemconfusing at first, but it allows Excel to process all numerical data internally in the mostefficient way, and display it in ways that make sense to us humans. We’ll return toformatting in more detail in Step 4.Editing cell dataJust as Excel tries to make it easy for you to insert data, it also tries to help with editingdata. In this section we’ll look at the ways you can move and copy data within and betweenworksheets, and at how you can create an automatic data series.
  28. 28. 24 Step 2—Working with spreadsheet dataSelecting cells, columns and rowsBefore we look at how to edit, move and copy the data in cells, you need to know how toselect parts of a worksheet. Try these now on a blank worksheet:1. To select a single cell, either click in the cell or enter its reference in the cell selector (see Figure 1.2 on page 5).2. To select a range of cells, click in the first cell and drag to select all the required cells.3. To select a large range of cells, click in the first cell, hold down Shift and click in the last of the range of cells to be selected.4. To select a range of cells larger than that displayed in the worksheet’s window, click in the first cell, enter the cell reference of the last cell to be selected, then press Shift Return.5. To select an entire column, click on the column title.6. To select an entire row, click on the row number.7. To select non-adjacent cells, rows or columns, click on the first cell, row number or column title, then hold down Ctrl (Control) and click on the second cell, row number or column title.8. To select all cells in a worksheet, click on the Select All button at the top-left of the worksheet:Moving and copying data using draggingOnce you have selected a cell or group of cells in a worksheet, you can drag them whereveryou want in the worksheet. Try this:1. Open a new blank workbook in Excel if you need to.2. Enter three numbers in three cells of the same column, using Return to move between cells.3. Click in the first cell again and drag downwards to select all three cells. You should see something like this:
  29. 29. Editing cell data 254. Release the mouse and move it over the boundary of the highlighted cells. The mouse cursor changes to a four-pointed arrow, like this: This is Excel telling you that you can click and drag the selected region anywhere on the worksheet. Try it.5. Now try the same thing with the Ctrl key held down. Now the cursor changes to a plus sign: This is Excel telling you that dragging now will create a copy of the selected cells. Try it.Moving and copying data using menu commandsExcel also has a pop-up menu that is displayedwhenever you right-click in a worksheet. Try this shortexercise to move or copy data:1. Using the same workbook you used in the previous exercise, select the three cells that contain numbers again.2. With the mouse cursor within the selected cells but not over their boundary, right-click to display the pop-up menu.3. Select Copy. Excel displays a flashing boundary on the selected cells to show that they have been copied to the clipboard. (To move the data instead, select Cut.)4. Position the mouse over a target cell, right-click again, and select Paste. Excel copies the selected cells to the new location. Note that the selected target cell is always used for the top-left cell of the copied group.
  30. 30. 26 Step 2—Working with spreadsheet data After you have pasted the data, Excel displays a small clipboard icon, as shown: This allows you to select paste options—try clicking on it to see what’s offered. The Link Cells option places references to the copied cells into the destination cells, instead of the copied values. We’ll have a lot more to say about cell references later.Moving and copying non-adjacent dataTo carry out this exercise, you will need data in more than one column. Do this:1. Close your currently open workbook, if you have one open, discarding the data.2. Open a new blank workbook.3. Enter numbers in non-adjacent columns, as shown:4. Drag to select the first group of cells, then hold down Ctrl and drag to select the second group of cells:5. Right-click and select Copy (or Cut) from the pop-up menu.
  31. 31. Editing cell data 276. Move the mouse cursor to your chosen destination for the copied cells, right-click and select Paste.Note that Excel pastes the contents of the copied cells in two adjacent columns, eventhough the original data was not in adjacent columns.Moving and copying data between worksheets and workbooksExcel does not restrict you to working on one worksheet or workbook—you can work withmultiple worksheets at a time, and can open as many workbooks as you wish. You can dothis in several ways:■ To work with more than one worksheet, click on the sheet selector widgets to toggle between worksheets.■ To open more than one workbook, do one of the following: – Click to select the first workbook you want to open, hold down the Ctrl key, click the second workbook, then right-click and select Open from the pop-up menu. – Click and drag to select more than one workbook, then right-click and select Open from the pop-up menu. – Double-click the first workbook to open it, display the folder window again by click- ing on its icon in the Windows taskbar, then double-click on the second document to open it.■ To work with more than one workbook, do any of the following: – Switch between workbooks by clicking on their icons in the taskbar. – Use the icon to minimise workbooks into the taskbar, then just click their icons in the taskbar as required. – Switch between workbooks using the Window menu.You can copy and paste or move data between worksheets and between open workbooks.Here’s how to copy or move data between worksheets.
  32. 32. 28 Step 2—Working with spreadsheet data1. In the worksheet you already have open, click and drag to select some data.2. Right-click to display the pop-up menu, then select Copy if you want to copy data, or Cut if you want to move data.3. Click on the sheet selector for Sheet 2.4. Position the mouse where you want to paste the data, right-click and select Paste from the pop-up menu.Copying or moving data between two workbooks is just as easy. To do this, we’ll first haveto create a new workbook:1. Select File ➪ New and click on the Blank Workbook link in the task pane. Excel opens a new blank workbook in the same window.2. Select Window ➪ Book1 to return to the original workbook.3. Click and drag to select some data.4. Right-click to display the pop-up menu, then select Copy if you want to copy data, or Cut if you want to move data.5. Select Window ➪ Book2 to display the second workbook.6. Position the mouse where you want to paste the data, right-click and select Paste from the pop-up menu.Try the two exercises above a few times on your own, perhaps this time using the menucommands instead. When you have finished practising moving and copying data, close bothworkbooks and discard the changes.How Excel handles cell references when cells are copied or movedThe exercises above are all very well, but all we are moving is numbers. The power of Excelcomes from the fact that cells can contain formulae that reference the contents of othercells.You may be wondering what happens to such cell references when the cell containing aformula is moved or copied. The answer is that Excel does what you normally want it to—
  33. 33. Editing cell data 29it adjusts the cell references relative to the move or copy. If this doesn’t make much sense,try the following simple exercise:1. Open a new blank workbook. Note2. Click in cell A1 to select it.3. Enter 12 Tab =A1. In step 3, note that the contents of B1 is the expression =A1, not 12. Cell B1 This places the numerical value 12 in A1, displays the value 12 because this is and the expression =A1 in B1. This just tells the result of the expression =A1. This Excel always to make the value displayed in may seem confusing until you become B1 equal to the value contained in A1. Cell more familiar with Excel. B1 is now said to be dependent on A1. At this stage the worksheet should look like this: —which is not very exciting.4. Now drag to select the first two rows and use the pop-up menu to copy them somewhere else in the worksheet, as you learned how to do in Moving and copying data using menu commands on page 25.5. Your worksheet should now look something like this: Now click in the right-hand cell of the pair you have copied, C5 in this picture. What does it contain? Can you see what Excel’s done?When you move or copy dependent cells, any references to other cells in formulae arechanged automatically by Excel to reference the same relative cells after the move or copyoperation. This is normally what you want to happen. If it’s not, you can prevent it—we’llgo into more detail about this in Step 3.
  34. 34. 30 Step 2—Working with spreadsheet dataEditing data in cellsAs you have seen, you insert data in cells by clicking in the cell and typing the data. To editdata already in a cell, click to select the cell and then edit the cell’s contents in the formulabar.When you click in the formula bar, Excel highlights any cells that are referenced by aformula in the cell being edited, using colour to distinguish them, as the illustration aboveshows (or would, if it were in colour). When you have made any changes you wish, thebutton allows you to accept your changes, and the button to reject them.However, Excel is cleverer than this. While you are editing the cell contents, you can clickon and drag any of the highlighted referenced cells. You do this by moving the mouse cursorover the edge of the highlighted cell you want to move, then click and drag it to the newlocation. Excel then adjusts the formula accordinglyPractise this now, using some simple formula such as the one shown in the illustration above.Adding comments to cellsYou can add comments to individual cells. Comments are useful, for example to explain aformula, either for a colleague, or to remind yourself at a later date.
  35. 35. Editing cell data 31To enter a comment in a cell, select the cell, then select Insert ➪ Comment. Excel opens awindow for your comment, titled with your name:To close the comment window, just click outside it. After you have done so, Excel shows asmall red tag at the top-right corner of the commented cell. Moving the mouse pointer overthe cell causes the comment to be displayed:To change or delete the comment, select the commented cell, right-click and select EditComment or Delete Comment . The Show Comment option causes the comment to bepermanently displayed until the corresponding Hide Comment command is selected for thecell.Clearing or deleting cellsTo clear the contents of one or a group of cells quickly, drag to select them, right-click andselect Clear Contents from the pop-up menu. This clears everything from the cell or cells:contents, formats and comments. You have more control if you select Edit ➪ Clear, as thereare options for clearing the contents and the formatting of the cell separately.To delete a single cell, right click with the cell selected and chooseDelete… from the pop-up menu. Excel prompts you with the dialogshown. Here’s a short exercise to demonstrate how the options work:1. Close your current workbook, if you have one open, discarding the changes.2. Open a new blank workbook.3. Enter numbers in the first few rows, as shown below:
  36. 36. 32 Step 2—Working with spreadsheet data4. Click to select cell B4.5. Right-click and select Delete… from the pop-up menu. In the dialog, select Shift cells up. Click on OK.6. Now select Edit ➪ Undo and repeat step 5, this time selecting Shift cells left.7. Finally, select Edit ➪ Undo and repeat step 5, this time selecting Entire row.This exercise should give you an idea of what you can do. In your own time, try thecorresponding commands from the Insert… option on the pop-up menu. When you’vefinished, keep the workbook open, as we’ll use it in the next exercise.Inserting and deleting cells, rows and columnsUsing the workbook you were using in the previous exercise, try this:1. Click on the title of column C to select the entire column.2. Select Insert ➪ Columns. This command inserts as many columns as are currently selected to the left of the current selection, moving the remaining columns to the right.3. Now select Edit ➪ Undo and click on the titles of columns C, D and E to select them.4. Select Insert ➪ Columns. This time, because you had three columns selected, Excel has inserted three new blank columns.5. Now select Edit ➪ Undo and click on the title of row 4 to select it.6. Select Insert ➪ Rows.As you can see, Excel works the same way when inserting rows as when inserting columns.Undoing changesJust as with Word, Excel has two matching commands, Undo and Redo. You can find themin three different ways:■ From the Edit menu.■ Using the and icons on the Standard Toolbar. These have pop-up menus that allow you to undo or redo more than one command at a time. (If you have the Standard and Formatting toolbars displayed on the same row, the button is obscured.)■ Using the shortcut keys Ctrl + Z (Undo) and Ctrl + Y (Redo).Excel saves all the changes you make in an editing session, and you can undo all of them atany time.
  37. 37. Editing cell data 33Creating automatic seriesThe final editing technique you need to know about in Excel is referred to as auto-fill. Exceloffers this for use with adjacent cells to provide you with a very simple way of constructingseries of numerical values—whether they are numbers or dates. Try the following shortexercise:1. Close your current workbook, if you have one open, discarding the changes.2. Open a new blank workbook.3. Click in cell A1 to select it.4. Enter 1 Return 2.5. Now drag to select the first two rows.6. Move the mouse cursor over the auto-fill handle—this is the dark square at the lower- right of the highlighted cells. The mouse cursor changes to a + sign:7. Click and drag downwards for ten or so cells. You should now see something like this: Excel has looked at the two cells you copied, and found that they consisted of a numer- ical series with an increment of 1. It has therefore continued the series in the destina- tion cells. The icon to the lower-right of the destination cells contains a set of auto-fill options. Click in it to see what’s there. The option Fill Series is the one that Excel has just performed for you.As a further exercise, repeat step 7 with the Tipvalues:■ 0 and 10 Auto-fill works in the same way if you drag to fill rows rather than columns.■ ‘Mon’ and ‘Tue’■ 12/12/06 and 13/12/06
  38. 38. 34 Step 2—Working with spreadsheet dataLook at the auto-fill options after you have created the series of days and dates. Are theydifferent?Searching for data, replacing dataExcel has a powerful Find command, just as Microsoft Word does. Excel’s Find commandallows you to search for numerical values, text, formula results or text in comments.Searching for dataTo demonstrate Excel’s Find command, you need to create a simple worksheet with someuseful contents:1. Close your current workbook, if you have one open, discarding the changes.2. Open a new blank workbook.3. Click on cell B3 to select it, then enter the following data exactly as shown: 12 Tab =12 Tab This cell contains 12 Return =12+14 Tab 12 Return Don’t miss the apostrophe from the last number.4. Click in cell D4 and select Insert ➪ Comment. Enter 12 in the comment window, then click outside the window to close it. This populates the worksheet as follows: Cell Contents B3 The numerical value 12 C3 A formula containing only the number 12 D3 A text string containing ‘12’ as characters B4 A formula containing the value 12 C4 ‘12’ as characters (the leading apostrophe tells Excel to treat the entry as characters rather than as a number) D4 A comment containing ‘12’ as characters5. Click in cell A1 to select it, then select Edit ➪ Find… Excel displays the Find and Replace dialog, as shown in Figure 2.1.
  39. 39. Searching for data, replacing data 35 Figure 2.1 Excel’s Find and Replace dialog6. Enter 12 in the Find what field, then click on Find Next. Excel advances the cursor to cell B3, and the formula bar displays its contents.7. Click again on Find next. Excel finds the formula result of 12 in cell C3.8. Repeat step 7 to find the characters ‘12’ in the text contained in cell D3.9. Repeat step 7 to find the numerical value 12 in the formula in cell B4.10. Repeat step 7 to find the character ‘12’ in cell C4.11. Click on Find next again. Note that the ‘12’ in the comment in cell D4 is not found. This is because by default Excel does not search in comments.12. In the Find and Replace dialog, click on Options>>. Excel expands the dialog, as in Figure 2.2. Note the options for controlling the search order by columns or by rows, and for widening a search to the whole workbook. Figure 2.2 Excel’s expanded Find and Replace dialog13. Use the widget next to the Look in field to select Comments, then click on Find next. Excel now finds the characters ‘12’ in the comment in cell D4—even though the comment is not displayed.14. Use the widget next to the Look in field to select Formulas, then click on Options <<. This sets the find command back to its default.15. Finally, click on Find All. The Find and Replace dialog expands to show a list of all the cells that contain ‘12’, as Figure 2.3 shows.
  40. 40. 36 Step 2—Working with spreadsheet data Figure 2.3 Excel’s Find All feature in actionIf you click in the list of found items, Excel selected the relevant cell.Keep this workbook open, as we will use it in the next section.Using the replace commandAs you might imagine, replacing using the Find and Replace dialog is hardly more difficultthan using it to find data.1. Close the Find and Replace dialog, if you left it open at the end of the last exercise.2. Click in cell A1 to selected it, then select Edit ➪ Replace… Excel displays the Find and Replace dialog with the Replace pane selected.3. Enter 12 in the Find what field, and 14 in the Replace with field.4. Click on Find next. Excel advances to cell B3, the first occurrence of 12.5. Click on Replace.6. Continue to do this, watching the formula bar, as you click on Replace four more times.Do you notice anything interesting? Although each of the five occurrences of the number12 has a different context, as the table on page 34 shows, Excel is clever enough to replaceit with 14 in the correct context for each occurrence.You can discard this workbook now, as we have finished with it.Sorting dataSorting numerical values is often useful, mainly because it makes lists of items easier forhumans to understand. For example, if you are using Excel to display tables of values, youcan use it to sort the tables into ascending or descending order.
  41. 41. Sorting data 37Excel offers you two ways to sort data:■ A quick method using the sort buttons. This works for single columns of data only.■ Using the Sort dialog. This gives you complete control over simple and complex sorts.First we’ll try a simple sort:1. Close your current workbook, if you have one open, discarding the changes.2. Open a new blank workbook.3. Click to select cell B3. (Why not A1? Just because it’s a bit easier to see what’s going on if you’re not working against the row and column headers all the time.)4. Enter the following data: 12 Return 1 Return 24 Return 23 Return 15 Return5. Click to select any of the cells that have numerical contents.6. Click on the sort button in the Standard toolbar. Excel sorts the column of numbers in ascending value.7. The button produces a sort in descending order. Try it now.Note that Excel is clever enough to work out Notewhich set of numerical values you want to sort—you don’t usually have to select all the cells to be You can only sort data by one or moresorted explicitly. columns—you cannot sort data by rows.Now for more complex sorts, using two columnsof data:1. Close your current workbook, if you have one open, discarding the changes.2. Open a new blank workbook.3. Click to select cell B3.4. Enter the following data: Peter Tab 2500 Return Mary Tab 1233 Return Joe Tab 4500 Return Mike Tab 3422 Return Al Tab 5600 You can think of this as maybe monthly revenue per salesperson, or something relevant like that.5. Click in cell B5 (or any cell containing data in column B).6. Click on the sort button in the Standard toolbar. Excel sorts the two columns of data, using the first column to determine the sort order (alphabetical).7. Select Edit ➪ Undo to remove the sort, then click in cell C5 (or any cell in column C that contains data).
  42. 42. 38 Step 2—Working with spreadsheet data8. Click on the sort button in the Standard toolbar. Excel sorts the two columns of data, using the second column to determine the sort order (numerical).9. Select Edit ➪ Undo to remove the sort again, then click and drag to select cells B3 to B7.10. Click on the sort button in the Standard toolbar. Excel displays a warning dialog, as shown in Figure 2.4. This is because it senses that you are trying to sort only part of a data set, which would produce invalid results. Figure 2.4 Excel’s Sort Warning dialog11. Click on Cancel, but keep the worksheet open for the next exercise.Finally, we’ll show you how to set up a sort of multiple columns:1. Drag to select the range of cells B3 to C7.2. Select Data ➪ Sort… Excel displays the Sort dialog, as shown in Figure 2.5. Figure 2.5 Excel’s Sort dialog3. Click on the widget next to the Sort by field. Note that Excel is offering to sort by the first column or the second column. If there were more columns of data in your selection, you would have an option for each column. This dialog allows you to select a secondary sort by using the Then by field. This will only have an effect if you have more than one item in the first sort column that has the same sort order (in our case, for example, two rows for Mike).
  43. 43. Sorting data 39 4. Click on OK to perform the sort. You’ve now used both types of sort that Excel offers. Finally, as exercises: ■ Insert some extra rows to extend your data set with several entries for each person, then use the Sort dialog to perform a sort using the Then by field to establish the secondary sort order. ■ Use cells B2 and C2 to add the headings ‘Salesperson’ and ‘Order Value’. Use the Sort dialog again, selecting these headings also, but clicking in Header row to tell Excel thatDone! it must exclude the header rows from the sort.
  44. 44. 40 Step 2—Working with spreadsheet dataReviewIn this step, you learned that:■ You can select ranges of cells, whole rows and columns, and non-adjacent selections.■ You can move data between cells using dragging.■ You can copy and paste data between cells.■ You can use several methods to edit data in cells, including the formula bar.■ You can easily delete data from a group of cells.■ Excel edits relative cell references when cell contents are copied or moved.■ Excel has a multi-level undo command.■ You can insert or delete whole rows and columns.■ Excel can create a series of consecutive data items automatically.■ You can add comments to a cell.■ Excel has tools that allow you to search for data and replace it.■ Excel allows you to do simple and complex sorts.Quiz1. What is the purpose of a cell format in Excel?2. How could you copy the contents of column B and column D at the same time?3. How would you copy a block of cells from one worksheet to another within the same workbook?4. What happens to cell references when you move or copy a formula?5. How does Excel use colour to make editing formulae easier? Try it to remind yourself.6. If you entered 1/3/05 in a cell, selected the cell and duplicated it by dragging, what would the new cell contain? Why?7. By default, a search in Excel finds all the different kinds of data you can put in a cell with one exception. What is the exception?8. We sometimes refer to complex sorts using the terms major and minor sort, or primary and secondary sort. What feature in Excel’s Sort dialog allows you to set up a minor sort?
  45. 45. Using spreadsheet STEP formulae 3 Checklist ■ Using functions in Excel ■ Creating formulae ■ How Excel processes formulae ■ Relative and absolute cell references ■ Mixed cell references ■ Excel error messages ■ Conditional functions—making decisionsY ou have now covered the basics of Excel: the user controls, creating and saving workbooks, and entering and editing data. The power of Excel, however, comes from its ability to calculate the results of formulae, display them in cells, and usethose results in other formulae. This is what we will concentrate on in this step.Using Excel formulaeYou have already learned that a cell whose contents start with ‘=’ is interpreted by Excel asa formula. Excel will try to calculate the results of any formula it finds and displays theresults in the cell. But how can you create formulae? Excel offers you four ways:■ Entering a formulae directly into a cell.■ Entering a formula using the formula bar.■ Building up formula by clicking on the cells you wish to include.■ Pasting Excel functions into a formula.We will describe these in the sections that follow.
  46. 46. 42 Step 3—Using spreadsheet formulaeExcel functionsExcel functions provide the real mathematical power of Excel. A function in Excel is anexpression that calls a piece of code dedicated to a specific purpose. For example, theformula: =SUM(A1:A4)calls the function SUM() to return the total of the cells A1, A2, A3 and A4, that is: A1+A2+A3+A4Excel contains over two hundred functions, which allow you to calculate results that wouldbe far too complex and tedious to program into a worksheet by hand. You can see this if youselect Insert ➪ Function… in a blank worksheet, then set Or select a category in the InsertFunction dialog to All. Many of them you will never use, as they are dedicated to complexmathematical calculations that you are unlikely to encounter—at least, not yet. Some, suchas the SUM() function described above, are essential.Excel’s functions are grouped by purpose, as the pop-up menu adjacent to the Or select acategory field in the Insert Function dialog shows. Most of the categories are self-explanatory:Category IncludesDatabase A set of functions for calculating data from an embedded database, or ‘look up’ list. Excel allows tables of data to be embedded in a worksheet, as we mentioned in Working with worksheets on page 10.Date and Time Functions to convert or display anything to do with dates, hours, minutes and seconds, for example NOW(), which returns the current data and time.Financial A set of functions to calculate common financial values, such as the total cost of a loan, the future value of an investment, or the required interest rate for a loan.Information A set of functions that are mainly concerned with returning infor- mation about the state of other cells. For example ISBLANK(), which returns FALSE if a cell or range of cells has contents, else TRUE.
  47. 47. Using Excel formulae 43Category IncludesLogical A set of functions for combining logical expressions, such as AND(), OR(), IF(), and which return the values TRUE or FALSE.Lookup and A set of functions for extracting data from look-up tables withinReference a worksheet, or information about the current cell. Examples of the latter are ROW() and COLUMN(), which return the row and column numbers of the cell containing the current formula (i.e. “What row or column am I in?”).Maths and Trig A set of functions to calculate common mathematical and trigo- nometrical values, such as sine, tangent, cosine, square root, sum of squares.Statistical A comprehensive set of functions to calculate values used in statistical analysis, such as average, maximum, minimum or n-th largest of a set of numbers, as well as more complex functions such as the χ -squared, Poisson distribution and Student’s t-distri- bution tests.Text A set of functions to process text, for example to make one length of text from text in multiple cells, to convert numbers to text, or to convert text to upper or lower case.We will demonstrate some of the more common functions in the examples in the sectionsthat follow.Creating formulaeFirst we’ll repeat the simple exercise we first did on page 3, but with some changes toillustrate the different ways to enter formulae in Excel:1. Open a new blank workbook.2. Click in cell B3 to select it.3. Enter Eggs Tab 1.25, then press Return. Notice that the cell below your starting cell is now highlighted. This is because Excel has decided—because you pressed Return—that you are probably entering a list of items.4. Enter: Flour Tab 1.1 Return Potatoes Tab 0.85 Return Meat Tab 2.26.
  48. 48. 44 Step 3—Using spreadsheet formulae Here’s what things should look like now.5. Click in the cell two below Meat and type Total Tab.6. Click in the formula bar and type ‘=’7. Now click in cell C3. Note that Excel has entered ‘C3’ in the formula bar.8. Enter ‘+’ and then click in cell C4.9. Repeat this to build up the following formula: =C3+C4+C5+C6 Here we are, of course, adding the contents of the cells. We could just as easily use any of Excel’s other mathematical operators: + Add - Subtract * Multiply / Divide10. Press Return. Excel closes your editing session in the formula bar, calculates the total of the formula and displays it in cell C8.Now we’ll edit the total to use the SUM() function. We can still select cells by clicking,though:1. Click in cell C8 to select it.2. In the formula bar, drag to select C3+C4+C5+C6.3. Select Insert ➪ Function…4. In the Insert Function dialog, enter sum in the Search for a function field, then press Return. Excel will select the SUM() function.5. Click on OK. Excel displays the Function Arguments dialog. If all is well, it will select the range of cells C3:C7 for you, as Figure 3.1 shows. Note that Excel has already calculated the result of the SUM() function and displayed it in the dialog. The button adjacent to the Number fields allows you to select a range of cells by click-
  49. 49. Using Excel formulae 45 Figure 3.1 Function Arguments dialog for SUM() ing and dragging. Try it now to see how it works.6. When you have finished experimenting, click on OK to close the Function Arguments dialog.Entering a function like this might seem a bit long-winded for something as simple asSUM(), but it’s really useful for functions with more, or more complex, arguments, or forfunctions with which you’re not familiar.Keep this workbook open for the moment, as we’ll add to it in the next step.Some more functionsNext we’ll add a few more useful functions to our shopping list to show the cheapest andmost expensive items, and the number of items in the list:1. In the worksheet you used in the previous section, select cell B10 and enter: Costliest Tab =MAX(C3:C6) Return Note that as soon as you enter the ‘(’ for the function MAX(), Excel prompts you with the correct syntax for the function.2. As you can see, the MAX() function displays the highest value from a range of cells. Now enter: Cheapest Tab =MIN(C3:C6) Return3. You can see from this what the MIN() function does. Now enter: No. of items Tab =COUNT(C3:C6) Return The COUNT() function returns the number of cells from the specified range that contain numbers. It ignores cells that contain text or logical values.4. In row 13, enter: Average cost Tab =AVERAGE(C3:C6) Return The AVERAGE() function returns the number that is the average of the contents of
  50. 50. 46 Step 3—Using spreadsheet formulae the cells in the specified range. As these cells contain the values 1.25, 1.1, 0.85 and 2.26 in our example, the average returned will be: (1.25 + 1.1 + 0.85 + 2.26)/4 which is 1.365.5. Save and close the workbook, as we’ll use it again later.The order of processing of formulaeWhen you write formulae in Excel, you need to remember that it has a predefined order ofpriority for processing mathematical expressions. What we mean is that: =3+4*12in Excel give the answer 51—that is, Excel gives the multiplication a higher priority than theaddition, so does it first. So this expression is equivalent to: =3+(4*12)and not: =(3+4)*12which would give the answer 84. Excel uses the following order of priority when executingformulae:Priority Operator DescriptionHighest Colon, comma Cell references, for example ‘C3:C6’ - Negation, for example ‘-1’ % Percentage, for example ‘20%’ ^ Exponentiation, for example ‘2^3’ (this means ‘2 cubed’, i.e. 2*2*2) * and / Multiplication and division + and - Addition and subtraction & Join text strings (‘concatenation’)Lowest = < > <= >= <> Comparison: equal, less than, greater than, less than or equal, greater than or equal, not equal
  51. 51. Using relative and absolute cell references 47You can override this order of priority by using brackets. Excel will first evaluate theexpression in the innermost pair of brackets, using the priority shown above, then the nextpair of brackets, and so on. If it finds two mathematical operators with the same priority,such as multiplication and division, it evaluates the formula from left to right.Using relative and absolute cell referencesYou have seen how a formula in Excel can refer to the contents of other cells. You also sawin the previous step how Excel helpfully edits cell references when you copy or moveformulae (refer back to How Excel handles cell references when cells are copied or moved onpage 28 if you need to). These references are written in the form: cell row:cell rowFor example: C3:C5Suppose however that you don’t want Excel to do this. Consider the case in which a cellcontains a number that you always want Excel to use, no matter how formulae thatreference it are copied or moved. Such a value might be something like a currencyconversion, or any fixed value you want to use in other calculations.To demonstrate this, we’re going to extend our shopping list so that it displays prices in bothpounds sterling and euros:1. Reopen your shopping list workbook, if it’s not still open from the previous section.2. First, add the titles ‘Item’, ‘Pounds’ and ‘Euros’ in cells B2 to D2.3. Drag to select these cells again, then click on the button in the formatting toolbar to set the titles to bold.4. In cell F2, enter: Euros per Pound Tab 1.52118 Return (or substitute the current conversion rate)5. You can probably only see part of what you typed, as column F will be too narrow to display the entire phrase. Move the mouse cursor over the boundary between the titles for columns F and G, then click and drag to make column F wide enough.
  52. 52. 48 Step 3—Using spreadsheet formulae Your worksheet should now look something like this:6. Click in cell D3 and enter the following: =C3*G2 Return This calculates the price of your eggs in Euros, and the result is displayed, which will be €1.901475 if you used the exchange rate of €1.52118/£1.7. Now click again in cell D3, and using the technique you learned in Moving and copying data using dragging on page 24, drag to copy its contents to cells D4 to D6. Not quite what you expected, maybe? As you can see if you select cells D4, D5 or D6, Excel has changed the reference to cell G2, which contains your conversion rate, to G3, G4 and G5. However, this is not what you want to happen—you want Excel to use the contents of cell G2 for all the conversions. Here’s how to stop this happening…8. Select cell D3 again. Using the formula bar, change the cell’s contents to: =C3*$G$2 This form of cell reference, ‘$G$2’, is known as an absolute reference. The ‘$’ signs tell Excel never to change the cell reference, no matter how often it is moved or copied— it will always reference cell G2.9. Repeat step 7. This time you should get correct results in euros for all your items.10. To complete this exercise, we’ll visit the formatting dialog to set the decimal spaces of the euro figures to 2. Select cells D3 to D6, then select Format ➪ Cells… In the Format Cells dialog, select Number. The number of decimal places should default to 2, so just click on OK.We’ll have more to say about cell formatting in Step 4. Before you leave this step, try thefollowing exercises on your own:■ Copy cells C8 to D8 and C10:C11 to D10:D11 to see how Excel handles absolute function references.■ Change the euro conversion rate by changing the value in G2 and watch Excel work for you!
  53. 53. Using mixed cell references 49You can use the ‘$’ notation to make either the Tipcolumn, the row, or both, references absolute.For example, a cell reference of ‘$G2’ would When you are editing a formula in theensure that Excel never changed the column, but formula bar, the F4 key allows you tocould change the row, when such a reference was toggle between all the combinationsmoved or copied. of absolute, row-absolute, column- absolute and relative references. ExcelWhen you have finished, save your worksheet for is usually clever enough to work outlater. which reference to change.Using mixed cell referencesWe have described how you express a range of cells in Excel. For example, the formula: =SUM(A1:A4)is the same as =SUM(A1,A2,A3,A4)You might wonder how you express multiple ranges. For example, suppose you wanted totell Excel to calculate the sum of cells A1 through A4 and D2 through D6? It’s easy—youdo it like this: =SUM(A1:A4, D2:D6)Try this now for yourself, using a blank Tipworksheet to experiment with. You can selectnon-adjacent ranges of cells such as this by: You can ‘nest’ Excel functions. For■ Clicking and dragging to make the first example: selection =SUM(A1:A12,SUM(B1:B12))■ Holding down the Ctrl key means the same as:■ Clicking and dragging to make the second =SUM(A1:A12)+SUM(B1:B12) selection.Understanding Excel error messagesFrom time to time—although hopefully not too often—Excel will display an error messagein a cell instead of the answer you expect. This is fairly common when working withformulae. For example, if you enter something like: =C2*D2in cell E2, but cell C2 contains text, Excel will display #VALUE! in E2. This is Excel’s wayof telling you that it can’t make sense of what you are trying to do (you can’t multiply text!).
  54. 54. 50 Step 3—Using spreadsheet formulaeExcel can display a wide variety of error messages. Those you are most likely to encounterare:Message Meaning##### Excel cannot display the cell’s contents, usually because the column is too narrow for the format selected.#VALUE! Excel cannot calculate a formula, usually because one or more of the values for the formula is of the wrong type.#DIV/0! You are trying to divide by zero. This is mathematically impossible.#NAME? Excel cannot recognise a cell range or the name of a function. This is sometimes caused by omitting a closing quote from text.#REF! Invalid cell reference, for example if you have deleted a cell that is referred to in a formula.#NUM! A function has the wrong type of argument.Using conditional functionsClearly we don’t have room, and you don’t have time, to learn about all the functions thatExcel offers. You need to know about the sum, average, minimum, maximum and countfunctions as a minimum, which we’ve already looked at.However, it also requires to have some idea about logical functions such as IF(). By logical,we mean functions that compare one or more items and produce a result of TRUE orFALSE. For example, here is a conditional test: A3>A4which means ‘the contents of cell A3 is greater than the contents of cell A4’. Obviously, thiscan only either be true or false. IF() allows you to include a test like this in a formula. Itreturns one of two values in a cell depending on the conditional test. For example: =IF(condition,Value if true,Value if false)The value returned by the function can be of any type that Excel supports. For example, itmight be text: =IF(A3>A4, "Above", "Equal or below")
  55. 55. Using conditional functions 51To see this in action, we’ll add a column to our shopping list that compares each item to theaverage cost that you added in the exercises on page 48:1. Reopen your shopping list worksheet.2. If you had difficulties adding the average cost values in the exercises on page 48, carry out step 3 below, otherwise continue from step 4.3. Select cell B13, then enter: Average cost Tab =AVERAGE(C3:C6) Tab =AVERAGE(D3:D6) Return4. We want to add a new column for our Note conditional test values, so click on the column title of column E, then select Insert If a cell that is the destination of an ➪ Columns. Excel adds a new blank column absolute reference is itself moved as a for you. result of editing, Excel updates all the Notice that your euro/£ conversion rate is absolute references to the cell to keep now in cell G2 and not cell F2. However, it correct. This is usually precisely what your amounts in euros are still correct! If you want it to do. you look in any of the cells D3 to D6, you’ll see that the absolute reference to G2 has changed to F2.5. Select cell E2 and enter: Above average? Return6. Click and drag the column divider between column E and column F to make column E wide enough to display the whole title.7. Select cell E3 and enter: =IF(C3>$C$13,"Yes","No") Return You can type this is as written, or click the relevant cells to build up the formula. as you prefer. Remember that you can use the F4 key to make the reference to cell C13 absolute.8. Click in cell E3 again to select it, then copy it by dragging to cells E4 to E6.This is what your worksheet should look like now: