Week 10 - Data Analysis Using Formula and Functions
Week 10 - Data Analysis Using Formula and Functions
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
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
=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
• 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
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.
35
Common Error - #REF! – Example 2
Error Display Explanation
#REF! • This refers to a non-valid reference in your formula.
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.
=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.
Thank you :)