relative addresses:

27
Relative Addresses: After I enter =B2/52 in cell C2 and then drag it down the C column to the last row what formula would I see in cell C5 if I clicked on it? A B C 1 PID (faked) Poin ts Percen t 2 3587590 50 0.962 3 5807324 44 4 6920770 32 5 6930839 44 A)=B2/52 B)=B2/55 C)=B5/52 D)=B5/55

Upload: clem

Post on 16-Feb-2016

48 views

Category:

Documents


0 download

DESCRIPTION

Relative Addresses: . After I enter =B2/52 in cell C2 and then drag it down the C column to the last row what formula would I see in cell C5 if I clicked on it?. =B2/52 = B 2/55 = B 5/52 = B 5/55. Conditional/If Function: . - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Relative Addresses:

Relative Addresses:

After I enter =B2/52 in cell C2 and then drag it down the C column to the last row what formula would I see in cell C5 if I clicked on it?

A B C1 PID (faked) PointsPercent2 3587590 50 0.9623 5807324 44 4 6920770 32 5 6930839 44

A) =B2/52B) =B2/55C) =B5/52D) =B5/55

Page 2: Relative Addresses:

Conditional/If Function: What would be the correct function to type into cell C2 to indicate either “passed” or “failed”. Assume anyone who earned more than 30 pts passed. A B C

1 PID (faked) PointsPassed?2 3587590 503 5807324 44 4 6920770 32 5 6930839 44

A) =IF(B2>30,”passed”,”failed”)B) =IF(B2>=30,”passed”,”failed”)C) =IF(B2>30,”failed”,”passed”)D) =IF(B2>=30,”failed”, “passed”

Page 3: Relative Addresses:

The COUNT function counts the number of cells in a range with numerical data in them

• What does the COUNTA function return in this case? =COUNTA(A2:C5)

A B C1 PID (faked) Points Passed2 3587590 50passed3 5807324 44passed4 6920770 32 passed5 6930839 44 passed

A) 4B) 8C) 12D) None of the above

Page 4: Relative Addresses:

Relative AddressingCopy A2 into D2 and into B3:

What formula would be in each?

D2 B3

A =A1-11 =A1-11B =D1-11 =B1-11C =D1-11 =B2-11

A B C D1 33 44 55 662 =A1-11345

Page 5: Relative Addresses:

Excel: Formulas and Functions

• Data (and increasingly large amounts of it) permeates our society and our disciplines– Those who can leverage computational tools and techniques

for analyzing it will be primed to make contributions• Excel is an amazingly powerful tool for– Data analysis– Data visualization

• We’ll find a new level of “understanding” of many Excel tools given our understanding of core computing concepts gained in Alice

Page 6: Relative Addresses:

Working Example:CSE3 grades in Excel

• Many profs keep track of grades in excel– Scantron form scanned, emailed as CSV (comma

separated value), which is imported to Excel (chapter 3)

– Each row has 2 entries*• Student PID• Number of points

*Actually I get the direct scans and do my own grade calculations, so I can give partial credit… more later

Page 7: Relative Addresses:

An Example of a Common Organization

• National Data Buoy Center: – Station 46410 (LLNR 984.6) - 330 NM Southeast

of Anchorage, AK#YY MM DD hh mm ss T HEIGHT#yr mo dy hr mn s - m2010 11 18 12 00 00 1 3728.2432010 11 18 11 45 00 1 3728.3032010 11 18 11 30 00 1 3728.3702010 11 18 11 15 00 1 3728.4412010 11 18 11 00 00 1 3728.5212010 11 18 10 45 00 1 3728.6012010 11 18 10 30 00 1 3728.681

Page 8: Relative Addresses:

Faked: Dental DataLast Name First Name Insurance # Contact Phone Last Cleaning

Ramirez Jose 1234455 555-555-5555 10/26/09

Song Sally 1234567 555-555-5554 8/29/10

Page 9: Relative Addresses:

Faked: UCSD Class ListsLastName, FirstName

PID College Email Staus

Smith, Tanya Ann

A09999999 SI ssmith1@u csd.edu

FR

Alvarado, Maria

A011111111 FI [email protected]

SO

Page 10: Relative Addresses:

What BEST explains in English the “purpose” of this formula?

A. It generates the values 22, 33, 44 and 55 B. It generates a value which is 11 less than the top value in that

columnC. It generates a value which is 11 less than the value in the cell

directly above itD. None of the above

A B C D1 33 44 55 662 =A1-11345

Page 11: Relative Addresses:

Absolute Reference:Uses in grading CSE3 midterms

• Keeping the “total number of points” – Rather than “hard coding” the number 52 in the

equation, it should always use the number in B2• Easy for someone “looking” at the sheet to see the max

points

A B C1 522 PID (faked) PointsPercent3 3587590 50 =B3/524 5807324 44 5 6920770 32

