http://web.cse.ohio-state.edu/~ricel/ 1. common functions 2

49
http://web.cse.ohio-state.edu/ ~ricel/ 1

Upload: scot-thomas

Post on 11-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

1

http://web.cse.ohio-state.edu/~ricel/

http://web.cse.ohio-state.edu/~ricel/

Page 2: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

2

Common Functions

Page 3: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

3

Round FunctionSyntax: =ROUND(number, num_digits)

number: Number to be rounded

num_digits: Number of decimal places

Round to: digit Formula Resultnearest whole number 0 =ROUND(2738.252,0) 2,738.000nearest tenth 1 =ROUND(2738.252,1) 2,738.300nearest hundreth 2 =ROUND(2738.252,2) 2,738.250

nearest tens -1 =ROUND(2738.252,-1) 2,740.000nearest hundreds -2 =ROUND(2738.252,-2) 2,700.000

Page 4: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

4

Page 5: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

5

Type in Function or use the Function Wizard

• Function wizard: A short-cut to all the functions in excel (use fx toolbar button) that walks you through building a function

Page 6: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

6

Copying Formulas withRelative cell referencing

• Automatically adjusts formula cell references when formula is copied.

Page 7: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

7

Copying Formulas withMixed cell referencing

Keeps the column or the row reference in the formula the same when copying the formula (Signified by $)

Page 8: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

8

Copying Formulas withAbsolute cell referencing

Keeps the column and the row reference in the formula the same when copying the formula (Signified by $ in front of column and row)

Page 9: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

9

Hard Coding values

Typing in the value in a formula or function instead of a cell reference• What if service charge changes to 8%?

Page 10: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

10

Named Ranges

You can name a cell or a group of cells and use that name in your formulas.• Treated as an absolute cell reference

Page 11: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

11

COUNTIF FUNCTION

Counts the number of items in a range that meet a specific criteria

=COUNTIF(range, criteria)

• Range: A continuous range• Criteria: Determines what cells to count

Criteria Criteria Syntax Example

Number Type in number =COUNTIF(C1:C10,5)

Text Surround text in quotes =COUNTIF(E1:E10,”USA”)

Cell Reference Type in cell reference =COUNTIF(G1:G10,A2)

“Hard Coded” Boolean Expression

Surround Boolean expression in quotes =COUNTIF(I1:I10,”>=5”)

Cell Reference Boolean Expression

Surround Boolean expression in quotes and type & before the cell reference

=COUNTIF(K1:K10, “>=” &A5)

Wild Card Use Asterisk =COUNTIF(M1:M10,”USA*”)

Page 12: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

12

Page 13: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

13

Page 14: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

14

Page 15: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

15

COUNTIFS FUNCTION

Counts the number of items in a range (using multiple criteria and multiple ranges) that meet a specific criteria

• All criterion must be true in order for the cell to be counted

=COUNTIFS(criteria_range1, criteria1,[criteria_range2,criteria2], …)

• Criteria_range1: A continuous range• Criteria1: Determines what cells to count

• Syntax rules the same as COUNTIF

Page 16: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

16

Page 17: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

17

SUMIF/AVERAGIF FUNCTIONS

Sums the number of items in a range that meet a specific criteria

=SUMIF(criteria_range, criteria,[sum_range])

Averages the number of items in a range that meet a specific criteria

=AVERAGEIF(criteria_range, criteria,[average_range])

• Criteria_Range: A continuous range• Criteria: Determines what cells to sum• Sum_Range: If criteria is met, the computer will sum the

corresponding entry in this range• Same criteria syntax as COUNTIF• If a sum_range argument is not used, the sum_range will be the same

as the criteria_range

Page 18: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

18

Page 19: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

19

Page 20: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

20

SUMIFS/AVERAGEIFS FUNCTIONs

Sums a range (using multiple criteria and multiple ranges) that meet a specific criteria

• All criterion must be true in order for the cell to be summed

=SUMIFS(sum_range, criteria_range1,criteria1,[criteria_range2,criteria2], …)

Averages a range (using multiple criteria and multiple ranges) that meet a specific criteria

=AVERAGEIFS(average_range, criteria_range1,criteria1[criteria_range2,criteria2], …)

• Sum_Range: Range to sum if criterion are met• Criteria_Range1: Range of first criteria• Criteria1: Criteria for range1• Criteria syntax rules the same as COUNTIF

Page 21: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

21

Page 22: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

22

IF FUNCTION

Checks to see if a condition is true or false. If true one thing happens, if false another thing happens

• IF this is true, do this, else do this.

=IF(logical test, value_if_true, [value_if_false])

• Logical test must evaluate to true or false

Page 23: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

