More Functions
More Functions
IF Function
• In Microsoft Excel, the IF function is used to check if a condition is
met and then the defined statements will be shown based on the
given condition.
• The objective of the IF function is to Check whether a condition is met, and returns one
value if TRUE, and another one if FALSE.
COMPULSORY/
ARGUMENT EXPLANATION
OPTIONAL
Given condition for a cell
logical_test Compulsory
or a range of cells.
Defined statement if the
[value_if_true] Optional
condition is met.
Defined statement if the
[value_if_false] Optional
condition is not met.
OPERATOR DESCRIPTION
= Equal to
• In the dataset, there are two columns containing Sales Target and Sales
Achieved for some products.
• By using the IF function, we’ll check and show statements in Column E if the
achieved sales have met the sales target or not.
• If a salesperson meets the target, then his/her bonus of the salary will be calculated by the
percentage of sales increase.
• Will find the bonuses for those who have met the sales target and the formula will return with the
statement “Not Applicable” if target sales are not achieved.
Use of Nested IF Function in Excel
• The nested IF formula is widely used to determine the grade letter of a student in an exam.
• In our table, 1st 2 columns consist of subject names and marks out of 100 for each one.
• We’ll find out the letter grade obtained in each subject in Column D.
• In Cell D5, the nested IF formula to find the letter grade will be
=IF(C5>=80,"A",IF(C5>=70,"B",IF(C5>=60,"C",IF(C5>=50,"D","F"))))
• Press Enter, autofill the rest of the cells and will be shown letter grades for all subjects based on the defined
grading system.
IF with AND, OR and NOT Functions
• In the dataset, Columns C, D, E, and F consist of the donor names, donation amounts, mediums of donations
and donation dates respectively.
• By using the IF function before the AND function, we can add some statements based on the return types of
logical values.
• For example, we want to see the names only in Column G who have donated more than $500 before 1 August
2021.
• In the output Cell G5, the related formula will be: =IF(AND(D5>$J$11,F5<$J$12),C5,"")
• In Cell G5, the related formula with IF and OR functions will be:
=IF(OR(E5=$J$11,E5=$J$12),C5,"")
• So, by using this function inside the IF function, we can find out the donors
who have not donated through cash.
• After pressing Enter and auto-filling the rest of the cells, will get the expected
results at once.
IF with ISBLANK, ISTEXT, ISNUMBER and ISLOGICAL Functions
• In Microsoft Excel, ISBLANK, ISTEXT, ISNUMBER and ISLOGICAL are all logical functions through
which we can determine if a cell contains nothing, text string, number string, or a logical value
respectively.
• In the table, we’ll find out in Column C what types of data are lying in Column B.
• We can use IF with a the DATE function to determine the due status for tuition fees of the
students.
• Assuming, the deadline for the payment of tuition fees for July is 7/31/2021.
• We’ll find out the status of the students who paid the tuition fees in time and who couldn’t.
• n the output Cell E5, the related formula will be: =IF(C5<=DATE(2021,7,31),"In
Time","Delayed")
• MS Excel helps us with these kinds of problems by providing another powerful function
named SUMIF.
REQUIRED/
ARGUMENT EXPLANATION
OPTIONAL
The range of cells that we
range Required want to be evaluated by
criteria.
The criteria are in the form
of an expression, a number
criteria Required a text, a function, or a cell
reference, that defines
which cells are to add.
The actual cells to add if we need to
sum range Optional combine cells other than those defined in
the range argument.
Calculating Sum with Numeric Criteria Using SUMIF Function
• Using the SUMIF function, we can calculate the sum with the numeric conditions.
• Here our concern is to calculate sales from the dataset where the Category will
be Fruits.
• So, firstly, write the formula in the H8 cell like this =SUMIF(C5:C16,"Fruits",E5:E16)
• Say that we want to get the sum of sales of those foods where the date is after 04/01/2021.
• OR logic means if any logic or condition is true from the given logic then it will return true.
• assume we want to calculate the total sales where Category is Vegetables, or each sale is greater than $1000.
• An array argument is nothing but an array of some elements in any function’s parameter. Like:
{“A”, “B”, “C”} etc.
• Now here we will count the total sales where Category is Fruits and Dairy using
the SUMIF function.
• We can use the SUMIF function where we need to calculate the sum within a range
of Month and Year.
• In the following dataset, we have column headers as Project, Start Date, Finish Date, Rate Per
Hour, Worked Hour, and Total Bill.
• Firstly, write the formula in the C13 cell like this. =SUMIF(D5:D10,"="&C12,G5:G10)
COUNTIF Function
• In Microsoft Excel, the COUNTIF function is widely used to count cells with a
given condition or criterion.
• The objective of the COUNTIF function to count the number of cells within a
range that meet the given condition.
• Syntax: =COUNTIF(range, criteria)
REQUIRED/
ARGUMENT EXPLANATION
OPTIONAL
• press Enter and the number of participants who have scored more than 70 in
the contest will be shown.
• Can also use COUNTIF with Text criteria, to count blank and non-blank cells,
date criteria, multiple OR criteria etc.
VLOOKUP function
• The VLOOKUP function looks for a given value in the leftmost column of a
given table and then returns a value in the same row from a specified column.
• If you enter an array of values, the function will look for each of the values in
the leftmost column and return the same row’s values from the specified
column. ARGUME REQUIRED/
VALUE
NT OPTIONAL
• If it finds one, then it moves to the specified number of columns right given
as col_index_num in the same row.
• After moving to the specified number of columns right, it returns the value from the
destination cell.
• Then it finds one in cell B8. Then it moves to column 3 (col_index_num) of the
table, in the same row. That is cell D8.
• And then it returns the value from that cell, in this case, it is the salary of Shane Lee,
$22000.00.
• The excel VLOOKUP function can be used to solve several other problems
• It can be used alone or in combination with other functions
IF Function
• The expression could be a function that determines if the value entered in a cell is of
numeric or text data type, if a value is greater than, equal to or less than a specified
value, etc.
• In the example, we will use the IF function to determine if an item is expensive or not.
• Will assume that items with a value greater than 6,000 are expensive and those that
are less than 6,000 are less expensive.
• Put the cursor focus in cell F4
• =IF(E4<6000,”Yes”,”No”)
• “E4<6000” is the condition that the IF function evaluates. It checks the value of cell address E4
(subtotal) is less than 6,000
• “Yes” this is the value that the function will display if the value of E4 is less than 6,000
• “No” this is the value that the function will display if the value of E4 is greater than 6,000
• Nested if statements come in handy when we have to work with more than two conditions.
• Say we want to develop a simple program that checks the day of the week.
• If the day is Saturday we want to display “party well”, if it’s Sunday we want to display “time to
rest”, and if it’s any day from Monday to Friday we want to display, remember to complete your to
do list.
• The following flowchart shows how the nested IF function will be implemented.
• The formula for the flowchart is as follows.