Hoi Le
COUNTIF Countif(, ) Return number of elements that meet the criteria Always put criteria in quotation marks Example 1: count number of employees in IT department. Hoi Le2
COUNTIF (Cont’d) Example 2: Return number of employees that have salary greater than Reagan’s salary “&” operator: concatenate two strings Hoi Le3
Note: General form of a function: function_name( ) Parameters are separated by “,” mark E.g.: sum(B2:B10), count(B2:B10), countif(B2:B10,”IT”) Hoi Le4
SUMIF Similar to the Countif function Return the sum of values that satisfy the condition Example: return sum of salaries greater than Hoi Le5
SUMIF (Cont’d) Second usage of Sumif: First range of cells: to check the condition Followed by the criteria Second range of cells: to sum up Example: return sum of salaries of employees in IT department. Hoi Le6
Note: Comparison operators: >, =,, = Hoi Le7
IF Syntax: If(logical_test, value_if_true, value_if_false) Example: Grade>=60: passed Grade<60: failed Hoi Le8
Nested If Hoi Le9
Nested If (Cont’d) To solve above problem: use nested If function Nested If: replace the third parameter value_if_false with a new If statement Hoi Le10
Nested If (Cont’d) Hoi Le11
Lookup Another way to solve that problem: use lookup function First, you need to create a look up table. Must be in ascending order 0<=Grade <50: F 50<=Grade <65: D 65<=Grade <80: C … Hoi Le12
Lookup (Cont’d) Hoi Le13
Lookup (Cont’d) Use absolute address for lookup table to make it fixed when you copy the formula G2:H6: relative address $G$2:$H$6: absolute address Hoi Le14