practical work 02 - spreadsheets - spreadsheets_ ms excel 2010.pdf · practical work 02 -...

21
PRACTICAL WORK 02 - SPREADSHEETS Goals of this practical work: at the end of the practical class you will know -to open and save files using Microsoft Excel -to perform basic operations with data: select, copy, move, delete -to perform computations using available data, using functions typed or chosen from menus -to create charts based on existing data -to automatically create data series using different MS Excel options and shortcuts Introduction. Microsoft Excel A spreadsheet or an electronic spreadsheet is a software for organizing and analysing data displayed as a table, where we can write both text and (especially) numbers. Spreadsheets developed as computerized simulations of paper accounting worksheets. Microsoft Excel, part of Microsoft Office, is a spreadsheet application developed by Microsoft for Windows and Mac OS X. It features calculation and graphing tools, pivot tables and other advanced features; it also represents the “industry standard” for spreadsheets. 1.a 1.b Fig.1. Launghing MS Excel 2010 In this practical work you will learn to use the Microsoft Excel 2010 version of this spreadsheet program. To launch the application, press the START button, move the mouse cursor over the “All Programs” button and select “Microsoft Office” from the list that appears. In the list of shortcuts displayed under MS Office you will find Microsoft Excel 2010 - just click once on it, using the left mouse button and you will start the program. On some computers you can find shortcuts directly on the desktop or on the START menu. At startup, the program will create and open a new file (“workbook”), containing three pages (“worksheets”); because of this, the window that appears will look like the following picture (Fig.2), having a structure similar to a table as the main element. 1

Upload: hoangkhanh

Post on 27-Apr-2019

273 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

PRACTICAL WORK 02 - SPREADSHEETS Goals of this practical work: at the end of the practical class you will know -to open and save files using Microsoft Excel -to perform basic operations with data: select, copy, move, delete -to perform computations using available data, using functions typed or chosen from menus -to create charts based on existing data -to automatically create data series using different MS Excel options and shortcuts

Introduction. Microsoft Excel A spreadsheet or an electronic spreadsheet is a software for organizing and analysing data displayed as a table, where we can write both text and (especially) numbers. Spreadsheets developed as computerized simulations of paper accounting worksheets. Microsoft Excel, part of Microsoft Office, is a spreadsheet application developed by Microsoft for Windows and Mac OS X. It features calculation and graphing tools, pivot tables and other advanced features; it also represents the “industry standard” for spreadsheets.

1.a 1.b Fig.1. Launghing MS Excel 2010 In this practical work you will learn to use the Microsoft Excel 2010 version of this spreadsheet program. To launch the application, press the START button, move the mouse cursor over the “All Programs” button and select “Microsoft Office” from the list that appears. In the list of shortcuts displayed under MS Office you will find Microsoft Excel 2010 - just click once on it, using the left mouse button and you will start the program. On some computers you can find shortcuts directly on the desktop or on the START menu. At startup, the program will create and open a new file (“workbook”), containing three pages (“worksheets”); because of this, the window that appears will look like the following picture (Fig.2), having a structure similar to a table as the main element.

1

Page 2: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

Fig.2. Overview of MS Excel 2010 interface

On the “View” menu you should check if the “Formula bar” is selected. This is an area containing two cells, a smaller one where the name of the current cell is displayed (the red circle on the picture above) and a larger one where the actual text that was written in the current cell is displayed (in case we input a formula, only the result will be displayed into the spreadsheet, while on the “Formula bar” we will see the text of the formula).

Saving and opening a file In order not to accidentally lose data, you should often save the file you work on. To do this, please click on the “File” menu, then on the “Save” option. A window similar to the next one should appear, if you save the file for the first time. The same window shows up if you choose the “Save as…” option, when you want to rename or save in a different location the current file. If you press the “Save” button while working on a previously saved file, you will not be prompted again for a name or a location, only the information in the file will be updated. To save the file, first please choose the following location: Computer - DATA(D:) - ENG1, to save the file in. Write in the “File name“ textbox the name you want to use (e.g.”Table”) and choose in the "Save as type" box the desired output format for your file and it’s corresponding file extension. To finish, press the “Save” button, located on the the bottom-right corner of the window Save your file with the name "Table", keeping the file type automatically chosen by MS Excel - ".xlsx". After pressing the "Save" button, you will notice that on the title bar at the top of the MS Excel program window the new name of the file is written - "Table.xlsx".

