Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

65
Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

description

Lecture # 8 Spreadsheets II: Numeric Functions and Data Management. Today. Questions : From notes/reading/life? Cool spreadsheet functions you discovered? 1. Introduce : Can spreadsheets help with my credit problems? 2. Explain : Numeric Functions: Logical Functions, Branching - PowerPoint PPT Presentation

Transcript of Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Page 1: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Lecture # 8Spreadsheets II:

Numeric Functions and Data Management

Page 2: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

TodayQuestions: From notes/reading/life?

Cool spreadsheet functions you discovered?

1. Introduce: Can spreadsheets help with my credit problems?

2. Explain: Numeric Functions: Logical Functions, Branching

Data Management: Indexing, Look-Up, Charts

3. Demo: Spreadsheet Magic – follow along on laptop

4. Practice: Your Group solves a problem with a spreadsheet

5. Evaluate: Share and evaluate your solution• Re-practice: Calculate monthly payments with a spreadsheet

Understand: What is the “Program” or Algorithm behind the

Scenes that makes the function work?

Do Homework # 3

Page 3: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

TodayQuestions: From notes/reading/life?

Cool spreadsheet functions you discovered?

1. Introduce: Can spreadsheets help with my credit problems?

2. Explain: Numeric Functions: Logical Functions, Branching

Data Management: Indexing, Look-Up, Charts

3. Demo: Spreadsheet Magic – follow along on laptop

4. Practice: Your Group solves a problem with a spreadsheet

5. Evaluate: Share and evaluate your solution• Re-practice: Calculate monthly payments with a spreadsheet

Understand: What is the “Program” or Algorithm behind the

Scenes that makes the function work?

Do Homework # 3

Page 4: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

TodayQuestions: From notes/reading/life?

Cool spreadsheet functions you discovered?

1. Introduce: Can spreadsheets help with my credit problems?

2. Explain: Numeric Functions: Logical Functions, Branching

Data Management: Indexing, Look-Up, Charts

3. Demo: Spreadsheet Magic – follow along on laptop

4. Practice: Your Group solves a problem with a spreadsheet

5. Evaluate: Share and evaluate your solution• Re-practice: Calculate monthly payments with a spreadsheet

Understand: What is the “Program” or Algorithm behind the

Scenes that makes the function work?

Do Homework # 3

Page 5: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

TodayQuestions: From notes/reading/life?

Cool spreadsheet functions you discovered?

1. Introduce: Can spreadsheets help with my credit problems?

2. Explain: Numeric Functions: Logical Functions, Branching

Data Management: Indexing, Look-Up, Charts

3. Demo: Spreadsheet Magic – follow along on laptop

4. Practice: Your Group solves a problem with a spreadsheet

5. Evaluate: Share and evaluate your solution• Re-practice: Calculate monthly payments with a spreadsheet

Understand: What is the “Program” or Algorithm behind the

Scenes that makes the function work?

Do Homework # 3

Page 6: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Spreadsheet Numeric Functions

Page 7: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Functions

Simple functions

• Array functions

• IF - logical functions

Page 8: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Function notation

• A function is a piece of computation that takes 1 or more arguments (data) and returns a value

• Function( arg1, arg2, arg3 )– Sine(90)– Max(100,200,120,-7)– Sqrt( min(7+4, 9) )

Page 9: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Using functions

Page 10: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Using functions

Page 11: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Finding functions

Page 12: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Finding functions

Page 13: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Finding functions

Page 14: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Finding functions

Page 15: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Finding functions

Page 16: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Finding functions

Page 17: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Functions

• Simple functions

Array functions

• IF - logical functions

Page 18: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum

Page 19: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Count

Page 20: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Average

Page 21: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Other array functions

• Min

• Max

• Stdev - standard deviation

• Median

• Product - multiply them all together

Page 22: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Functions

• Simple functions

• Array functions

IF - logical functions

Page 23: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

If – Logical Functions and Branching

• If ( test, trueVal, falseVal)

Page 24: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

AND

Page 25: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

IF with AND

Page 26: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Review

• Functions - name with arguments– Finding functions

• Array functions– Sum(B6:D32)– Average(F14:R75)

• IF - AND - OR

Page 27: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

TodayQuestions: From notes/reading/life?

Cool spreadsheet functions you discovered?

1. Introduce: Can spreadsheets help with my credit problems?

2. Explain: Numeric Functions: Logical Functions, Branching

Data Management: Indexing, Look-Up, Charts

3. Demo: Spreadsheet Magic – follow along on laptop

4. Practice: Your Group solves a problem with a spreadsheet

5. Evaluate: Share and evaluate your solution• Re-practice: Calculate monthly payments with a spreadsheet

Understand: What is the “Program” or Algorithm behind the

Scenes that makes the function work?

Do Homework # 3

Page 28: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Spreadsheet Data Management

Page 29: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Data management

• Index/Lookup functions

• Sorting

• Charts

Page 30: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Index Demo

Page 31: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

