cs 105 – fall 20091 cs105 lab 2 – introduction to excel announcements: midterm 1 on sept. 29 th...

23
CS 105 – Fall 2009 1 CS105 Lab 2 – Introduction to Excel Announcements: Midterm 1 on Sept. 29 th Watch website for info. on conflict exam

Upload: harry-jennings

Post on 28-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

CS 105 – Fall 2009 1

CS105 Lab 2 – Introduction to Excel

Announcements: Midterm 1 on Sept. 29th

Watch website for info. on conflict exam

CS 105 – Fall 2009 2

Objectives

Understand cells and ranges Understand the difference between

absolute and relative cell reference Use the fill handle Use functions in Excel Know the difference between copy,

paste and fill

CS 105 – Fall 2009 3

Download the File

Open a web-browser. Go to course website

Click on “Lab Discussion Slides” Right-click on Excel Worksheet for Lab 2.

Choose “Save Link As” or “Save Target As” and save it on your desktop.

CS 105 – Fall 2009 4

A Spreadsheet

cell reference

cell contents

Range of cells: click and drag over selected area

B7:D7

CS 105 – Fall 2009 5

Entering Formulas

Enter a formula in cell E7 to calculate the total points the student has earned

Formula always start with = There are several ways to write this formula One way is:

=B7 + C7 + D7 Another way is:

= sum(B7:D7)

operators

a function

CS 105 – Fall 2009 6

Copying Formulas

Copy the formula in cell E7 to the cell just below it (use Ctrl-C to copy and Ctrl-V to paste) What happens? Why?

You can check formula in E8 in two ways: Click on a cell. Look OR Press Ctrl-~ to at the formula field. see formulas in all cells

Formula mode

CS 105 – Fall 2009 7

Copying Formulas using fill handle

Now copy the formula in cell E8 to the cells E9:E11 (this time, use the fill handle: click on it, hold, and drag it down three cells.)

CS 105 – Fall 2009 8

More Formulas

Now, enter a formula in cell F7 to calculate the grade value. Use the total points in cell B16. (You want to divide the total points earned by the total points possible) =E7/B16

NOTE: You might think of using the average function here, but it will not work if the tests have different weights, which is actually the case

CS 105 – Fall 2009 9

Copying Formulas Again

Now, copy the formula in cell F7 to cells F8:F11

What happens? Why? How can we change the formula so this

doesn’t happen?

CS 105 – Fall 2009 10

Cell References

By default, Excel adjusts cell references in a formula when the formula is copied and pasted

The cell references will be changed by the same number of rows and columns that you moved the formula

If you want the row or column to stay the same, put a dollar ($) sign in front of it

CS 105 – Fall 2009 11

Correct Version

Use Ctrl-Z to Undo the Fill-Handle operation in cells F8:F11

Put the formula in cell F7= E7 / $B$16

Then copy to or fill in the cells below it

Is the first dollar sign necessary?

CS 105 – Fall 2009 12

Calculating Average Scores

To calculate average in cell B14, enter the formula

= Average(B7:B11) Copy cell B14 to the four adjacent cells

to the right. (C14:F14)

Or use fill handle, but this time horizontally

CS 105 – Fall 2009 13

Highest and Lowest Scores

In cells B19:F20 we need to compute the lowest and the highest grades respectively.

How you will do this?

Min and Max functions to calculate the minimum and maximum of a range of values. =MIN(B7:B11) =MAX(B7:B11)

CS 105 – Fall 2009 14

Why Spreadsheets?

Suppose the total points for the semester is changed to 360.

Put 360 in cell B16. Notice how all the other numbers are

automatically recalculated.

CS 105 – Fall 2009 15

How do Cell References Change?

RelativeC2A1

Mixed$A2$A1

MixedC$1A$1

Absolute$A$1$A$1

Reference Type

Copied to D4

Reference in B3

CS 105 – Fall 2009 16

More on Fill Handle

Filling a sequential numbers Put 1 on H1 Put 2 on H2 Select H1:H2 Drag the fill handle down to H5 What happens?

Try again with 1 on H1 and 3 on H2 “Test1” on H1 and “Test2” on H2 “1-May” on H1, “1-Jun” on H2

Clickhere

draghere

SelectH1,H2

CS 105 – Fall 2009 17

More on Fill Handle

Fill Handle works with: Numeric data, e.g. 1,2,3,… or 1,3,5,… Time, e.g. 10:00, 11:00, 12:00,… Dates, 1-May, 1-Jul, 1-Sep,… Currency….

CS 105 – Fall 2009 18

Move, Copy, & Fill

Operation Move(Cut & Paste)

Copy Fill

Keystrokes Ctrl-X + Ctrl-V Ctrl-C + Ctrl-V Click and drag the fill handle

Source cell Is emptied after the Cut

Remains the same

Remains the same

Destination cell

Contains data from source cell after paste

Contains data* from source cell after paste

Contains data* from source cell after fill

*Cell data in these operations may have been altered. See next slide for details on how the data might be altered.

CS 105 – Fall 2009 19

Move, Copy, & Fill (continued)

Cell content

Move(Cut & Paste)

Copy Fill

Formulas Remain the Same

Are altered based on cell reference.

Are altered based on cell reference.

Dates Remain the same

Remain the same

Are incremented by 1 day

Text Remains the same

Remains the same

Remains the same

What you should know

What is an Formula and How to enter one in Excel

Functions in Excel like Sum, Average, Min, Max

How does using $C$2 differ from using C2 in a formula if we copy the formula across cells?

How to use Fill handle? Differences when we use Cut, Copy or

Fill. 20CS 105 – Fall 2009

Additional Exercises (see handout)

Suppose each of the following formulas was entered into cell A1, and then cell A1 was then copied and pasted (Ctrl-C, Ctrl-V) into cell C4. What would the resulting formula be in cell C4 (keep in mind that Excel updates the formula)?  

= B1 = $B1 = B$1 =$B$1 =AVERAGE($B1:$B3)

What would the answers be if the cells were instead cut and then pasted (Ctrl-X, Ctrl-V)?

CS 105 – Fall 2009 21

Exercises

What is wrong with the following formula?

 = ADD(B5:B9)

CS 105 – Fall 2009 22

Write a formula for cell B8 that will compute the total number of points the student has earned in the class. Use a range.

Practice functions

Go to the Practice Worksheet. You cell C9 to be the average of the sum of money spent in each month. How would you do it?

Method 1 : Step by step calculation. Enter =SUM(C2:C7) in cell C8. Fill D8 and E8 Enter =AVERAGE(C8:E8) in cell C9.

Can we avoid “wasting” cells to compute the SUM? Method 2 : Use nested functions

Stay tuned for next lab

23CS 105 – Fall 2009