functions. types of functions built-in functions: –financial –date & time –math &...

19
Functions

Upload: doris-bradley

Post on 04-Jan-2016

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Functions

Page 2: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Types of Functions

• Built-in functions:– Financial– Date & time– Math & statistical– Database– Lookup– Logical– Information: IsBlank, IsNumber, IsText– Text– Etc.

Page 3: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Arguments • Arguments are inputs to a function.

• A function may or may not require arguments.– Example:

• No argument: Today()• One argument:

– IsBlank(A1)– Upper(“David”)

• More than one: PMT

Page 4: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

A few math functions• Int(x): Rounds a number down to the nearest

integer– Int(2.3) = 2– Int(5.6) = 5– Int(-2.7) = -3

• QUOTIENT(numerator,denominator) – Returns the integer portion of a division– Numerator     is the dividend.– Denominator     is the divisor.

• MOD(Dividend, Divisor)– Returns the remainder of a division

Page 5: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Examples of Using Int Function

Remainder function: MOD(Dividend, Divisor)

Page 6: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,
Page 7: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Rounding

• ROUND(number, num_digits)– It rounds a number to a specified number of

digits.

• ROUNDUP(number,num_digits)

• ROUNDDOWN(number,num_digits)

Page 8: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Currency Format & Rounding

• Example:– Enter 3.543 in cell A1and enter 3.123 in cell

A2– Enter Sum(A1:A2) in cell A3 – Assign currency format with 2 decimals to

A1:A3

• Stored value and displayed value

Page 9: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

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)

Page 10: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Using Statistical Functions

Compute each student’s:

1.Best score, Lowest score, exam average

2.Average of the best 2 scores

3. Weighted avg: 50%*Best score + 30% * 2nd best + 20%*lowest

Page 11: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Compute each student’s:

Best score, Lowest score, exam average

Average of the best 3 scores

Average of the best 2 scores

Page 12: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

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

Page 13: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Average Excluding the Highest and the lowest Scores

Page 14: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Text Operator

• Concatenation: &– Join two or more text values into a single text

value.

Page 15: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Text Functions

• Concatenate(text1, text2,…)

• 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

Page 16: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

The first letter in uppercase and all other letters in lowercase

Page 17: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

The first letter in each word in uppercase and other in lower case

Proper(text)

Page 18: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

Financial Functions

• Payment: PMT

• Interest payment: IPMT

• Principal payment: PPMT

• Cumulative interest:CUMIPMT

• Cumulative principal payment: CUMPRIC

Page 19: Functions. Types of Functions Built-in functions: –Financial –Date & time –Math & statistical –Database –Lookup –Logical –Information:IsBlank, IsNumber,

A few interesting formatting skills

• Home– Font group: Border, Fill Color, Font Color– Style group: Cell Style, Conditional Formatting– Alignment: Merge

• Page layout– Themes– Page Setup group: Background– Sheet Options group: View Gridline