Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

6/22/2021

Lecture Overview

Lecture 6

Topic 6:General, Text &


Logical Functions

MS Excel Function Excel Function Categories


• An inbuilt mathematical or textual • There are 477 functions in Excel 2016
expression. grouped into 14 categories.
• A function is identified by its name e.g. • Excel groups functions into broad
SUM() , AVERAGE() etc. categories based on some common
features.
• 10 most commonly used include:

3 4

1. Math & Trig 3. Statistical


• Includes general math and trigonometric • Performs statistical analysis on lists of values
functions 4. Lookup & reference
2. Financial • returns a value from a table by searching
• Used to analyze investments including (looking) up another related value (search
appreciation, depreciation, compound value).
interest etc.

5 6

1
6/22/2021

Function Categories Cont’d


5. Date & Time 8. Information
• Manipulates date and time values • Returns information about a cell e.g.
6. Logical formatting features applied to the cell
• Capable of making a decision based on the 9. Engineering
outcome of a given condition. • Includes common engineering calculations.
7. Text 10. Database
• Manipulates text data • Performs summary calculations and queries
on databases.
7 8

Anatomy of an Excel Function


• Example: =SUM(B1:B5) • Notes:
Function name Argument 1. Two arguments are separated by a “,”
• An Excel function consists of 2 parts: (comma) between them.
i. Function name – identifies the function • Example:
ii. Argument – an input/data to a function. =SUM(B1,B2,B3,B4,B5)
• It is passed to the function by specifying 2. There are no spaces in function names
it inside brackets. and arguments.
9 10

General Math & Trig Functions


General Math Functions
• Includes the following subcategories: 1. POWER() Function
a) General math functions • works out exponents (power).
b) Rounding functions • Format :
c) Summation functions =POWER(base,index)
d) Trigonometric functions • Example:
=POWER(2,3)  8

11 12

2
6/22/2021

2. SQRT() Function 3. PRODUCT() Function


• finds the square root of a number. • Multiplies values in a range.
• Format: • Format:
=SQRT(number) =PRODUCT(range)
• Example: Example
=SQRT(9)3 =PRODUCT(A1:A10)

13 14

Rounding Functions
1. ROUND( ) Function 2. ROUNDDOWN( ) Function
• Rounds off a numeric value to a specified • Rounds numbers down towards zero.
number of decimal places. • Example:
• Format: =ROUNDDOWN(1.9, 0)  1
= ROUND(number,d.p.)
• Example
=ROUND(3.987, 2)  3.99
15 16

Summation Functions
1. SUM( ) Function
3. ROUNDUP( ) Function
• Sums up values in a given range.
• Rounds numbers up away from zero. • Format:
• Example: =SUM(range)
=ROUNDUP(1.1, 0)  2 • Example:
=SUM(C1:C5)
N/B: The function ignores text data and
blank cells.
17 18

3
6/22/2021

• Real Life Ex 1: Write function to find


total sales for C001 from New York City
in the 1st quarter of 2021.
• Sol
=SUM(C4:E4)
• Alt:
=SUM(C4,D4,E4)
19 20

2. SUMIF() Function • Condition – Criterion to be met e.g. >40


• Sums up values that meet a specified • N/B: The condition must be enclosed in
condition in a given range. “” (double quotes).
• Format : • Real Life Ex 2: Write function to find total
=SUMIF(conditionRange,“condition”) for sales greater than 30,000 in the
• conditionRange – the range whose month of Jan.
values are to are to be interrogated • Sol
(compared) against the condition. =SUMIF(C4:C8,">30000")
21 22

3. SUMIFS() Function
• Sums up values in a range that meet 2 or more
conditions.
• Format:
=SUMIFS(sumRange,conditionRange1,cond
ition1, conditionRange2,condition2,…….)
• sumRange – range whose values are to
be summed up

23 24

4
6/22/2021

• conditionRange – range whose values


are to be compared to a given condition
• Real Life Ex 3: Write function to find total
sales for sales greater than 30,000 from
LA in Jan.
=SUMIFS(C4:C8,C4:C8,">30000",B4:B8,
"=Los Angeles")
25 26

Logical Functions
Boolean Expression
• a function that can make a decision • An expression that evaluates to either value
between two alternatives depending TRUE or FALSE.
on the outcome of a given condition. • It is constructed using comparison operators:
1. > 4>5
• The condition is expressed as a
2. < 2<3
Boolean expression.
3. = 2=1 
4. <> (not equal to) 2<>1 

27 28

The IF() Function


• Logical functions include: • Returns one value if a condition
i. IF() evaluates to TRUE and another
ii. AND() alternative value if FALSE.
iii. OR() • Format:
iv. NOT() =IF(Condition,option1,option2)
• Real Life Ex 1: Write function to remark
“Pass” or “Fail” based on Total mark.
Pass mark is set at 100 marks.
29 30

5
6/22/2021

• Sol
=IF(G4>=100,”Pass”,”Fail”)
• N/B: Text data must be enclosed in “”
(double quotes).

31 32

Working with Calculations in IF() function


• Real Life Ex 2: Family allowance is 2% of
G4>=
Basic Salary for Married (M) persons and
100
1% for Singles (S). Write functions to
“PASS” “FAIL” award family allowances accordingly.
• Sol
=
33 34

Nesting IF() Functions


• Refers to placing an IF() function inside
another IF() function.
• It is used to implement a situation
involving 3 or more alternatives
(options).
• Example 2: Write function to grade score
in ENG for student 101 based on the
following grading system.
35 36

6
6/22/2021

Mark Grade • Soln


70-100 A =IF(C4>=70,"A",IF(C4>=60,"B",IF(C4>=50,"C
",IF(C4>=40,"D","E"))))
60-69 B
50-59 C
40-49 D
0-39 E
37 38

• Notes:
1. Given N alternatives, it requires nesting (N-
1) IF() functions to implement.
2. Excel allows nesting of up to a maximum of
8 IF() functions.

39 40

Text Functions
1. CONCATENATE( ) function 2. LEN( ) Function
• joins 2 or more text strings together . • counts the number of characters in a
• Example: string of text including blank spaces.
=CONCATENATE(“John”,”Paul”) • example:
JohnPaul A1=Hello
=LEN(A1) 5

41 42

You might also like