TodayQuestions: From notes/reading/life?

Cool spreadsheet functions you discovered?

1. Introduce: Can spreadsheets help with my credit problems?

2. Explain: Numeric Functions: Logical Functions, Branching

Data Management: Indexing, Look-Up, Charts

3. Demo: Spreadsheet Magic – follow along on laptop

4. Practice: Your Group solves a problem with a spreadsheet

5. Evaluate: Share and evaluate your solution• Re-practice: Calculate monthly payments with a spreadsheet

Understand: What is the “Program” or Algorithm behind the

Scenes that makes the function work?

Do Homework # 3

Page 32: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Group Exercise: What Day were You Born?

• Using the functions Index and Weekday, discover which day (Sunday – Saturday) you were born.

• Do this for each member of your group.

• Which day of the week did the 9/11/2001 attack occur?

• You have 10 minutes

Page 33: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Index function

• DayNames = Sheet[C2:C8]• DayNumber = WEEKDAY(B2)• Sheet[B3] = DayNames[DayNumber,1]

Page 34: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Match function

Page 35: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Match Demo

Page 36: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Lookup Function

Page 37: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Lookup Function

How much time? 5, 50, 50000

Page 38: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Lookup Demo

Page 39: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sorting

Ascending - smallest to largest

item[i]<=item[i+1]

Descending - largest to smallest

item[i]>=item[i+1]

Page 40: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sort Demo

• Simple sort buttons

• Sort menu item– Data -> Sort

• Ward list– Name, apartment, dates last month

Page 41: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Charts

Page 42: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

TodayQuestions: From notes/reading/life?

Cool spreadsheet functions you discovered?

1. Introduce: Can spreadsheets help with my credit problems?

2. Explain: Numeric Functions: Logical Functions, Branching

Data Management: Indexing, Look-Up, Charts

3. Demo: Spreadsheet Magic – follow along on laptop

4. Practice: Your Group solves a problem with a spreadsheet

5. Evaluate: Share and evaluate your solution• Re-practice: Calculate monthly payments with a spreadsheet

Understand: What is the “Program” or Algorithm behind the

Scenes that makes the function work?

Do Homework # 3

Page 43: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Homework #3: What is Your Payment?

• You want to buy a car for $10,000 and you want to pay it off in 3 years. You can get a loan for 4%

annual interest. Use a spreadsheet function to calculate your monthly payment.

• Let’s say that the maximum monthly payment you can afford is $200 a month. How long will it take you to pay off the car?

• Let’s say you are stuck with 4% annual interest and 3 years. How expensive of a car can you afford?

Page 44: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

TodayQuestions: From notes/reading/life?

Cool spreadsheet functions you discovered?

1. Introduce: Can spreadsheets help with my credit problems?

2. Explain: Numeric Functions: Logical Functions, Branching

Data Management: Indexing, Look-Up, Charts

3. Demo: Spreadsheet Magic – follow along on laptop

4. Practice: Your Group solves a problem with a spreadsheet

5. Evaluate: Share and evaluate your solution• Re-practice: Calculate monthly payments with a spreadsheet

Understand: What is the “Program” or Algorithm behind the

Scenes that makes the function work?

Do Homework # 3

Page 45: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Spreadsheet “Programs”

• What is the “Program” behind the scenes

that makes a spreadsheet function work?

Page 46: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Sum 0R ?C ?

Page 47: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 0R 1C ?

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 48: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Sum 0R 1C A

Page 49: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 23R 1C A

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 50: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 23R 1C B

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 51: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 47R 1C B

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 52: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 47R 2C B

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 53: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum -31R 2C A

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 54: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum -31R 2C B

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 55: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 1213R 2C B

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 56: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 1213R 3C B

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 57: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 1213R 3C A

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 58: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 1236R 3C A

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 59: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 1236R 3C B

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 60: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 1256R 3C B

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 61: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Sum 1256R 3C B

Sum program

Sum=0;

for (each row R)

{ for (each column C in row R)

{ Sum=Sum+Sheet[R, C]; }

}

Page 62: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Count programCount=0;

for (each row R)

{

for (each column C in row R)

{

Count=Count+1;

}

}

Page 63: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Average programSum=0;Count = 0;for (each row R)

{ for (each column C in row R) { Sum=Sum+Sheet[R,C];

Count = Count+1;}

}Average = Sum/Count;

Page 64: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Match algorithm

DayNames = Sheet[C2:C8];

for (i=0; i<sizeof(DayNames); i=i+1)

{

if (DayNames[i] == Sheet[B3]) return i+1;

}

What is the average time to do this function?N = 50?N=50000?

Page 65: Lecture # 8 Spreadsheets II: Numeric Functions and Data Management

Spreadsheets

• Spreadsheet is an array of values and expressions• Reevaluate every expression for every change• Number overflow/underflow• Functions - name(arg1, arg2, arg3)• Array functions - sum, average, count• Data functions - match, vlookup• Sorting• Charts