Section 1 Starting and finishing Excel From time to time in the course of working through these sheets you will be told to save your work on a floppy disk or to load workbooks from the floppy disk. You will be provided with a disk for this purpose. When working on your own computer you will probably keep your work on your hard disk. Starting Excel The classroom PCs have an Excel shortcut visible on the desktop From the Start menu choose IT Services Apps and then Microsoft Office and then Excel If the “Office assistant” appears, click the button labelled Start using Microsoft Excel Once the application has started, the screen changes to display a blank sheet in a new Excel workbook. The sheet is ruled into columns and rows. The intersection of each row and column makes a box, called a cell, and it is into these cells that you will type your data. Cells Each cell is referenced individually by a column letter and a row number which together create a cell address e.g. A1 is the first row of column A; B7 is the seventh row of column B and so on. One of these cells (cell A1 in the illustration) is highlighted – that is it is shown with a thick border round it. The highlighted cell is known as the active cell. You can move around the worksheet making different cells active by means of the arrow keys. Try this and notice how the highlighting moves as different cells are made active. The Tab and Return keys also have the effect of moving the highlight on to make a different cell active. You can also make a cell active by clicking on it with the mouse. Move the pointer over cell E5 and click. Notice how the mouse pointer is in the form of a cross when it is over one of the cells in the worksheet. You can use upper or lower case for the letters in the cell-addresses. 1 Menu bar, toolbars and formula bar At the top of the screen is the title bar containing the words Microsoft Excel -Book1. Below that comes the menu bar, which gives you access to Excel’s commands. To use a command, click on a menu name to display a list of commands, and then choose what you want from the list. You are probably familiar with this from using Word: if not, ask. Beneath the menu bar come the toolbars. There are a number of different toolbars in Excel. To see a list, click on Toolbars in the View menu. At startup, you should have two toolbars visible: the standard and formatting toolbars, as shown in the illustration on page 1. Below the toolbars, immediately above the worksheet window is a long thin area called the Formula Bar. Notice the equals sign in the formula bar. To the left of the equals sign is a box containing the address of the currently active cell. Before proceeding, you will learn how to exit from Excel. Quitting Excel To quit Excel completely, you choose Exit from the File menu. If you have entered data that you have not saved, Excel will display a pop-up dialogue box asking if you want to save changes to your worksheet. You then have the option of saving and then quitting, quitting without saving, or cancelling the quit altogether, so that you are left in Excel. Exit now, so that you know how to do it, and then start up Excel again. Getting help There are several ways of getting help in Excel: Use the Help menu: choose Contents and Index and then click on Index scroll through the alphabetical list of topics, or type the topic you want in the box provided Click on the question-mark icon on the right-hand-side of the standard toolbar to launch the Office Assistant type a topic (such as “calculate total”) and then click Search Most of the pop-up dialogue boxes also provide a Help button ( question mark in the top right corner) which gives information relevant to the task in hand As you move the pointer over the toolbar buttons, a brief explanation of what each button does is displayed at the foot of the screen Changing the layout of the screen The toolbars Look back at the illustration on page 2, and compare it with what you can see on the screen. In particular, make sure you have got the same toolbars displayed. If in 2 doubt, choose Toolbars from the View menu, and in the list that is displayed make sure that the Standard toolbar and the Formatting toolbar are selected (they should have a tick beside them). If you have difficulties, ask for help. The Options command You can change the appearance of the screen by means of the Options command. Choose Options from the Tools menu The options that you can change are grouped together in different categories. The dialog-box should be seen as representing a box of index cards with labelled tabs. Each card contains a category of options. If you click on a tab, that category is brought to the front. The illustration shows the View category. To choose a different category click on one of the other tabs. Look through some of the different categories of options to see how you can change the look and behaviour of the program. Click on the View tab Make sure the options are shown as they appear in the illustration. To select or de-select an option, point at it with the mouse and click If you have made changes, click OK, otherwise click Cancel If Excel does not behave in the way described in these notes, you might find that the explanation is that some of the options are not set in the way that the sheets assume. In this case, look through the options to see if there is anything that might explain the behaviour of the program. For instance if Excel displays a blank cell where you have entered a zero, the reason might be that the Zero values option is turned OFF. Section 2 Entering data In this section you will learn how to enter data into Excel, how to move around your worksheet and how to save your data. Workbooks and worksheets You will have noticed that your Excel document is referred to as a book or workbook. A workbook can contain a number of sheets – if you look along the bottom of the screen you will see a series of tabs which enable you to jump easily from one sheet in your book to another. If your task is large and complex you might divide your data up between a number of worksheets, but we shall not be doing this in the first part of the workshop. 3 Data entry We shall start with a completely new worksheet so if you have already opened a worksheet and entered text, quit from Excel first of all and start it up again. A blank sheet in a new book should be displayed. To enter data in a cell, you must first make that cell active. When you open a completely new sheet, the cell that is active is always A1. You can enter different kinds of data into a cell e.g. text or numbers. Data can be entered anywhere on the worksheet. It is not necessary to start with the first cell. You can leave cells blank if you wish. There is a distinction between just typing data into a cell and entering data into a cell. Until you enter your data you have not committed it to the worksheet. As you will see, there is more than one way of actually entering the data. As you type data into a cell, what you type also appears on the Formula Bar. At first it will not be obvious why the Formula Bar is needed, but you will soon see how it is used. Note: It is possible to switch the Formula Bar on and off. If you cannot see it, choose the View tab in the Options dialog-box and make sure the box labelled Formula Bar is ticked. Typing data into a cell Click on the cell A1 to make it active Type the number 1234 into the active cell and look at the Formula Bar to see the number appear there as you type. Note that when you are typing data into a cell, it doesn’t matter where the mouse cursor is when you do this. Any data that you type always goes straight into the active cell. Once you have started typing data into a cell, right up until you finally enter the data in the cell, anything you type will be treated as data to be put in the active cell. Now move the mouse-pointer to cell B1 and click the mouse to make B1 active. In addition to making B1 active, this action also causes the data in A1 to be entered into the worksheet. Making a second cell active, is one way of causing data in the first cell to be entered. Note how the number entered into cell A1 has now disappeared from the Formula Bar although it still appears in the cell A1, itself. The data that appears in the Formula Bar is always that in the active cell itself and as B1 does not yet contain data, the Formula Bar is empty. Click on the cell A1 to make it active again and note how the number 1234 reappears in the Formula Bar. Editing data in a cell Suppose you now wish to change the number that you’ve entered into cell A1. Make sure cell A1 is active 4 Move the pointer up to the Formula Bar. Its shape changes from a cross to an I-beam. Now click at the end of the number 1234 in the Formula Bar. This lets you edit the number. Add the digit 5, making 12345. Note how the number shown in the cell A1 changes accordingly. Click on cell B1. This makes B1 active and also enters the edited data in A1 into the worksheet. Now type 5432 into cell B1 Press Return: this is another way of entering the data Another way of editing the data: double click on cell A1 Now the mouse-pointer becomes an I-beam while it is over A1, so that you can edit the number without going up to the Formula Bar Position the I-beam after the 2 in cell A1 and click Now press backspace to delete the 2 so that the cell contains 1345 Click on B1 Continue going back and forth between A1 and B1 making each active in turn and editing the numbers till you are quite happy with these procedures. Remember that data which has already been entered into a cell can only be changed by first making that cell active again. Entering data with the tick icon You will have noticed that when you are typing in the Formula Bar, buttons with a tick and a cross appear to the left of the data entry area. Clicking on the is another way of entering data. Try the following. Click on B2 to make it active Click in the Formula Bar and type 4321 Note how the number appears in cell B2 itself Now click on the tick to enter the data into B2 This time B2 remains the active cell after you’ve entered its data. Cancelling a cell entry Suppose you start to type data into either the active cell or the Formula Bar and then realise you’ve typed the wrong data entirely. You can cancel the data completely before you enter it, by clicking on the icon in the Formula Bar. The cross icon is known as the cancel box for this reason, although we will refer to it as the cross icon in this workshop. Try the following. Click on cell B5 to make it active and then type 1200 into the cell or into the Formula Bar Now click on the cross icon to cancel the entry. The number disappears from both the cell and the Formula Bar. 5 Click on one of the cells that contains some data, and then point the I- beam at the end of the data in the formula bar Use the backspace key to delete the data Click the cross, and the data will be restored, because you have cancelled the deletion You can only use the cross icon before you have committed yourself and entered the data. Once data has been entered into a cell, you have to use other methods to remove it. Undoing cell entries If you have just entered data and change your mind and want to undo the entry, the simplest thing is to choose Undo Typing… from the Edit menu. Try the following. Make cell D1 active, type a number and enter the data by clicking the tick icon. The number should appear in both cell and Formula Bar. Now choose Undo Typing … in D1 from the Edit menu or click on the icon in the toolbar. The number should disappear from both cell and Formula Bar. The Undo… command in the Edit menu is only available immediately after you have made the entry. But the little arrow beside the “undo” icon in the toolbar will give you a list of recent actions and you can go back some way undoing what you have done. Moving around the worksheet What you see on the screen in the window is only a small part of the total worksheet. You can see more of it by using the scroll bars at the bottom and right-hand-side of the window in the same way as you would for any other Windows- or Macintoshbased application. Note: If no scroll bars are shown, choose the View tab from the Options dialog-box and click one or both of the Scroll Bar boxes. See the first worksheet for details of the Options dialog-box. Click cell B1 to make it active. Use both scroll bars to see other areas of your worksheet, but don’t click on the worksheet itself Come back to the original area of the worksheet and note that cell B1 is still active. Looking around the worksheet like this doesn’t change which is the active cell. It just lets you look at areas that are hidden from view. Making cells active There are several ways in which you can make cells in different parts of the worksheet active: 6 use the arrow keys which let you move one cell at a time move the mouse-pointer to another cell and click with the mouse button press the Tab key to move the active cell one cell to the right press the Return key to move the active cell one cell down select Goto... from the Edit menu (or press the function key F5), enter the cell address in the dialog-box, in the text-box labelled Reference and then click OK click in the box on the left of the formula bar (it contains the address A1 in the picture, because A1 is the currently active cell), type a new address and press Return. Try these different techniques now. Make the cell A2 active by using the arrow keys, and type another number, 2145, say into it. Move to cell A3 by pressing the Return key and type 2214 into the cell. Now position the pointer over cell B2 and click with the mouse. Type 2211. Press the Tab key to make cell C2 active and type 2567. Click the tick icon to enter this data into C2. Choose Goto... from the Edit menu and type Z38 in the box labelled Reference: and click OK. You should find that Z38 is now active. Type 5534 into it and click the tick icon. Click on the box on the left of the Formula Bar, type B8 and press Return Which of these methods of making cells active you choose, will depend very much on the task in hand. If you are entering columns of data, for example, then pressing the Return key is the most obvious choice, while if you were entering data in rows you would probably move from cell to cell by pressing the Tab key. Zooming The Zoom... command from the View menu can be used to increase or reduce the scale of the display. When you choose this command, a dialog-box is displayed giving you a choice of either selecting pre-set magnifications or entering your own in the box marked Custom. Try this. To return to the original magnification, choose 100% in the dialog-box. Can you see another place where you can change the magnification? Look towards the right-hand end of the toolbar. Saving your work Now that you have entered some data into your worksheet you should save it. As with all computing tasks, it is good practice to save your work regularly. Don’t wait till the end of a work session to do this. Get into the habit of saving your work after 7 any significant change. That way, if you make a complete mess of the next stage, you have a good version to go back to. Insert your floppy disk into the drive. Choose Save As... from the File menu. In the resulting dialog-box you will be prompted for a file name for the workbook Click on the down-arrow beside the Save in: box and choose 3½ Floppy (A:) Double click in the File Name: box and enter a name, eg Prac1 Click on the Save button. You should save your work at regular intervals but now that you have named your worksheet, choosing Save from the File menu (rather than Save As...) will save it under its existing name and in the same place i.e. to your floppy. If you wish to save under a different name or in a different location (on a different disk drive or in a different directory) you should choose Save As... again. Section 3 Working with data Types of data The data which you enter into cells in a worksheet is one of three types. Values: raw data which forms the basis for calculations Labels:text used as headings for rows and columns Formulas: performing calculations based on the values in other cells To begin with we will be working with values only, and will leave labels and formulas till later on. Values can be displayed in one of many different kinds of format. Some formatting is similar to what you might use in a Word document, such as different font styles, and different alignment. When it comes to numbers you can also choose to display the number as currency or as a number with as many decimal places as you wish. For example, the value 12.34567 might be displayed as £12.34 or 12 (with no decimal places) or 12.35 (to two decimal places) of 12..3457 (to four decimal places). These are different ways of displaying the value; the value stored in the cell is the same in every case. In the following exercise you will enter two columns of numbers and then change their format afterwards. Entering columns of values If you have just finished working through Sheet 2, then your newly-saved workbook, Prac1, should still be open. As you will not be using this further, it is a good idea to close it. Choose Close from the File menu to close down the Prac1 workbook. 8 Choose New... from the File menu and if a dialog-box appears click OK to confirm that you want to open a new workbook A new book (Book2) should open and an empty first sheet will be displayed. Now making sure cell A1 is active, enter 21.21 Make cell A2 active and enter 34.34 Into cells A3, A4 and A5, enter 56.23, 45.88 and 66.55 respectively. Now into cells B1 to B5 inclusive, enter 2.234, 2.199, 3.124, 4.1, 5.3 respectively. Before proceeding, save your Excel document to your floppy, naming it Prac2 Now that you have entered your two columns, you will change the format of the first column to have only one decimal place instead of two. You could achieve almost the same apparent effect by deleting the second digit after the decimal point, but if you did that you would actually be losing the second digit and so changing the value of the data in the cell; by changing the format, you don’t change the value, but only the way in which it is represented. Selecting data Before you can change the format of data you must first select it. To select an entire column, you click on the column letter. Click on the column letter A Notice how the entire column is highlighted, showing it has been selected. The top cell in the column is included in the selection, but because it is still the active cell it remains white – but notice the heavy border round it indicating that it is part of the selection. You can select an entire row by clicking on its row number and you select blocks of cells, by dragging across them. To de-select you can just click anywhere on the sheet. Changing the format of data Now you will change the format of the first column of numbers. Is column A still selected? If not, select it now Choose Cells... from the Format menu Click on the Number tab On the left of the dialogue-box is a box headed Category which lists the different kinds of data you can have (text, numbers, dates etc). When you select 9 one of these categories the rest of the dialog-box describes the different available formats, or ways in which this category of data can be displayed. In the dialog-box, click on Number in the list of categories As we selected the Number category, the dialog-box offers us different ways of formatting numeric data. We want to display it with one decimal place. Use the down arrow beside the Decimal Places box to reduce the number of decimal places from 2 to 1 Click the OK button. Look at the first column of numbers. They should all be displayed with one decimal place. Note also that the original numbers 45.88 and 66.55 have been properly rounded to 45.9 and 66.6 respectively, and not just truncated. Excel does not forget the number as you originally typed it. If you revert to two decimal places it would display 45.88. Note that when you open a new Excel worksheet and start to enter data in cells, Excel assigns what is called a General format to the data you enter. This means that Excel will choose a format appropriate to whatever data you type. So, for example, if you enter numerical data having different numbers of decimal places as you did in column B, Excel will simply represent the number as typed. To see this, select the entire column B and choose Cells... from the Format menu again. You should see that the format for this column is General Click Cancel to close the dialog-box Moving data around At some stage you may wish to move data from one place in the worksheet to another. How you do this depends on whether you actually want to remove the data altogether from its original position or make a copy of it. The easiest way of transferring small amounts of data is by using a technique called Drag and Drop. In this, you select the cells to be transferred and then drag them using the mouse to their new position. Moving data to the end of a column In this exercise, you will use Drag and Drop to move cells B1, B2 and B3 to the bottom of column A so that they will become A6, A7 and A8 respectively. Select cells B1, B2 and B3, making sure they are highlighted To select several cells at once, point at B1, press the mouse-button and drag down to highlight cells B2 and B3. Then release the button. The three selected cells will have a border round them. B1 is the active cell, so it will remain white, while the other two are black Move the mouse-pointer to the edge of the selection until it changes to an arrow 10 This is important, since if you click the mouse and start dragging before the mouse-pointer changes to an arrow, the effect will not be what you want While the mouse-pointer is still shown as an arrow click and hold down the mouse button while dragging with the mouse in the direction of column A An outline of the selection will be dragged with the pointer. When the box outline is in place just below cell A5, release the mouse button. The numbers should appear in cells A6, A7 and A8, as required. Note that the formatting of these numbers has been preserved. This may not be what you want. Change the format of the newly-moved numbers to be the same as that of the numbers in cellsA1:A5 (numbers , to one decimal place), using the Format Cells dialog box as before Your worksheet should now look something like this. Inserting data between rows Suppose you want to move the data in cells B4 and B5 and insert them between cells A2 and A3. To do this, you use a similar Drag and Drop technique, but with the difference that you keep the Shift key down while you are doing the dragging. Try the following: Select cells B4 and B5 Move the mouse-pointer to the edge of the selection until it changes to an arrow. Then hold down the Shift key, click and drag with the mouse in the direction of column A, keeping the Shift key down the whole time. The selection in this case is replaced by a shaded bar to help you find the correct insertion point. When the shaded bar is between cells A2 and A3, release the mouse button and then take your finger off the Shift key If you release the Shift key before releasing the mouse-button, Excel will assume that you want to replace the contents of A2 and will ask you to confirm the replacement. If this happens, click Cancel and start again If you have done this successfully, then the worksheet should look this. If it doesn’t, because you’ve released the mouse button or Shift key too quickly, choose Undo Cut Cells from the Edit menu and try again 11 This is quite a tricky operation if you’ve not done anything like this before, so ask for help if you need it. Copying data with Drag and Drop Copying data is similar to moving it but in addition to the steps described above you must hold down the Control (or Ctrl) key while you release the mouse-button. Try the following exercise, in which you will use Drag and Drop to copy the cells A1:A4 inclusive to B1:B4. Select cells A1 to A4 inclusive, making sure they are highlighted. Move the mouse-pointer to the edge of the selection until it changes to an arrow. Then hold down the Control key, click and drag with the mouse in the direction of column B, keeping the Control key down the whole time An outline of the selection will be dragged with the arrow. When the box outline is in place just below column label B, release the mouse button and take your finger off the Control key. If you have done this successfully, then the worksheet should look like this. If you hold down the Shift and Control keys together while dragging and dropping, you will combine their effects: the data will be copied and inserted. Transferring large quantities of data If you need to transfer large quantities of data, then it is best not to use Drag and Drop as you may not be able to see what you are doing very clearly. In this case use the Cut, Copy and Paste commands in the Edit menu or use the buttons on the toolbar – these are like the tools you are probably used to using in Microsoft Word. Select the cells to be copied or moved. Choose Copy (to copy) or Cut (to move) from the Edit menu. Click on the cell at the top left-hand corner of its new position and choose Paste from the Edit menu Try using this method to copy cells A5:A10 to cells B5:B10 respectively. In this operation the “top-left” cell of the “target” range is B5, so you should click on B5 before choosing the Paste command. Your final worksheet should look like this. Notice the “marching ants” which appear round the selected text when you use the Copy command. They don’t go away immediately when you paste the data into its new position, indicating that if you “paste” somewhere else the data will still be on the clipboard. If you are not intending to paste the data anywhere else, just ignore 12 these marching ants. They go away when Excel has forgotten the data that you placed on the clipboard. The mouse pointer: you will have noticed that the mouse-pointer changes shape, and the different shapes tell you that you can do different things with the mouse. You have already encountered several different shapes, with different meanings. white cross I-beam black cross white arrow black cross with arrow heads click to select a cell click to edit the contents of a cell drag to extend and fill a selection drag to move or copy the selected cells drag to change the width of a column You will meet other shapes as time goes on. Always pay attention to how the mousepointer changes, as it tells you how Excel will respond to the mouse. Section 4 Simple calculations This section will give you a first introduction to the calculating abilities of Excel. Excel is capable of extremely sophisticated calculations, but we will only be able to get a flavour of these on this workshop. A Simple Formula Formulas are at the heart of a spreadsheet. They can be written quickly and easily to perform calculations such as averages, percentages and totals on the entire range of data or only part of it, as well as performing many more complex routines. The formula is written into the cell where the result of the calculation is required. If you place a formula in cell B5 which depends on the value of cells B1:B4 the value displayed in B5 will change whenever the values in 1:B4 change. In the next exercise, you will use the workbook called Formula1 on your floppy disk. You should still have the Excel application running but no open workbooks. If you do have any workbooks open, then close them down before proceeding. Open Formula1 by choosing Open... from the File menu, selecting Formula1 and clicking Open You should see three columns of figures as shown here. The numbers should all have a £ sign in front of them. Look at the format of the data Click on cell C1 to select it. Then select Cells... from the Format menu and click on the Number tab – look at the Category box. 13 You should see that the category is Currency. The other two columns, A and B are of this category also. Look at the dialog-box and see if you can see why the cells appear as they do (with two digits after the decimal point) Click Cancel to close the dialog-box without making any changes Calculating Suppose you wish to add up the first row of numbers and put the result into cell D1. Make cell D1 active, and type the following formula into it: =a1+b1+c1 You should notice this formula appearing in the Formula Bar also, as you would expect. Don’t forget the equals sign at the beginning. You can use either lower- or upper-case letters in the cell-addresses. Now to make the formula take effect and perform the calculation click on the tick in the Formula Bar (or press Return) The contents of cell D1 should change to £48.49 as in the picture. Now make other cells active and then return to D1 You should find that the formula =A1+B1+C1 appears in the Formula Bar whenever D1 is active, and the value in D1 is £48.89. Now make cell D2 active and type the following formula into it: =A2+B2+C2 Click the tick in the Formula Bar and £69.52 should appear in the cell D2. What makes up a formula? A formula in Excel has four elements: the = symbol which must be used to start a formula; this lets Excel know that what you type next is to be used in a calculation the cells on which you wish to perform a calculation mathematical operators such as +, -, * and / (* means multiply and / means divide) you can also use brackets in your formula functions: this topic will only be touched on in this workshop The most common mistake in Excel is leaving out the = sign. If you do this Excel will assume that what follows is data and not a formula. 14 Changing the values One extremely useful feature of a spreadsheet is that if the values used in a formula change, then the value calculated by that formula changes too, to reflect this. Try the following. Make cell C1 active and change its value from 23.44 to 13.44 (i.e. reduce it by £10.00), by editing the number in the Formula Bar. Click on the Formula Bar tick to enter this change. The value in cell D1 should change from £48.89 to £38.89 A Function Now suppose that you want to add up the figures in the first column and put the result in cell A11. You could, by analogy with the example above, use the formula: =A1+A2+A3+A4+A5+A6+A7+A8+A9+A10 This is tedious to type in, and although you could do it, there are better ways. If you want to specify a range of cells that are contiguous, you need only type the first and last cell addresses, separated by a colon. Try the following, which introduces the use of the SUM function. Make cell A11 active and enter in the Formula Bar: =SUM(A1:A10) Click on the Formula Bar tick to activate this formula. The sum of the cell-values in the first column should now appear in cell A11 as £201.60 What makes up a function? A function has a name, such as SUM, and has arguments which follow the name and are enclosed in brackets. You can find out more about functions from the Excel help system. Other useful functions are AVERAGE and PRODUCT. Notice that a function is part of a formula, so you must start with the equals sign. The AutoSum tool Another way of totalling a row or column is with the AutoSum tool: Use this method to sum the values in column B and put the sum into cell B11: Select cell B11, and click the AutoSum tool. The formula =SUM(B1:B10) should appear in both cell B11 and in the Formula Bar. In addition, “marching ants” appear round cells B1 to B10 showing that it is these cells which are to be summed. To make the formula take effect click on the tick in the Formula Bar and £295.22 should appear in cell B11. 15 Repeat this method to sum the values in column C. Your worksheet should now look like this. The AutoSum method works by inserting the SUM function formula at the end of a row or column of data. In some cases there may be ambiguity when using AutoSum. Always look carefully at the formula that Excel inserts for you before you click the tick in the Formula Bar. For example, suppose you want to sum the values in row 3 and put the result in cell D3. Try the following. Make cell D3 active and click on the AutoSum tool but don’t click the tick in the Formula Bar yet. As you can see, Excel has chosen to sum column D and not to sum row 3. It appears that, when there is a choice, Excel will sum columns rather than rows. Cancel the formula from the Formula Bar by clicking the X. Editing Formulas You can edit formulas in the same way as you edit cell values in Excel – by making the cell that contains the formula active, and then by editing in the Formula Bar. Click on cell D1 to make it active. In the Formula Bar, change the formula to =A1+B1-C1 Click on the tick in the Formula Bar to register the change. You should see the value in D1 change to £12.01 Useful Formula Short-cuts It can be very laborious to type cell references into formulae. Fortunately there is a quick way. You just click on the cells that you want to use in the calculation and the cell references will automatically be inserted into the formula. Suppose you want to enter the following formula into cell E1: =2*A3 + 3*B3 C3. Rather than entering this by typing the whole formula directly, you can try the short-cut. Make cell E1 active and put the insertion point into the Formula Bar. Type =2* Click on cell A3 and notice how the formula in the Formula Bar now becomes =2*A3 Continue typing in the Formula Bar, entering +3* to make the formula so far =2*A3 + 3* Click on cell B3. The formula should now be =2*A3 + 3*B3 Finally type - (the minus sign) in the Formula Bar and click on cell C3 16 The formula in the Formula Bar should now be =2*A3 + 3*B3 - C3. It also appears in cell E1 but the cell width is too narrow to let you see it all so the first part of the formula is truncated. Click on the tick in the Formula Bar The value in cell E1 should now be 7.25 and your worksheet should look like this. This facility can be useful, but it can lead to confusion if you forget to click the Formula Bar tick after editing a formula in a cell: if you go on to click on other cells without clicking the tick, Excel will assume that you are wanting to refer to those other cells in your formula. Copying Formulas We now come to the single most important feature of any spreadsheet program, its ability to copy formulas. Typing simple formulas more than once into a worksheet is all very well, but there are times when you want to perform the same calculation several times and it is tedious to type the same formula in over and over again. You are also more likely to introduce errors this way, especially if the formula is complicated. There is an easier way which involves copying the formula. The formula that was entered into cell D1 was: =A1+B1-C1 (If you’ve forgotten this, you can make cell D1 active and look at the formula in the Formula Bar.) The formula told Excel to (1) add the values in the first two cells in the row, (2) subtract the value in the third cell and (3) put the result into the fourth cell. Now, in order to use the same formula in cells D3 to D8 you are going to copy the formula from cell D1 to these other cells. Make cell D1 active and choose Copy from the Edit menu. Marching ants should appear round cell D1. The value in this cell is calculated from a formula and so it is the formula that is copied and not the value in the cell. Now select cells D3 to D8 and choose Paste from the Edit menu to paste the formula. Your worksheet should now look like this. Note that some of the numbers have minus signs in front of them and Excel may show these in a different colour. 17 What you have done here is pasted the formula into the selected cells but the formula has been altered so that it uses cell references particular to each row. D3 now has the formula =A3+B3-C3 D4 has the formula =A4+B4-C4 and so on To check this, make each cell active in turn and look at the formula in the Formula Bar. Absolute and relative references The cell references used in these formulas are said to be relative references because they reference cells relative to the position of the formulas on the worksheet. When a formula with relative references is copied, the cells to which it refers change according to the formula’s new position on the worksheet. This is very useful when copying a formula. However, it is useful also to be able to have a formula that refers to the same cells no matter where on the worksheet the formula is copied to. Such cell references are known as absolute references. In this next example, you will change the formula that is in cell D1, so that when you copy it into cells D9:D11, it retains absolute cell references i.e. when the formula is copied it remains as =A1+B1-C1 in each of D9, D10 and D11. Make cell D1 active and edit the formula in the Formula Bar so that it is now: =$A$1+$B$1-$C$1 As you can see, the difference here is that there is now a $ sign before both the column letter and the row number. When cell references are written in this way, they are absolute rather than relative, and will always refer to the same cell when copied. Click the tick in the Formula Bar. You should see that the value in cell D1 doesn’t change. Is this what you would expect? Now, making sure that D1 is still active, choose Copy from the Edit menu to copy this new formula. Select cells D9, D10 and D11 and choose Paste from the Edit menu. You should see that the value in cells D9 to D11 is now £12.01, as shown here. Now if you make each cell (D9 to D11) active in turn you should see =$A$1+$B$1-$C$1 in the Formula Bar i.e. the formula with its absolute references. It’s possible to copy a formula so that it has a mixture of absolute and relative references. Try the following mixture of absolute and relative references: 18 Make D1 active and change its formula to: =$A$1+$B$1-C1 and click the tick in the Formula Bar Now with D1 still selected, copy this formula by choosing Copy from the Edit menu. Select D11 and choose Paste from the Edit menu. You should see the number in D11 change to -£433.84. Before reading on to find the explanation, see if you can work out why this is so. Click in D11 and you should see in the Formula Bar: =$A$1+$B$1C11 The last part of this formula had a relative reference, so when it was copied to cell D11 it was changed to reflect this i.e. C1 changed to C11. The rest of the formula had absolute references and hence didn’t change when copied. Exercise 1 This exercise is intended to demonstrate how flexible the Copy and Paste facility can be. What you will end up with is a series of 26 numbers, in which each number (from the third onwards) is the sum of the two preceding numbers. Start a new workbook Enter 0 and 1 (ie zero and one) in cells A1 and B1 respectively Use the AutoSum tool to put the sum of A1 and B1 into C1 and then copy cell C1 and Paste it into cells C1 to Z1 Each cell from C1 to Z1 will now contain the sum of the two previous cells – that is, C1=A1+B1, D1=B1+C1 and so on ... Exercise 2 In a new worksheet create the following table Cost of Labour £12 £25 £17.50 £35 Cost of Goods £15.50 £8 £0 £100.45 Total cost Selling price £30.99 £50 £18 £200 Profit Use formulas to calculate the total cost and the profit columns. Finally calculate the total profit. 19