Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

Week 10 - Data Analysis Using Formula and Functions

The use of formula and function

Uploaded by

hummamrifaie
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Week 10 - Data Analysis Using Formula and Functions

The use of formula and function

Uploaded by

hummamrifaie
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Learning Outcomes

By the end of this lesson, students will be able to:


• Create formulas using various arithmetic and logical operators
functions.
• Identify types of cell references.
• Able to enter formulas
• Able to copy formulas – fill handle, copy/paste
DATA ANALYSIS
USING
FORMULA
Basic Concepts

Cell references / Cells whose values are to be used in calculation, for example, A2 and
Range references A2:D2
• Arithmetic operators: + - * / ^
Operators
• Comparison operators: < <= > >= = <>
Arithmetic Operators

Precedence Operator Description


Highest
^ (caret) Exponentiation. 22 is typed as 2^2

* (asterisk) and Multiplication and


/ (forward slash) Division
Lowest +,― Addition and Subtraction

Order of precedence (Highest to Lowest)


Cell References

Cell Reference Description Example


Cell address changes (relative to the A3, D5, F12
Relative reference original position) as a formula is copied
to another cell.
Cell address does not change when you $A$1, $B$4, $C$23
Absolute reference
copy the formula.

To get the sign “$”, press F4


Cell References – Relative and Absolute
Cell References – Relative and Absolute

• Column E shows wrongly used of Relative References


• Column F shows correctly used of Absolute Reference for the Tax. Because Tax
is fixed at cell C2.
DATA ANALYSIS
USING
FUNCTION
Functions
• Functions are built-in formulas that you can use to perform specific
tasks.
• There are many functions under several categories.
• Among them are Mathematical, Logical and Conditional functions.
The parts of a functions:
Working with one argument
Working with multiple arguments
Functions – That you need to know

SUM IF
AVERAGE IFERROR
COUNTA VLOOKUP
COUNT
MODE
MEDIAN
MIN
MAX
Mathematical Function - SUM
Function with Syntax Description

=SUM(arg1, arg2, … , argN) Adds all the numeric values of the arguments.
where N >= 1 ● (arg1, arg2, … , argN) are N values which the sum is to be
calculated.
● You can also enter a range reference as an argument.

Examples:
=SUM(25, 100, -3) returns the value 122
=SUM(B2:D5) sums up the numeric values in the range.
=SUM(C1, 2, A1:A3) sums up the numeric values of the
arguments.
Note: Any text or blank cell referred by the arguments is
ignored.
Mathematical Function - AVERAGE
Function with Syntax Description

=AVERAGE(arg1, arg2, … , argN) Returns the average of numeric values in the


arguments.
Examples:
=AVERAGE(25, 100, -2) returns the value 41
=AVERAGE(B2:D5) finds the average of the
values in the range.
Note: Any text or blank cell referred by the
arguments is ignored.
Mathematical Function – COUNT & COUNTA
Function with Syntax Description

=COUNT(arg1, arg2, … , argN) Counts the number of numeric values in the


list of arguments
Note: All text and blank cells are ignored.
=COUNTA(arg1, arg2, … , argN) Counts how many data entries in the
arguments
Note: Cells that contain text are also counted.
Mathematical Function – MODE & MEDIAN
Function with Syntax Description
=MODE(arg1, arg2, … , argN) Returns the number or value, which appears most often in the
set.
Example:
=MODE(35,20, 17, 20) returns the value 20
Note: Any text or blank cell referred by the arguments is
ignored.

=MEDIAN(arg1, arg2, … , argN) Returns the middle number or values in the set of values/data.
Example:
=MEDIAN (20,10,35,20) returns the value 20
Note: Any text or blank cell referred by the arguments is
ignored.
Mathematical Function – MIN & MAX
Function with Syntax Description
=MAX(arg1, arg2, … , argN) Returns the highest numeric value among the arguments
Example:
=MAX(35.6, 17, -20) returns the value 35.6
Note: Any text or blank cell referred by the arguments is
ignored.

=MIN(arg1, arg2, … , argN) Returns the lowest numeric value among the arguments.
Example:
=MIN(35.6, 17, -20) returns the value -20
Note: Any text or blank cell referred by the arguments is
ignored.
IF Function
Function with Syntax Description

=IF (logical_test, value_if_true, Performs a comparison between two operands and


[value_if_false]) returns data depending the result of the comparison.
● The logical_test is a condition that compares two
Note: logical_test involves comparison
operands and returns either True or False (a logical
operators i.e. < <= > >= = <>
value).
● If the comparison is True then IF function will return
the value in the SECOND argument.
● Otherwise, the value in the THIRD argument will be
returned.
IF Function - An Example

• Sample data
IF Function – Result 1
To display the status as Over Budget if Actual > Budgeted.
Otherwise, display as Within Budget.
a) At cell C2, enter the formula:
=IF(B2>A2,“Over Budget", "Within Budget”)
b) Copy the formula to cell C3 till cell C5
IF Function – Result 2
• If Status is Over Budget then display the calculate value for Amount Over, else
display zero for Amount Over
• a) At cell D2, enter the formula:
• =IF(B2>A2,B2-A2,0)
• b) Copy the formula to cell D3 till cell D5
IF Function – Result 3
• Display the calculate value for Amount Over if Status is Over Budget. Otherwise, no
data is returned for Amount Over.
• a) At cell D2, enter the formula:
• =IF(C2=”Over Budget”,B2-A2,””)
• b) Copy the formula to cell D3 till cell D5
VLOOKUP Function
Function with Syntax Description