Title bar Menu bar

Tool bar

Formula bar

Cell Column names

Column

Row

Row numbers

2

Page 3: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

Fig.3.Dialogue windows for the “Save” and “Save As” options To open a file, choose the “Open…” option from the “File” menu, then browse the folders for the location where you know the file is stored. After selecting the desired file, press the “Open” button, located in the bottom-right part of the window. If you need to create another document, you can use the File menu, select New, then “Blank Workbook”

Data input To start working with MS Excel, please type in the table the data displayed below:

This data represent the temperature measurements recorded every 4 hours for a patient, for a five days period of time.

3

Page 4: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

Basic operations with data – Select, Copy, Move, Delete To copy or move data on a spreadsheet, first you have to select that data. You can do this using the mouse - press the left button then drag the mouse cursor over the area where the desired cells are, thus creating a selection rectangle. The color of the selected cells will change, usually becoming blue. This way, an entire block of cells will be selected. You can also select a block of cells using the Shift key – if you click on a cell, then Shift-click on another cell, the rectangular area that has those two cells as opposing corners will be selected. After you select the data, perform the desired command – “Copy” for copying data or “Cut” for moving data. You can select those commands from the “Home” menu or from the pop-menu that appears when you right-click the selection (see picture below), or you can use the shortcuts, – Ctrl+”C” for “Copy” and Ctrl+”X” for “Cut”. The third step consists on selecting the first cell of the new location or the entire area where you want the data copied. To conclude the copying, perform the “Paste” command - choose it from the “Home” menu or the right-click menu or use the Ctrl+”V” shortcut. As an exercise, please copy the data on the first column of your table, from A1 to A7, to the right of the table, in a location starting from G1. Use the following pictures as a guide to complete this task.

4

Page 5: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

If you want to move data in Excel, you can to use the “Cut” and “Paste” commands, in a similar way as for copying. But you have another option, to drag the selected data to a new location, by placing the mouse cursor on the border of the selection rectangle (see below its shape when it touches the selection border), holding the left mouse button and dragging the data to the desired area. Please move the data you copied before, now located into the G1:G7 cells, to the next column to the right, starting from H1.

To complete the exercise, delete the data you just moved, located now into the H1:H7 cells. If you use the right-click menu and select “Delete”, a new window will appear, asking how to replace the cells that will be removed from the worksheet. This will not happen if you press the “Delete” key on the keyboard, because that way you perform, in fact, the “Clear Contents” command - the cells are not removed, only their content is.

5

Page 6: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

MS Excel Formulas The main function of MS Excel is to perform computations and calculations using the data stored in the worksheets. This is done by replacing actual numbers with references to the cells where they are stored in the table – the cells’ names – in manually written mathematical formulas or Excel specific formulas. First, let us compute the mean value for the temperatures recorded on Monday, by adding them and dividing the sum by the number of values. The formula will be written below the data used – in the B8 cell.

When you finish writing, press the “Enter” key to see the result. Attention: the text you wrote before is now displayed on the “Formula bar”, while the B8 cell shows the result of the calculation.

6

Page 7: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

An easier way to do this calculation, especially for a large number of data cells, is to use an Excel formula. The formula for computing the mean is called “AVERAGE”. It uses as parameter the area where the data is located, indicated by the upper left cell and the lower right cell, separated by “:”. Attention: any computation performed in MS Excel must begin with the symbol “=”.

If you press the “Enter” key you will obtain the same result as before, when using the first formula. In order to compute the mean value for the other columns, instead of writing the formula for each of them we can copy the first formula in the corresponding cell from the other columns. We can do this because MS Excel has the ability to change the parameters of a formula according to the place where it is copied. To copy the formula form B8 or B9 we can use the classical approach (“Copy”+”Paste”) or use a shortcut – select the cell where the formula is located, then drag it by the bottom right corner, thus performing an “auto fill” operation.

7

Page 8: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

While some formulas can and should be learned (SUM, AVERAGE, MIN, MAX, MEDIAN), the entire list of functions available in MS Excel is too big to be memorized. This is why all the functions can be used from the “Formulas”-“Insert Function” special menu (or the “fx” shortcut button from the “Formula bar”).

8

Page 9: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

A new window will appear where you can choose the general category of functions you seek then select the actual function you want to use. For each function, a new dialogue window will appear, with text boxes where you can write or select from the table the area where the needed data is. As an exercise, compute the sum of the temperatures recorded on Monday, and display the result in cell B10. Then, copy that formula to compute the sums for all the other days.

