Introduction to Excel PDF
Document Details
Uploaded by BeneficiaryMorganite6576
Tags
Summary
This document provides an introduction to Microsoft Excel, a spreadsheet software. It details the basic components and functionality of Excel, such as spreadsheets, workbooks, sheets, cells, and how to input and edit data within the program.
Full Transcript
INTRODUCTION TO EXCEL 1 INTRODUCTION Anyone who has used a computer for more than just playing games will be aware of spreadsheets. A spreadsheet is a versatile computer program (package) that enables you to do a wide range of calculations dynamically, and create high quality...
INTRODUCTION TO EXCEL 1 INTRODUCTION Anyone who has used a computer for more than just playing games will be aware of spreadsheets. A spreadsheet is a versatile computer program (package) that enables you to do a wide range of calculations dynamically, and create high quality graphs and charts. Microsoft Excel is the most widely used spreadsheet, and is available within the Microsoft Office suite of programs. As you work through this introduction to Excel, it is a good idea to be at a computer so that you can try out various things as they are described. To get into Excel, simply double click on the Microsoft Excel icon if there is one on the computer desktop. Alternatively, click on the Start button in the bottom left corner of the screen, move the cursor to Programs to open up the programs menu, and then click on Microsoft Excel. Your computer should display the basic Excel screen shown in Figure 1. You are now ready to use Excel. Figure 1 Basic Excel Screen The bulk of the screen is devoted to displaying a spreadsheet, which is one of many similar sheets that make up an Excel workbook. By default, the workbook is set up with 3 sheets, but this can be extended by creating additional sheets as required. In simple examples, you will often be able to organise your work on a single sheet, but for more complicated problems it may be more convenient to use several sheets. Different sheets are accessed by clicking on the appropriate Tab at the bottom of the screen. It is also possible to give the sheets more meaningful names, rather than the default names Sheet1, Sheet2, Sheet3 etc. Simply right click on the Tab to open up a menu allowing you to (among other things) Insert, Delete or Rename the worksheet. -1- Across the top of the screen is a title bar that displays the name of the program followed by the name of the workbook (“Book1” is the default name, which will change when you save your data under some other, more meaningful, name). On the right of the title bar are the usual buttons to minimise, maximise and close a window. Below the title bar is the main menu bar that contains a series of pull-down menus, organised as with most applications, into related groups of tasks. Selecting from the menu bar either opens up a sub-menu, or causes Excel to execute some task. Below the menu bar are two rows of toolbars that contain buttons (also called icons) for easy access to the more frequently used tasks. They allow you to execute the task by simply clicking on the appropriate button, rather than opening up a series of menus. Most of these buttons, such as cut or paste, are standard across many applications and work in exactly the same way as in, for example, Microsoft Word. You can also access some of these more common tasks by right-clicking on any part of the spreadsheet. Note, however, that the part of the spreadsheet where you right-click, for instance a cell or a row or column header, will show a slightly different set of tasks that are appropriate to that element of the spreadsheet. 2 AN EXCEL SPREADSHEET A spreadsheet works by laying out your data in a rectangular grid of rows and columns, in the same way that you would do if you were using a sheet of paper. For example, suppose you have collected quarterly data on home and export sales in the years 2003 and 2004. A natural way of displaying the data would be as shown in Figure 2. A B C D E F G 1 Quarter 2003 2004 2 Home Export Total Home Export Total 3 Spring 23 16 39 25 18 43 4 Summer 28 17 45 31 19 50 5 Autumn 21 11 32 24 12 36 6 Winter 20 13 33 21 15 36 Figure 2 Quarterly Sales Data The data are laid out in 7 columns and 6 rows, including row and column headings. As you can see in Figure 1, in an Excel spreadsheet the rows are numbered from 1 upwards, and the columns are referred to by letters in alphabetical order. After the 26th column, they are labelled AA, AB, AC, … then BA, BB, BC, … etc. When you have entered the data into Excel, what you see on the computer screen will look almost exactly like Figure 2, apart from some blank columns after G, and blank rows below 6. Any cell in the spreadsheet is identified by its column and row position. For example, the top left cell containing the word “Quarter” is cell A1, and the home sales in autumn 2004 (the value 24) is in cell E5. We often need to refer to a range of cells, which is a rectangular block of consecutive rows and columns. For example, the 2003 data is contained in rows 3, 4, 5 and 6 of columns B, C and D. In Excel, any range such as this is specified by the top left corner cell and the bottom right corner cell, separated by a colon. The 2003 data -2- are therefore in the range B3:D6. Similarly, the 2004 export sales are in the range F3:F6, and all the sales data for 2004 are in the range E3:G6. 3 ENTERING AND EDITING DATA The cells of a spreadsheet can contain either numbers, as in cell B3, or characters (letters and other symbols), as in cell A1. To enter data into the spreadsheet, click on the appropriate cell and type in the required contents and then press Enter. Immediately above the column headings of the spreadsheet, there is a Formula bar that shows the active cell address, and the contents of that cell. In Figure 1, the cursor is initially positioned on cell A1, and this cell address appears on the left of the formula bar. As you type an entry into any cell, the contents will appear after the symbol fx on the formula bar. In Figure 1, cell A1 is initially empty, so no contents are shown on the formula bar. Try entering some data by setting up the spreadsheet exactly as shown in Figure 2. As you enter data, you will see that when you press the Enter key the cursor automatically moves down to the cell below. You can change this automatic transition so that the cursor moves up, down, left or right (or not at all) after each data entry. To do this, click on the Tools menu, select Options and then click the Edit tab where you will see a setting Move selection after Enter. You can alter the direction of movement by changing Direction. Unchecking the box causes the cursor to remain in the current cell after entry. It is easy to change (edit) the contents of any cell. Click on the cell to be edited and then either: delete the entire contents of a cell by pressing the Delete key type a new cell entry (there is no need to first delete the old entry as this will happen automatically) modify the existing contents by positioning the cursor in the formula bar. Highlight the section to be changed, or click at the point where an insertion is to be made, and type in the new characters/data. Practice these various editing operations by amending some of the cells in your spreadsheet. For example, 1. click on cell A7 and enter the word “Tootal” (notice the cursor moves to cell A8 when you press Enter). 2. click on A7 again, highlight one of the o’s in the formula bar and delete it (then press Enter). To enter the same data repeatedly into a number of cells, we can use the copy and paste facility as follows. Enter the data into the first cell(s) Highlight these cells and press the copy button Highlight the cells where the contents are to be copied, and press the paste button Practice this by first deleting the contents of cells E2 to G2 (E2:G2), and then copy into these cells the contents of cells B2 to D2 (B2:D2). -3- 4 ENTERING FORMULAE If a spreadsheet were only able to hold input data, as on a sheet of paper, it would not be very useful. The power of a spreadsheet comes from the ability to enter formulae into the cells of the spreadsheet so that results can be calculated automatically. This allows the contents of any cell that contains a formula to be determined automatically from the contents of other cells. Furthermore, the calculation is dynamic in the sense that the result of the formula changes automatically whenever the values that the formula uses are changed. For example, if the spreadsheet in Figure 2 has appropriate formulae in the cells of columns D and G, the totals can be determined automatically from the sales data in cells B3:C6 and E3:F6. In particular, the total sales in the spring of 1998 is simply the sum of cells B3 and C3, so rather than enter the actual total (39) in cell D3, we can enter the formula = B3 + C3 The = sign is necessary at the start of any formula so that Excel can distinguish a formula from a general text entry. After all, we might have wanted to put the characters “B3 + C3” into cell D3 as data. All the other cells in column D contain similar formulae to that in cell D3, for example (D4) = B4 + C4 When entering these formulae, the cell reference in brackets on the left (D5) = B5 + C5 is not required, as the cursor will be positioned on the cell concerned. (D6) = B6 + C6 Input these formulae into the appropriate cells. Notice that the formula appears on the formula bar as you type it in. Notice also that you do not see the formula in the cell itself, only the result of the formula. The spreadsheet therefore appears no different from how it did before, but the contents of column D are now dynamically linked to those of columns B and C. It can be time consuming to type in every formula individually, but the process can be made much simpler. When essentially the same formula is being put in each cell, it can be copied from one cell to another using copy and paste, just as data can be copied. The formula that we have just entered into column D is simply the sum of the two cells immediately to the left. If the formula in cell D3 were therefore copied and pasted to cell D4, the original reference to cells B3 and C3 will be automatically updated to refer to cells B4 and C4. Copying a formula across or down the spreadsheet will automatically update the row and column references within the formula. So, for example, if the formula in cell D3 is copied to cell G3, the formula will become = E3 + F3 Likewise, if copied to cell G7, it will become = E7 + F7 As the formulae that we require in column G are essentially the same as in column D (i.e. the sum of the two cells immediately to the left), any one of the formulae in column D can be copied and pasted to cells G3:G6 in one operation. -4- Try this for yourself. Click on (say) cell D3 and press the Copy button Highlight cells G3:G6 and press the Paste button Finally, decide what formula is required to give a column total in cell B7 and enter this formula into cell B7. As essentially the same formula will be used in each of cells B7:H7, the formula in B7 can copied and pasted to cells C7:G7. 5 ABSOLUTE CELL REFERENCES When copying a formula, we usually want the cell references within the formula to be automatically updated for different rows and/or columns. However, there are occasions when we do not want this to happen. For example, we might want a reference to cell D7 to remain as that no matter where the formula occurs. We can prevent cell references from being updated by inserting a $ symbol before either a row number or a column letter within a cell reference. For example, if a cell is referred to as $D7, then copying a formula containing this cell reference will fix the column at D, which will not be changed when the formula is copied to different columns. The row reference, however, will be updated as the formula is copied to different rows. Similarly, referring to a cell as D$7 will fix the row reference (i.e. it will always be copied as row 7), but allow the column to be updated. Fixing both row and column references, e.g. $D$7, causes the formula to refer to cell D7, no matter where it is copied. A quick way of fixing a row or a column or both is to type in the required cell reference (without the dollar signs) and use the F4 key repeatedly to “toggle” through the different $ combinations. For example, having typed D7, pressing the F4 key once changes this to $D$7; successive presses of the F4 key produce D$7, $D7, D7 etc. To see an example of this, suppose we wish to work out what percentage of each year’s sales were home and export; for example the Home percentage in 2003 would be 92×100/149 = 61.7%. Suppose we wish to calculate these percentages in row 8. To avoid having to type the same formula repeatedly, we can enter it once in cell B8 and then copy to cells C8:D8. The formula we use in cell B8 would be: = B7*100/$D7 [= B7*100/$D$7 would produce the same effect] Can we copy this same formula into cells E8:G8 to give the 2004 percentages? If not, what formula do we need in cell E8, which can then be copied to cells F8:G8? Enter the correct formulae into cells B8 and E8, then copy and paste to complete row 8 in Figure 3. -5- A B C D E F G................................ 7 Total 92 57 149 101 64 165 8 Percent 61.74497 38.25503 100 61.21212 38.78788 100 Figure 3 Calculation of Percent Row 6 INSERTING ROWS AND COLUMNS & FORMATTING CELLS As a final exercise, suppose we wish to calculate the quarterly percentage breakdown in total annual sales for each year. We could perform these calculations to the right of the data, in columns H and I. However, it would be better to put the 2003 percentages beside the 2003 data (i.e. between columns D and E) and the 2004 percentages after column G. We need, therefore, to insert a new blank column after column D. To do this first position the cursor in the column immediately to the right of where the new column will be, and then click on Insert on the top menu bar, and choose Columns. A blank column will appear to the left of the cursor, and the columns to the right will be re-labelled. Rows can be inserted by a similar procedure. Insert the blank column, which will now be column E, and calculate the percentage quarterly breakdown by entering and copying the appropriate formula. Notice that the formulae in both columns are essentially the same so if the correct formula is entered in cell E3, it can be copied to E4:E7 and I3:I7. Finally, type in the heading “Percent” in cell A8, and copy it to cells E2 and I2. You will see that the percentage figures that you have calculated are given (by default) to 5 decimal places. In reality, this is unnecessary accuracy, and probably 1 decimal place is more than adequate. The contents of any cell can be displayed in a wide variety of ways to suit the purpose of the spreadsheet. The format of cells is adjusted by selecting Format from the top menu bar, and choosing Cells. This allows you to change features such as alignment (left, right or centred), font and decimal places. More directly, you can set the alignment within any cell using the usual alignment buttons and increase/decrease the number of decimal places by clicking on the following buttons. If you centre all the cells (apart from column A), and reduce the percentage figures to 1 decimal place, your spreadsheet should now look like that in Figure 4. -6- Figure 4 Final Spreadsheet 7 STANDARD FUNCTIONS Suppose we need to enter a formula that calculates the total of 10 values entered in cells A1:A10. It would be very tedious to have to type in the following formula: = A1 + A2 + A3 + A4 + A5 + A6 + A7 + A8 + A9 + A10 Fortunately, there is a shortcut. We can use a standard function for the sum of a range of cells. In the above case we could abbreviate the formula to = SUM(A1:A10) The cells we wish to sum do not have to be in a single row or column; they could cover a number of adjacent rows and columns. For example, the total 2003 sales in cell D7 of Figure 2 could be written as = SUM(B3:C6) Similarly, a number of distinct ranges could be included within the SUM function. For example, a formula for the overall sales for the two years could be written as = SUM(B3:C6, E3:F6) SUM is just one of over two hundred standard functions, the majority of which you will probably have no need to use. The more commonly used functions are: SUM Sum of a range of cells MAX Maximum of a range of cells MIN Minimum of a range of cells SQRT Square root of a cell or value AVERAGE Average (arithmetic mean) of a range of cells STDEV Standard deviation of a range of cells MEDIAN Median of a range of cells Other, more specialised, functions will be introduced as they are required in relevant chapters of the book. All functions that you will use require 1 or more arguments in brackets following the function name. These arguments almost always specify the cell or range of cells to which the calculation applies. If you know what -7- arguments a particular function requires, you can simply type in the function name and its arguments as we did with the SUM function above. A simpler way, however, is to use the Insert menu and select Function as shown in Figure 5. This brings up the Paste Function dialogue window from which you select the required function from the relevant category, for instance the basic mathematical functions are in the Math & Trig category, whereas the basic statistical functions (such as average and standard deviation) are in the Statistical category. This then opens a dialogue box for the selected function which prompts you for the required arguments. The dialogue box for the SUM function is shown in Figure 6. An alternative to selecting function from the Insert menu is to click the function button. → Figure 5 Selecting a Function Figure 6 SUM Function Dialogue Box -8- 8 EXCEL ADD-INS Most of the basic statistical calculations, such as an average or standard deviation, are available as functions in Excel. However, advanced statistical analyses that involve more complex calculations are provided in a Data Analysis tool-pack that is available in the Tools section of the menu. However, along with other more advanced features of Excel, Data Analysis is not present in the basic Tools menu, and must be installed if required. These are the so-called Excel Add-Ins. Once a particular Add-In has been installed, it remains in the Tools menu until it is removed, so it only needs to be installed once. To install Data Analysis (or any other Add-In) open the Tools menu and select Add-Ins. From the list of available Add-Ins, check the Analysis ToolPak box and click on OK as shown in Figure 7. → Figure 7 Installing Data Analysis When you have added-in the Analysis ToolPak, Data Analysis will then appear in the Tools menu. Clicking on Data Analysis will open the window shown in Figure 8. You can then select on any of the available analysis tools and pressing OK will open up a further dialogue box specific to the analysis required. Another Add-In that you will find useful is STiBstat, which we have developed for certain basic graphs and procedures that are not otherwise available within Excel, for example drawing stem-and-leaf plots and box plots. A copy of STiBstat is provided on the CD-ROM and should be copied to your computer’s hard disk drive so that it will be automatically loaded whenever you run Excel. To load the STiBstat Add-In for the first time, click on the Browse button when you open up the Add-Ins window (see Figure 7) and go to the directory where you have saved the copy of STiBstat. Double clicking on the STiBstat icon will cause it to appear on the menu bar just after the Tools item. Thereafter, whenever you open the Add-Ins window, there will be a checked item called -9- Basic statistics for STiB as shown in Figure 7. Within STiBstat there are four individual routines, the uses of which are described in chapters 3 and 4. Figure 8 Data Analysis Selection Window 9 GRAPHS AND CHARTS Excel can be used to create a wide range of high quality graphs and charts from data contained in a spreadsheet. The simplest way to do this is to use the Chart Wizard, which takes you step by step through the process of creating a chart of the type that you want. The best way to fully appreciate the many graphs and chart drawing facilities within Excel is to experiment with a simple set of data. To get you started, however, we will go through the various stages that you follow when using the chart wizard. First, select the Chart Wizard by clicking the button. This will take you through a 4-step process to build a chart of the form you want. We will illustrate below each of the 4 steps, along with the relevant dialogue box. From the list on the left in Figure 9, choose one of the standard chart types. As you click on a particular type the various options within that chart type are displayed in pictorial form on the right. When you have decided on a chart type and a particular form of that chart, click on the relevant picture to the right. Suppose you want a vertical (i.e. column) bar chart. There are 7 options of that type. The 3 styles on the top row have clustered, stacked and percentage bars with no depth. On the second row are the same 3 forms but with 3-dimensional bars. On the third row is a chart with the bars in 3-dimensional space. As you click on any picture, a brief description is given, and if you have highlighted some data before selecting the chart wizard, you can get a preview of how your chart will look by pressing and holding the View Sample button. Having chosen the graph type, click the Next button. If you have not highlighted your data before entering chart wizard, you now specify the Data range in Figure 10 by highlighting it on the spreadsheet. When you do this a picture of your data will appear in the area at the top. Try this yourself by highlighting the range A2:C6 of the sales spreadsheet in Figure 4. - 10 - Figure 9 Step 1: Specify the Chart Type Figure 10 Step 2: Specify the Source Data - 11 - We have included the titles (row 2 and column A) in the data range, so these appear on the graph as labels on the x-axis and the graph legend. See what happens to the graph if you click the Rows radio button to specify that the data are organised by rows rather than columns. In practice, the choice of data in rows or columns will depend on which feature of the data you wish to emphasise in the graph. Having specified the source data, click the Next button, or go Back to the first step to change the graph type. In step 3, shown in Figure 11, you modify the display features of the graph, and add any titles. The dialogue window contains a number of tabs that you choose to set the various graph characteristics. For example, the graph titles are incorporated by clicking on each title box in turn and typing in the required text. After a short delay, the titles appear on the graph itself as shown. By default, the graph is drawn with horizontal (Y-axis) gridlines. Using the gridlines tab, these can be removed and, if required, vertical (X-axis) gridlines may be added. The legend tab allows the legend box (specifying the meaning of the various colours used for the bars) to be included or not, and if included, where it is positioned. Clicking on Next takes you to the final step, or Back to step 2. Figure 11 Step 3: Specify the Chart Options The final dialogue box, shown in Figure 12, simply controls the location of the graph. It can be included in the workbook as a complete sheet in its own right, or as an object within a specified sheet. Check the appropriate radio button and if it is to be a new sheet, enter an appropriate name by replacing the default name Chart1. 10 PRINTING AND SAVING A WORKBOOK Once a spreadsheet has been created, including any graphs, it can be printed and/or saved using the appropriate selections from the File menu. When saving, the entire workbook will be saved. - 12 - When printing, you may print a selection of a sheet (i.e. a highlighted range), a chart, a whole sheet or an entire workbook. When printing a chart, first click on the chart in question before entering the print menu. You will then just print the selected chart rather than the spreadsheet itself. Figure 12 Step 4: Specify the Chart Location - 13 -