Week 1 Lab2 Dina A. Said [email protected]. What to be covered today? Wiki Custom calculations If...

26
Week 1 Lab2 Dina A. Said [email protected]

Transcript of Week 1 Lab2 Dina A. Said [email protected]. What to be covered today? Wiki Custom calculations If...

Page 1: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Week 1 Lab2Dina A. Said

[email protected]

Page 2: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

What to be covered today?

WikiCustom calculationsIf statementPivot tablesLookup table

1/21/2009 CPSC203- Week1- Lab2 2

Page 3: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Wikihttp://wiki.ucalgary.caComputer science 203 /CPSC_203_Template

/CPSC 203 Lab Manual for Winter 2009 \Wiki tutorialMisconductAssignmentsLab material

1/21/2009 CPSC203- Week1- Lab2 3

Page 4: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Custom CalculationsCreate your own Functions using “=“

1/21/2009 4CPSC203- Week1- Lab2

Page 5: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 5

Page 6: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 6

Page 7: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 7

Page 8: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 8

Page 9: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 9

Page 10: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 10

Page 11: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 11

Now, calculate the average of each subject :

* Using AVERGAE implied

function* Using custom

calculations (sum/count)

Page 12: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 12

Page 13: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 13

Page 14: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Order of CalculationsMultiplication, DivisionAddition, Subtraction

Example:2+3*5 = 2+ (3*5) 2/3+5= (2/3)+5

Use brackets if you are confused

1/21/2009 CPSC203- Week1- Lab2 14

Page 15: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

If-Then Statement3 parts:

Logical testTrue statementFalse statement (optional)

Example:*If Mary’s Mark in subject1 > 60* Then, She passed* Else, She failed

1/21/2009 CPSC203- Week1- Lab2 15

Page 16: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Formula=IF(<logical statement>, <true statement>, <false

statement>)Example:

=IF(B4>60,"pass","fail")

Note: If your result is string or you are testing string, you should use “”

1/21/2009 CPSC203- Week1- Lab2 16

Page 17: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 17

Page 18: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 18

Page 19: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Think how to make if statement for subject 2 using Insert Function

1/21/2009 CPSC203- Week1- Lab2 19

Page 20: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

What is the best way to apply the function for subject 3 as well?

What if we want the test to be

Greater than or equal

1/21/2009 CPSC203- Week1- Lab2 20

Page 21: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Nested If StatementIf subject1 >= 90

Then, AElse If subject2 >=70

Then, B Else C

=IF(B4>=90,"A", IF(B4>=70,"B", “C"))

1/21/2009 CPSC203- Week1- Lab2 21

Page 22: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

1/21/2009 CPSC203- Week1- Lab2 22

Page 23: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Pivot tablesTo summarize data in understanding manner

1/21/2009 CPSC203- Week1- Lab2 23

Page 24: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Pivot tables (cont.)Choose tab insert pivot table Choose the rangChoose where to put the tableSelect data of interestDrag which to be in rows and which to be in columnsSelect the calculation to be performed; Max, Average,

etc..

1/21/2009 CPSC203- Week1- Lab2 24

Page 25: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

Lookup tablesSometimes, we have a code that we want it to be replaced

with a value

1/21/2009 CPSC203- Week1- Lab2 25

=LOOKUP(B4,F3:G7)

Page 26: Week 1 Lab2 Dina A. Said dasaid@ucalgary.ca. What to be covered today? Wiki Custom calculations If statement Pivot tables Lookup table 1/21/2009CPSC203-

VLookupSearching for a certain text, e.g. student ID

1/21/2009 CPSC203- Week1- Lab2 26

We want to lookup student with Id 3000=VLOOKUP(3000,A5:B9,2)

Formula: VLOOKUP(Value, table, column Index)