9

Page 10: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

Creating charts Usually, the visual representation of data is easier to remember and understand than the actual numbers. In this example, we will represent in a chart the evolution for a period of five days of the patient’s temperature. In order to do this, first we have to select the data we want to display.

After selecting the data, to create the chart, we use the -“Charts” area form the “Insert” menu bar. For this example, please use the “Line” option, choosing the suggested chart type.

In the end, the following chart will appear on the same worksheet.

10

Page 11: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

The chart is an independent object on the worksheet. It can be moved around, by clicking on it and holding the left mouse button while dragging, or modified in size, by dragging the black control squares it has on the corners and at the middle of each side. In order to modify the chart look or add more elements onto the chart area, MS Excel 2010 uses three special menus that appear only when a chart is selected and are grouped under the “Chart Tools” label, at the far right of the menu bar. These three special menus are called “Design”, “Layout” and “Format”. As an exercise, please use the “Layout” menu to add a text box with a title to the chart, and two text boxes to name the horizontal and vertical axes. You will use the ”Chart Title” button on the “Layout” menu (marked with a red border in the image above), and the “Axis Titles” Button, to add a title for each of the two axis, as described in the following image.

Please write the appropriate texts, so that in the end your chart will look like the model in the next image.

ATTENTION! When creating a chart, you should always write the measuring units for both axes, to make the chart’s meaning easily understandable for anyone. A chart is, in fact, a collection of many graphic elements: text boxes, drawing areas, shapes. Each of them has many properties that can be customized, either by double clicking that element or right clicking it and selecting “Format [element_name]…” from the pop-up menu. Please try to modify as many elements (lines, value markers, titles) from the chart as you can, to see the available options for texts and shapes.

11

Page 12: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

Automatic Fill of an area In order to move on to the next exercise, please choose the second page of the workbook, by pressing the “Sheet 2” button located on the bottom left side of the program window.

To create copies of a value into cells situated around it we can use the “Fill” option from the “Home” menu or we can drag the right bottom corner of that cell, as shown for the automatic copying of functions. For example, if we write the value “1” in the A1 cell, and we want to write the same value into the cells below it, let’s say from A2 to A10, we can select that area plus the original cell (A1:A10), then choose “Fill”-“Down” from the “Home” menu.

35.5

36

36.5

37

37.5

38

38.5

39

39.5

40

4:00 8:00 12:00 16:00 20:00 0:00

Tem

pera

ture

(Cel

sius

deg

rees

)

Time (hours)

Temperature evolution

Monday

Tuesday

Wednesday

Thursday

Friday

12

Page 13: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

If we want to write the same value into cells situated to the side of a certain cell, we should use the “Fill”-“Right” option. Using this command, please fill the area from B1 to C10 with the values that are now written into the A1 to A10 cells. Attention: select the entire A1 to C10 area before issuing the command.

