Lecture # 8 Spreadsheets II: Numeric Functions and Data Management
description
Transcript of Lecture # 8 Spreadsheets II: Numeric Functions and Data Management
Lecture # 8Spreadsheets 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
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
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
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
Spreadsheet Numeric Functions
Functions
Simple functions
• Array functions
• IF - logical functions
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) )
Using functions
Using functions
Finding functions
Finding functions
Finding functions
Finding functions
Finding functions
Finding functions
Functions
• Simple functions
Array functions
• IF - logical functions
Sum
Count
Average
Other array functions
• Min
• Max
• Stdev - standard deviation
• Median
• Product - multiply them all together
Functions
• Simple functions
• Array functions
IF - logical functions
If – Logical Functions and Branching
• If ( test, trueVal, falseVal)
AND
IF with AND
Review
• Functions - name with arguments– Finding functions
• Array functions– Sum(B6:D32)– Average(F14:R75)
• IF - AND - OR
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
Spreadsheet Data Management
Data management
• Index/Lookup functions
• Sorting
• Charts
Index Demo
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
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
Index function
• DayNames = Sheet[C2:C8]• DayNumber = WEEKDAY(B2)• Sheet[B3] = DayNames[DayNumber,1]
Match function
Match Demo
Lookup Function
Lookup Function
How much time? 5, 50, 50000
Lookup Demo
Sorting
Ascending - smallest to largest
item[i]<=item[i+1]
Descending - largest to smallest
item[i]>=item[i+1]
Sort Demo
• Simple sort buttons
• Sort menu item– Data -> Sort
• Ward list– Name, apartment, dates last month
Charts
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
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?
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
Spreadsheet “Programs”
• What is the “Program” behind the scenes
that makes a spreadsheet function work?
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 0R ?C ?
Sum 0R 1C ?
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 0R 1C A
Sum 23R 1C A
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 23R 1C B
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 47R 1C B
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 47R 2C B
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum -31R 2C A
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum -31R 2C B
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 1213R 2C B
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 1213R 3C B
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 1213R 3C A
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 1236R 3C A
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 1236R 3C B
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 1256R 3C B
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Sum 1256R 3C B
Sum program
Sum=0;
for (each row R)
{ for (each column C in row R)
{ Sum=Sum+Sheet[R, C]; }
}
Count programCount=0;
for (each row R)
{
for (each column C in row R)
{
Count=Count+1;
}
}
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;
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?
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