Let’s Change this

Page 12: Relative Addresses:

What would be the right formula: Given I want to be able to copy/drag it into ANY column on the sheet and get

the grade for that row

A. =B3/B$1B. =B3/$B$1C. =$B3/B$1D. =$B3/$B$1

A B C1 522 PID (faked) PointsPercent3 3587590 50 =B3/524 5807324 44 5 6920770 32

Let’s Change this

Page 13: Relative Addresses:

More CSE3 Midterm Analysis:How many people picked a specific distractor

• Count of each item (A-E) in a column– I’ll enter into B6:= COUNTIF(B$2:B$4,=“A”)

I want to drag it down over the next three rowsand then just change Ato B, or C or D(less typing)

A B C1 PID (faked) Q1 Q22 3587590 A D3 5807324 C D4 6920770 A B56 Count of As7 Count of Bs8 Count of Cs9 Count of Ds

Page 14: Relative Addresses:

Why do I use absolute addressing for the ROW?

A. Because you want to be able to easily drag this equation across all the columns (questions on exam) without having to change it

B. Because you want tomake sure it alwaysperforms COUNTAon rows 2-4

C. I don’t know

A B C1 PID (faked) Q1 Q22 3587590 A D3 5807324 C D4 6920770 A B56 Count of As7 Count of Bs8 Count of Cs9 Count of Ds

= COUNTIF(B$2:B$4,”=A”)In B6

Page 15: Relative Addresses:

In Excel, a relative reference (no $) (compared to an absolute reference (with $))…

A. Keeps the same row, column reference when you copy it into another cell

B. Changes the row, column reference when you copy it into another cell, based on the value in the original cell

C. Changes the row, column reference when you copy it into another cell, based on the location of the new cell compared to the old one

Page 16: Relative Addresses:

Absolute Addressing is useful for

A. When you want to always reference the same column, no matter where you copy it

B. When you want to always reference the same row, no matter where you copy it

C. When you always want to reference the same cell, no matter where you copy it

D. More than one of the above is true

Page 17: Relative Addresses:

Suppose I have two classes grades, in different sheets

• I find the average in the first class (Sheet1: B5)• Then I’ll copy that over to (Sheet2: B4) so I’ll have the

average grade for that class as well

A B1 PID Points2 55555 523 44444 484 33333 505 =AVERAGE(B2:B4)

A B1 PID Points2 99999 403 88888 384 5

Page 18: Relative Addresses:

What is in B4 in Sheet2?

A. 39B. 50C. 78

A B1 PID Points2 55555 523 44444 484 33333 505 =AVERAGE(B2:B4)

A B1 PID Points2 99999 403 88888 384 5

D. Excel gives an errorE. None of the above

Page 19: Relative Addresses:

Which of the following would cause a circular reference if I entered it in B2 and dragged it across row 2?

A. =B1+B3B. =A2+C2C. Neither of thoseD. Both of those

A B C D12345

Page 20: Relative Addresses:

Assume this function is put into I1 and then copied down to I4, =IF(H1="OK",G1+$F$1,G1-F1)

• What is in Cell I3?

A. 2B. 5C. 9D. 15

Page 21: Relative Addresses:

Assume this function is put into I1 and then copied down to I4, =IF(H1="OK",G1+$F$1,G1-F1)

• What is in Cell I4?

A. 2B. 5C. 12D. 15

Page 22: Relative Addresses:

Assigning points with If commands

Page 23: Relative Addresses:

What is the correct formula to use

• For Question 1– D was worth 2 points– C was worth 1 point– Others worth 0 points

A. =IF(B3=“D”,2), IF(B3=“C”,1,0))B. =IF(B3=“D”,2,IF(B3=“C”,1,0))C. =IF(B3=“C”,1,IF(B3=“D”,2,0))D. More than one of the aboveE. None of the above

Page 24: Relative Addresses:

Match your PID (from scantron) to name (from classlist)

• In one sheet, I have the midterm scanned data– I’ve used if statements to assign points per question and

summed them to get exam points• In another sheet I have the downloaded class roster – (which usually has some people who didn’t take the

exam – not the same number of rows)– It has PID and Name on each row

• Goal: Add a column in midterm sheet with the matching name for each student

Page 25: Relative Addresses:
Page 26: Relative Addresses:

What commands would you use to fill A3?

A. An IF commandB. An IF command with nested IFsC. A VLOOKUP commandD. A VLOOKUP command with an IF nested in itE. A COUNTA function

Page 27: Relative Addresses:

To calculate A3= VLOOKUP(B3,classList!A$1:B$572,2,TRUE)

For all items_in_classList_ColA one at a time If item_in_classList_ColA == midterm!B3 midterm!A3’s value is classList!B(index) else Do Nothing