Perform the same operation with some text (e.g. write “a”, “b”, “c”, “d”, “e” into the E1 to E5 cells, then copy them into the F1 to H5 area.

In order to create a series of increasing (or decreasing) values, we will use the “Fill”-“Series” command from the “Home” menu. We will write the first value of the series (i.e. write the value “1” into the K1 cell), then we will choose the command. A new dialog box will appear where we have to choose the direction of the series (“Columns for vertical), the increase value (“Step value”) and the value that should not be exceeded by the series (“Stop value”).

13

Page 14: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

To create a series from 1 to 20 with an increase of 1 from one value to the next, please make choices according to the next images.

The result will be similar to the last image. Please try to create, on the L column, a series of numbers from 0 (write this value in the L1 cell) to 100, the difference between cells being 5. The selections done for the “Fill”-“Series” dialog box should be the following:

and the result will be as seen on the L column from the picture on the right.

14

Page 15: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

There is another way to create a series of consecutive numbers: to write the first two values from the series, in order to let the program understand there is a difference between values, then select both cells and drag the selection by the bottom right corner. This way, the first value won’t be copied in the other cells, but a series will be created, with the step equal to the difference between the two written values. For example, in order to create a series from 10 to 200, with an increase of 10 units between values, we should write the first two values of the series, 10 (into cell M1) and 20 (into cell M2), select both the M1 and M2 cells and drag the bottom right corner of the selection until the value 200 appears. Releasing the mouse button, the required series will appear into the M1:M20 area of the worksheet..

Exercises Exercise 1. Create the graph of the function f(x)=x3+x+1, for the interval [-2;2] To create the graph, we should plot many points that are part of it and unite them. These points are, in fact, the graphical representation of pairs consisting of an “x” value and the value for “f(x)”, computed using the above formula. So, first of all, we have to create o list of values

for x, with a small increase from one to the other, between -2 and 2 – let’s say we’ll use a step of 0.1. Second, we should compute for each “x” value the corresponding “f(x)”. Third, by selecting the list with all the “x” and “f(x)”, we will create a special type of chart, a “XY Scatter” chart, where the points are united by a curved line. To start, move to the 3rd page (choose “Sheet 3” from the bottom left part of the program window), where we will write the first value, -2, in the A1 cell. Then, using “Fill”-“Series” we will make the following choices:

15

Page 16: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

After the entire list will appear, we will write the formula, in order to compute the f(x) value for the first x, located into A1.

Attention: we will replace each “x” from the formula with the name of the cell where the value for s is located. The operator for the power operation is “^”, obtained by pressing Shift+”6”. After we compute the first “f(x)” value, we can copy that formula into the cells below it, until the end of the list with the “x” values is reached.

When both lists are ready, for “x” and “f(x)”, we can select them then create the chart, using the “Insert”-“Chart…” option from the Menu Bar. Attention: instead of selecting all the data, from A1 to B41, it would be easier to select the entire A and B columns, by clicking on the name of the “A” column, holding the left mouse button pressed and moving it on the name of the “B” column, before releasing the mouse button. After you select the data, please use the “Insert” menu to create the appropriate type of chart. For this exercise, you should select a “Scatter” chart, using the version that displays only lines connecting the dots on the chart, without markers for the actual values plotted

16

Page 17: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

A chart similar to the next one should appear on screen.

Using what you previously learned, use the “Layout”menu under “Chart tools”, which shows only when the chart is selected, to add a chart title - “x^3+x+1 Function Chart”, a title for the horizontal axis, with “x” as text, and a title for the vertical axis, with “f(x)” as text. Also, please delete the label “Series 1” on the right part of the chart. In the end, the chart should look like this:

-10

-5

0

5

10

15

-3 -2 -1 0 1 2 3

Series1

-10

-5

0

5

10

15

-3 -2 -1 0 1 2 3

f(x)

x

x^3+x+1 Function Chart

17

Page 18: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

In order to start a new exercise, we need a new page, so we will have to insert another worksheet in the file. This is done using the “Insert”-“Insert Sheet” option from the “Home” menu or the Insert Worksheet” button from the bar witch displays the sheets in the current file, at the bottom of the screen.

Exercise 2. For an overweight patient (120 Kg.), make a table with the weight which they should reach every month, knowing that after 12 months, they must reach 80 Kg. Calculate the monthly percentage decrease. Represent the weight evolution graphically. First you will create a list with the name of the months, as shown in the next picture. Then, next to the first month you will write the initial value of the weight (120) and next to the last month you will write the final value of the weight (80).

The difference between the original and final value must be distributed evenly. For this, select the area from 120 to 80 and then issue the “Fill”-“Series” command from the “Home” menu . In the dialog window displayed, the ”Step value” tab will show a value automatically calculated by Excel, which you do not modify. Press the “OK” button to create the list of weights.

18

Page 19: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

For each month (except for the first one) we have to compute the percentage decrease from the previous month. To do that, we will have to divide the difference by the weight from the previous month and display the result as a percentage. Please, in the C3 cell, corresponding to February, write the formula from the next image then copy the cell’s contents into all the other cells, down to December, as shown in the first image below. To display the results as percentages, please select all the data in the C column, right click on the selection and choose the “Format Cells…” option form the menu.

19

Page 20: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

A new window will appear, with several tabs on the upper region. Select the first tab, “Number” and from the lists it displays choose “Percentage”, without modifying the value on the “Decimal places” text box on the right. To complete the task, press “OK” and the data on the C column will be displayed as percentages.

20

Page 21: PRACTICAL WORK 02 - SPREADSHEETS - Spreadsheets_ MS Excel 2010.pdf · PRACTICAL WORK 02 - SPREADSHEETS ... this because MS Excel has the ability to change the parameters of a formula

To create the weight evolution chart, select the data from the A and B columns and create a Line Chart, in a similar way to the first chart you created, for temperatures, or a you could try to create a Column chart.

21