Download presentation
Presentation is loading. Please wait.
1
Functions BUS 782
2
What are functions? Functions are prewritten formulas. We use functions to perform calculations. Enclose arguments within parentheses. Arguments are values on which you want to perform the calculation. Example: PMT function
3
Types of Functions Built-in functions: Financial Date & time
Math & statistical Database Lookup Logical Text Etc.
4
Examples of Using Math Functions: Quotient and Mod
Quotient: Quotient(Dividend, Divisor) Remainder function: MOD(Dividend, Divisor)
5
Return the Smallest Number of Coins
Examples: 26 cents: 1 Q, 1 P 57 cents: 2 Q, 1 N, 2 P 63 cents: 2 Q, 1 D, 3 P
7
Statistical Functions
Sum, Average, Max, Min, Count Ignore text and logical values. Can have many arguments: =SUM(A1:A3, 12, B3:B7)
8
Examples of Using Statistical Functions
Compute each student’s: Best score, Lowest score, exam average Average of the best 3 scores Average of the best 2 scores
9
Large(Data range, kth value)
Returns the k-th largest value in a range. Average of the best two exams: =(Large(B2:E2,1) + Large(B2:E2,2))/2
10
Average Excluding the Highest and the lowest Scores
11
Text Functions Lower(text): Lower(“David”) -> “david”
Upper(text): Upper(“David”) -> “DAVID” Proper(text): The first letter in each word in uppercase and other in lower case
12
Date & Time Functions How Excel handles dates: Functions:
Serial #: 1/1/1900 – day 1 Functions: Today() – today’s date Now() – current date and time Year(a date) Month(a date) Weekday(a date)
13
Examples Tomorrow’s date? How many days to July 4th?
Compute the age given a date of birth.
14
Determine action based on condition
If Function Determine action based on condition
15
Examples Simple condition: More than one condition: Complex condition:
If total sales exceeds $300 then applies 5% discount; otherwise, no discount. More than one condition: Taxable Income < = no tax 3000 < taxable income <= % tax 10000 < taxable income <= % tax Taxable income > % tax Complex condition: If an applicant’s GPA > 3.0 and SAT > 1200: admitted
16
Comparison Less than: < Less than or equal: <=
Greater than: > Greater than or equal: >= Equal: = Not equal: <> At least: >= At most: <= No more than: <= No less than: >= A comparison returns True/False. Example:
17
IF Function =IF(condition, ValueIfTrue,ValueIfFalse) Example:
Tuition: If total units <= 12, then tuition = 1200 Otherwise, tuition = per additional unit
18
Example: Compute weekly wage
Example: Compute weekly wage. Overtime hours are paid 50% more than the regular pay.
19
Example: Tax rate is based on married status:
Single: 15% Married: 10%
20
Example: A restaurant charges service fee based on this rule: 15% of the check amount with a minimum of $2.
21
Exercises 1. How to determine an integer entered in a cell is an even number or an odd number? 2. The average of two exams is calculated by this rule: 60% * higher score + 40% * lower score. 3. An Internet service provider offers a service plan that charges customer based on this rule: The first 20 hours: $10 Each additional hour: $1.5
22
Nested IF
23
Nested IF Example: Rules to determine bonus:
JobCode = 1, Bonus=500 JobCode = 2, Bonus = 700 JobCode = 3, Bonus = 1000 In C2: If(B2=1, 500, If(B2=2, 700, 1000))
24
1 JobCode= 1 Or <> =1 2 JobCode=2 Or <> 2 3
25
Example Electric Company charges customers based on KiloWatt-Hour used. The rules are: First 100 KH, 20 cents per KH Each of the next 200 KH (up to 300 KH), (100 < KH <= 300), 15 cents per KH All KH over 300, 10 cents per KH
26
What if we have more than 3 conditions
Example: Bonus JobCode = 1, Bonus = 500 JobCode = 2, Bonus = 600 JobCode = 3, Bonus = 700 JobCode = 4, Bonus = 800 JobCode = 5, Bonus = 1000 … Other functions: Table lookup
27
Example State University calculates students tuition based on the following rules: State residents: Total units taken <=12, tuition = 1200 Total units taken > 12, tuition = per additional unit. Non residents: Total units taken <= 9, tuition = 3000 Total units taken > 9, tuition = per additional unit.
28
Units <= 12 or Not Resident or Not Units <= 9 or Not
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.