Spreadsheet Review
Functions
Types of Functions Built-in functions: User-defined functions Financial Date & time Math & statistical Database Lookup Logical Information: IsBlank, IsNumber, IsText Text Etc. User-defined functions
Numeric functions Int(x): returns the greatest integer less than or equal to X. Int(2.3) = 2 Int(5.6) = 5 Mod(Number, Divisor): returns the remainder after a number is divided by a divisor). Mod(6,4)=2 Mod(65,10)=5
Examples of Using Int and Mod Function Remainder function: MOD(Dividend, Divisor)
Practice: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
Statistical Functions Sum, Average, Max, Min, Count Ignore text and logical values. SumA, AverageA, MaxA, MinA, CountA Does not ignore text and logical values: Text -> 0 True -> 1 False -> 0 Can have many arguments: =SUM(A1:A3, 12, B3:B7)
Compute each student’s: Best score, Lowest score, exam average Average of the best 3 scores Average of the best 2 scores
Practice:Average Excluding the Highest and the lowest Scores
Text Functions Lower(text): Lower(“David”) -> “david” Upper(text): Upper(“David”) -> “DAVID” Right(text, #ofCHars) Right(“David”, 4) -> ”avid” Left(text, #ofChars) Left(“David”, 2) -> “Da” Len(text) -> the number of characters in a text. Len(“David”) -> 5
The first letter in uppercase and all other letters in lowercase
The first letter in each word in uppercase and other in lower case Full name format: First Name + Space + Last Name
Proper B1: DAVID CHAO =Proper(B1)
Cell Reference
Demo
Copy Formula Drag the source cell Copy/Paste Edit/Fill
Cell Reference Relative cell reference: After copy, the formula will reference cells with the same relative position as the original formula. Example: Value in cell E6: C6*D6 Absolute Cell Reference: After copy, the formula still references the same cell as the original formula. Tax in cell F6: E6*$C$3
Mixed Cell Reference $ColumnRow: $A1 Column$Row: A$1 Examples: =$A1
Cases Where Mixed Cell Reference are Optional
Case that Must Use Mixed Cell Reference
Decision: Action based on condition IF Function Decision: Action based on condition
Examples Simple condition: More than one condition: If total sales exceeds $300 then applies 5% discount; otherwise, no discount. More than one condition: Taxable Income < =3000 no tax 3000 < taxable income <= 10000 5% tax Taxable income > 10000 15% tax
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.
IF Function =IF(condition, ValueIfTrue,ValueIfFalse) Example: Tuition: If total units <= 12, then tuition = 1200 Otherwise, tuition = 1200 + 200 per additional unit In Cell C2: IF(B2<=12, 1200, 1200+200*(b2-12))
Example: Compute weekly wage Example: Compute weekly wage. Overtime hours are paid 50% more than the regular pay. In Cell D2: If(C2<=40, B2*C2, B2*40 + 1.5*B2*(C2-40))
Example: Tax rate is based on married status: Single: 15% Married: 10% In D5: If(B5=“S”,$C$1*C5, $C$2*C5)
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))
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), 15 cents per KH All KH over 300, 10 cents per KH In C2: If(B2<=100, .2*B2,If(B2<=300,.2*100+.15*(B2-100),.2*100+.15*200+.1*(B2-300))