23

Page 24: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

24

NESTED IF

• IF this is true, do this, else IF this is true, do this, else, do this.

=if(this = true, do this, else if(this = true, do this, otherwise do this))

• Can be nested up to 64 times.

Page 25: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

25

Assume no student has the same score.

Page 26: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

26

IF with a range

Page 27: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

27

Using Boolean functions

=AND(logical1, [logical2], …)• Returns true if all arguments evaluate to true

=OR(logical1, [logical2], …)• Returns true if at least one argument evaluates to true

=NOT(logical)• Changes false to true and true to false

Page 28: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

28

Scores

Statistics

Page 29: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

29

Write a formula in cell Statistics!F2 to determine T/F if everyone passed the class. (A passing score is 320)

=AND(Scores!E5>=Scores!B2,Scores!E6>=Scores!B2,Scores!E7>=Scores!B2)

Page 30: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

30

Write a formula in cell Statistics!F3 to determine T/F if all the students are honors students.

Page 31: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

31

Write a formula in cell Statistics!F4 to determine T/F if Led Zeppelin’s total score and Rob Thomas’ total score

is greater than Rascal Flat’s total score.

Page 32: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

32

Write a formula in cell Statistics!F5 to determine T/F if as least one person passed the class.

=OR(Scores!E5>=Scores!B2,Scores!E6>=Scores!B2,Scores!E7>=Scores!B2)

Page 33: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

33

Write a formula in cell Statistics!F6 to determine T/F if at least one person is an honors student.

Page 34: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

34

Scores

New Stats

Page 35: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

35

Write a formula in cell New Stats!F2 to determine if everyone passed the class. (A passing score is 320)

Display the text, “Everyone”, or “Not Everyone”

=IF(AND(Scores!E5>=Scores!B2,Scores!E6>=Scores!B2,Scores!E7>=Scores!B2),"Everyone", "Not Everyone")

Page 36: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

36

Write a formula in cell New Stats!F3 to determine if all the students are honors students.

Display the text, “All Honor Students”, or “Not Everyone is an Honor’s student”

=IF(AND(Scores!F5:F7),"All Honor Students", "Not Everyone is an Honors student")

Page 37: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

37

Write a formula in cell New Stats!F4 to determine if Led Zeppelin’s total score and Rob Thomas’ total score

is greater than Rascal Flat’s total score.Display the text, “Led and Rob”, or Rascal”

=IF(AND(Scores!E5>Scores!E7,Scores!E6>Scores!E7), "Led and Rob", "Rascal")

Page 38: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

38

Write a formula in cell New Stats!F5 to determine if at least one person passed the class.

Display the text, “At least one passed” or “No One passed”

=IF(OR(Scores!E5>=Scores!B2,Scores!E6>=Scores!B2,Scores!E7>=Scores!B2),"At least one passed", "No One passed")

Page 39: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

39

Write a formula in cell New Stats!F6 to determine if at least one person is an honors student.

Display the text, “At least one Honors student”, or “No Honor students”)

=IF(OR(Scores!F5:F7),"At least one Honors student", "No Honor students")

Page 40: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

40

VLOOKUP/HLOOKUP

Finds an entry from a vertical array (table) based on a criteria

=VLOOKUP(lookup_value,table_array,col_index_num,[range_lookup])

Finds an entry from a horizontal array based on a criteria

=HLOOKUP(lookup_value,table_array,row_index_num,[range_lookup])

• lookup_value: criteria to lookup or “match”

• table_array: the range or boundary of your table (excluding headings)

• col_index_num: the column number in your range that contains the corresponding data

• range_lookup:– True: Finds the finds the closest value in your table array without going over– False: Finds an exact match in your table array

Page 41: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

41

Grade Book

Page 42: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

42

Write an excel formula in cell C7 that can be copied down the column to determine the student’s letter grade.

Page 43: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

43

Write an excel formula in cell D7 that can be copied down the column to determine the student’s letter grade.

Page 44: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

44

Write an excel formula in cell C7 that can be copied down the column to determine the student’s letter grade.

Page 45: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

45

Page 46: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

46CSE 2111 Lecture Iferror Function and

Examples

Page 47: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

47

Page 48: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

48

Write an excel formula in cell C6 that can be copied down the column to determine the new rent for the

corresponding rental property.

Page 49: Http://web.cse.ohio-state.edu/~ricel/ 1. Common Functions 2

49

TABLE/ARRAY CREATIONRULES FOR LOOKUP RANGE: TRUE

TRUE• Leftmost column should contain the table range• Rightmost column should contain the value• Leftmost column must be in ascending order• Beginning value in table array must be the lowest

lookup value used in the lookup function