160 likes | 331 Views
Functions. Types of Functions. Built-in functions: Financial Date & time Math & statistical Database Lookup Logical Information: IsBlank, IsNumber, IsText Text Etc. User-defined functions. Int function. Int(x): return the greatest integer less than or equal to X. Int(2.3) = 2
E N D
Types of Functions • Built-in functions: • Financial • Date & time • Math & statistical • Database • Lookup • Logical • Information: IsBlank, IsNumber, IsText • Text • Etc. • User-defined functions
Int function • Int(x): return the greatest integer less than or equal to X. • Int(2.3) = 2 • Int(5.6) = 5 • Int(-2.7) = -3, Trunc(-2.7) = -2
Examples of Using Int Function Remainder function: MOD(Dividend, Divisor)
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. • 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
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
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 Text Functions
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)
PMT Function • Calculates the payment for a loan based on constant payments and a constant interest rate. • Syntax • PMT(rate,nper,pv) • Rate is the interest rate for the loan. For monthly payment, annual interest rate must be divided by 12 to get the monthly rate. • Nper is the total number of payments for the loan. • Pv is the present value, or the total amount that a series of future payments is worth now; also known as the principal.