4 If Countif Rank Functions
4 If Countif Rank Functions
FUNCTIONS IN EXCEL
Excel includes an IF function that makes decisions based on information that is stored in a spreadsheet.
The IF function can make a comparison and if the comparison returns true, a value can be displayed in
the cell; if the comparison returns false, another value can be displayed.
The IF function has three arguments and takes the following form:
IF
The arguments of an
following formulas:
IF
Equal to
Less than
Greater than
Less than or equal to
Greater than or equal to
Not equal to
Page 1 of 4
IF function
The formula in cell C8 checks if the value stored in cell B8 is less than 30000. If this is true, the
deduction is calculated by taking the value in B8 and multiplying it by the value in cell B4 (i.e. 6%). If the
value is not less than 30000, the deduction is calculated by taking the value in B8 and multiplying it by
the value in cell B5 (i.e. 8%). The values in column D are calculated by simply taking the values in
column C and deducting it from the values in column B.
To check to see if a cells contents are empty, two quotation marks () can be used. For example,
=IF(B20=, YES, NO) displays YES if the cell contents are empty and NO if there is data in the cell.
Two quotation marks can also be used to display nothing in a cell (as we did in the above example).
Text can also be used in the comparison part of the IF function. When compared, the alphabetical order
of the text is determined. For example, the following formula displays TRUE because apple comes before
orange alphabetically:
Page 2 of 4
=COUNTIF(range, criteria)
range
criteria is the value that will be compared against the data in the range of cells. If a match is found then
the cell in the range is counted. Actual data or the cell reference to the data can be entered for this
argument.
If we continue with the above example, the formula =COUNTIF(C4:C8, REORDER) will determine how
many cells in the range C4 to C8 contain the text REORDER. So if we were to enter this formula in cell
C9, the value 3 would be displayed indicating that three different hockey sticks need to be reordered.
IF function
order determines whether the number is ranked in ascending or descending order. 0 ranks in
descending order (largest to smallest). 1 ranks in ascending order (smallest to largest).
Page 3 of 4
In the following example, I have a list of 10 marks ranging between 30 and 100:
In order to rank the marks from highest to lowest, I would enter the following formula in cell B2:
=RANK(A2, $A$2:$A$11, 0)
To apply the formula to the remaining cells (i.e. B2 to B11), you would just simply use the auto fill
feature to get the following result:
Page 4 of 4