lec_2
lec_2
Mathematical And
Statistical Packages
Course code: MC300
1
A Function is a predefined worksheet formula
◦The advantage of
◦using a function:
◦Saves time writing
◦Simplifies complex calculations
◦Faster execution
◦Less chance of typographical errors
◦Fewer characters in the formula bar
◦ Example: instead of =C5+C6+C7+C8
◦ use =SUM(C5:C8)
2
Functions take arguments and return a result
3
The SUM Function
◦Syntax: SUM(range) or SUM(num1, num2, …)
Can type into cell, use AutoSum toolbar button or function
wizard
◦Argument: Value or Range of cells to be summed
◦Algorithm: Arithmetic sum of all values listed in
the range argument
4
Arguments of a SUM function
Valid Range Arguments for a SUM function
◦A1:A4 - Range along a column
◦A1:D1 - Range along a row
◦A1:D4 - A two-dimensional range
(Block)
◦A1, D3:D5, 7 - non-contiguous cells*
* not all range arguments of functions can be used with non-contiguous cells
5
Using functions
A B C D E F G H
1 Grade Book
2 Lab1 Lab2 MT Final Total Percent
3 Total Possible points Honors 10 20 100 200 330
4
5 Blue H 9 15 88 186 298 90.3%
6 Jones 5 77 155 237 71.8%
7 Smith H 10 18 91 190 309 93.6%
8 Grey 7 10 75 155 247 74.8%
9
10 Highest Score 10 18 91 190 309 93.6%
11 Lowest Score 5 10 75 155 237 71.8%
=SUM(C5:F5)
6
Function Wizard
◦Function wizard: A short-cut to all the functions in excel
(use fx toolbar button) that walks you through building a
function
7
Common Functions- with only a range argument
9
How many Honor students are there?
=COUNT(B5:B8
)?
Use =COUNTA(B5:B8) 2
10
If scores should only be reported as integers.. How can
we fix this in Excel?
The
Increase/Decrease
decimal buttons do
NOT change a value
only how the value
is displayed.
Use the ROUND function to change the
precision of a value 11
The Round Function changes the precise value of a
number, not just its display
13
Notice the Σ SUM gives different results
when adding rounded values
15
Use the COUNTIF Function
16
The COUNTIF Function counts the number of items in a
range that meet a specific criteria.
X
=COUNTIF(C5:C8,D5:D8, “>6”)
=COUNTIF(C5:D8, “>6”) √
18
The SUMIF Function sums the values in a range that meet a
specific criteria
=SUMIF(B$2:B$6,A9, C$2:C$6)
20
◦Use the AVERAGEIF function to average values that
meet a specified criteria – average number of courses
taken by students in each college
=AVERAGEIF(B$2:B$6,A9,
C$2:C$6)
– works identically to
AVERAGEIF(range, criteria, averagif-range)
the SUMIF function except it averages the specified
range. 21
A little harder..calculate the average sum for students by
college by year
=AVERAGEIF($B$3:$B$9,$B13,C
$3:C$9) 22
Other Categories of Functions
• Statistics:
• Mean, Median, Standard deviation
• Financial:
• Present value, Future value
• Logical:
• NOT, AND, OR
• Trigonometric:
• COS, TAN,
23
BREAK
24
Microsoft Excel Logical Functions
Objectives:
Using Boolean Logic in Spreadsheets
Relational operators
Boolean operators –Functions
None of logical construct
Using Conditional Formatting
25
Boolean Logical Values
Is 3 greater than 5 ?
The answer is either True or False
TRUE and FALSE are Boolean Values
Mathematically this would be represented by the
expression 3>5
How much greater is 5 than 3?
This answer requires an arithmetic value
Mathematically this would be represented by the
expression 5 - 3
26
Boolean Logical Values
◦Excel provides a class of operators known as Relational
Operators that can be used to perform a comparison of
the left and right sides of an expression
◦
<, >, <=, >=, =, <>
The result is always either TRUE or FALSE
Relational Expressions:
•
=38<=6 results is the value FALSE
•
=B2=5+3 results is the value TRUE if B2 equals 8
27
Simple Relational Expressions
•Blue’s total is higher than
Jones’ grade: =E4>E5
•Jones’ total is the maximum
in the class: =E8=E5
•The average total of
students is less than 300:
=Average(E4:E6)<300
28
Precedence of Relational Operators
Are these expressions
equivalent?
=B4+B5<=1
50
=(B4+B5)<
=150
29
Boolean Logic Operators
How do you determine if all of the students got
above 320 points to pass the class or if anyone got
below 320 points?
◦OR - At least one item must be true for the statement to be true
31
The AND Function
Excel uses a Function to perform the AND operation
32
The AND Function
34
The OR Function
37
i c e
r a ct
e P
r
Mo