=VLOOKUP(lookup_value, table_range, VLOOKUP searches vertically in a Lookup table for the specified value or the
column_num) closest value, and then returns a value from the same row in another
where column, as specified by its column number, of the Lookup table.
o lookup_value is the data to look for in
the first column of the Lookup table. It The lookup_value is used to compare against the values in the first column
can be text or number data type. of the table.
o table_range is range reference of the
Lookup table The Lookup table must have a minimum of two columns. The first column
o column_num is the column number in of the Lookup table must be sorted in ascending order. The data in the first
the Lookup table/range for the return column must match the data type of the lookup_value.
value. • If lookup_value is a number then the cells in the first column must
contain numbers. Each cell must contain one value.
• If lookup_value is text then the cells in the first column must be text.
VLOOKUP Function – Sample data
VLOOKUP Function – An Example to find Grade

1.To find the grade of the first student,


click at cell C2. Then, type =VLOOKUP(
b) Click at cell B2. Next, type ,
c) Select the range F2:G12. Next, press F4
key to change to absolute reference. Then,
type ,2)
d) Press Enter.

Formula entered into cell C2


VLOOKUP Function - An Example to find Grade

2. Copy the formula in cell


C2 downwards until cell
C14.

All grades calculated


VLOOKUP Function - An Example to find Status

1. To get the status of each student


a) Click at cell D2. Then, type =VLOOKUP(
b) Click at cell B2. Next, type ,
c) Select the range F2:H12. Next, press F4 key.
d) Then type ,3)
e) Press Enter.

Formula entered into cell D2


VLOOKUP Function - - An Example to
find Status
2. Copy the formula in cell D2
downwards until cell D14.

All students with status


Common Errors
• Error displays in Excel can be caused by several factors.
• Here are the errors that you need to know:
 ######
 #DIV/0!
 #VALUE!
 #REF!
 #NAME?
 #N/A

31
Common Error - ######
Error Display Explanation
###### This occurs when:
• The column is too narrow to display the formatted number in the cell. (See
Figure A)
• A value less than 1 is formatted as a date. (See Figure B)

Figure A Figure B

32
Common Error - #DIV/0!
Error Display Explanation
#DIV/0! • This is displayed when a number is divided by zero.
• For example: =A1/A2 would display #DIV/0! if A2 is a blank cell or contains
zero. (See Figure C)

Figure C

33
Common Error - #VALUE!
Error Display Explanation
#VALUE! • This occurs when the wrong type of argument or operand is in the formula.
• For example, the formula in the cell is =A1*A3. If one or both cells contain
text, #VALUE! will be displayed. (See Figure D). Text has NO value.
Note:
o This error occurs when the formula involves arithmetic operators.
o Operand is an item before or after an operator in a formula.

Figure D
34
Common Error - #REF! – Example 1
Error Display Explanation
#REF! • It often occurs as the result of deleting rows, columns, cells or worksheets,
or after copying a formula that causes a relative referencing error.

Original Worksheet After row 3 was deleted

35
Common Error - #REF! – Example 2
Error Display Explanation
#REF! • This refers to a non-valid reference in your formula.

Original Worksheet Formula in cell C2 was copied to cell B3

36
Common Error - #NAME?
Error Display Explanation
#NAME? • This display means a function name or cell reference used is not recognized
by Excel. (See Figure E)
• Check for typos and make sure the function names are valid. (See Figure F)

NOFINAL is a reference that does not exist TOTAL is not a valid function
in the worksheet – Figure E name in Excel – Figure F
37
Common Error - #N/A
Error Display Explanation
#N/A • This display generally means that a formula can’t find what it’s been looking
for, or values not available. (See Figure F)
• Make sure the values needed in the formula are available.

Value in cell B5 is missing, resulting #N/A displayed –


Figure F
38
IFERROR Function
Function with Syntax Description

=IFERROR(value, value_if_error) This function is designed to trap and manage errors in formulas and
where calculations.
o value is the expression or value that
needs to be tested. It is generally IFERROR checks a formula, and if it evaluates to an error, returns another
provided as a cell address. value you specify; otherwise, returns the result of the formula.
o value_if_error what to return if an
error is found. It can be an empty string For example, when dividing two columns of numbers, you may get a bunch
(blank cell), text message, numeric of different errors if one of the columns contains empty cells, zeros or text.
value, another formula or calculation.
To prevent that from happening, use the IFERROR function to catch and
handle errors the way you want.

https://www.perfectxl.com/excel-glossary/how-to-use-hlookup-excel/
IFERROR Function
• An iferror function is useful in handling the error in the Microsoft
Excel where it can customise the output.
• Example A: To get the price for each item using a formula

The column D calculates for price per each item from cell D2 until cell D6.
IFERROR Function
• Next, copy the formula to the other cells by dragging the fill handle
from cell D2 to the cell D6.

Formula entered in cell D2


IFERROR Function

Formula copied from cell D2 to cell D6

• the cell in D5 shows the error #DIV/0!.


• To manage the error in different or custom styles, use the iferror
function to customise the output of the value.
IFERROR Function
1)To enter the iferror function
2)At cell D2, enter the formula:
3)=IFERROR(B2/C2,”Error check!”)
4)Copy the formula to cell D2 till cell D6

Enter IFERROR function in cell D2


IFERROR Function

Copy the IFERROR function from cell D2 to cell D6


Ethics of the day
• Prevention of Harm:
• Inaccurate data or misinterpretation can lead to incorrect conclusions
and potentially harmful decisions. Prioritizing accuracy contributes to
preventing unintended negative consequences.
Alhamdullilah

Thank you :)

You might also like