0% found this document useful (0 votes)
35 views25 pages

Excel Prac 2a

The document discusses advanced Excel functions including fill operations, nested functions, conditional and logical statements. It covers topics like simple and useful cell operations, more functions, nested functions, logical and conditional formatting, and financial functions.

Uploaded by

jeruj2306
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views25 pages

Excel Prac 2a

The document discusses advanced Excel functions including fill operations, nested functions, conditional and logical statements. It covers topics like simple and useful cell operations, more functions, nested functions, logical and conditional formatting, and financial functions.

Uploaded by

jeruj2306
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Week 2a

This week, we will continue with more Advanced Excel Functions. Emphasis will be placed on
fill operations, nested functions, conditional and logical statements in excel. We will further
look at how to link sheets.

Outcomes
• Simple and Useful Cell Operations
• More Functions
• Nested Functions
• Logical and Conditional Formatting
• Financial Functions

Simple and Useful Operations


There are a number of useful operations that you will be performing regularly when using
excel. Below, we will look at moving cells, inserting rows and columns, deleting rows and
columns, erasing cell ranges, and adding comments to a cell.

Moving Cells
To move a cell or a group of cells, first select the cell or range of cells to be moved. Hover the
mouse over the top, bottom, left or right edges of the selected cells until it
becomes a move pointer ( ) . Press and hold down the mouse button and then move
to the desired cell range or cell.

23
Figure 13: Group of selected cell range

Release the mouse button over the cell or range of cell destination. Ensure that the relevant
formulas reference the respective cells from the original cell range or cell.

Inserting Rows and Columns


Inserting a new row or column in a worksheet is simple. To insert a new row, select the desired
row. In the figure below row 5 has been selected.

Figure 14: Selected row

Goto Insert>Rows or right-click on the mouse and select Insert as shown in Figure 15 and
Figure 16.

24
Figure 15: Inserting row from the Insert menu

A new blank row will be inserted at the selected row.

Figure 16: Right-clicking selected row

A new row will be inserted from row 5 and the other rows will be pushed down one cell step
as shown in Figure 17. It is worth noting that any references in formulas within the cells will
be adjusted by Excel accordingly.

25
Figure 17: Blank row after inserted at row 5

To insert a new column, use a similar approach as the one described for rows.

Deleting Rows and Columns


Deleting rows and columns in a worksheet is also an easy task to perform. As seen in the
previous section on inserting a column or row, you select the row or column of interest. If you
use the right-click approach, select Delete to delete the highlight row or column. If you use
the Insert menu approach, select Insert>Columns to delete the highlighted column. Refer to
Figure 15 and Figure 16 to refresh your memory or open Excel to try it out.

Erasing Cell Ranges


Data in a range of cells can be deleted in one of two ways. The first approach will be to select
the range of cells of interest by dragging across. Now, move you mouse to the bottom-right
corner of the highlighted cells where there a solid box. The mouse pointer will change to a
darker cross-hair pointer. Hold down the mouse button, and drag back across to the top-left
corner and release the mouse.

On the other hand, select the range of cells you would like to delete and press the Delete or
Del key on your keyboard.

Adding Comments
There are many reasons to add a comment to a cell. Adding a comment to a cell can be
achieved in a simple way. Just right click on the cell you want to add the comment to, select
New Comment in the context or pop-up menu that appears. A comment box with the present
user name will appear ready for entry.

26
Alternatively, you select the cell of interest, go to Insert>New Comment from the menu bar.
Comments provide many advantages when you are collaborating on a big project or working
in a team. For example you can add a comment to explain a particular formula to colleagues,
as a guiding note and others. In order to edit the comment, hover over the cell with the
comment to see the comment box, click on edit to make changes.

More Useful Functions


In this section, we will take a look at functions that will be very useful in creating complex
formulas for advanced task. We will take a look at text, conditional, array, and date and time
formulas.

Text Functions - TRIM, LEN, SUBSTITUTE, REPLACE, FIND, LEFT


Excel has an extensive collection of text formulas for various text manipulations. Below is a
table of some of the useful text functions.

Table 2: Some useful excel text functions

Function Description
CHAR(number) Returns the character corresponding ANSI2
code (1 – 255)
CONCATENATE(text1,[text2],…) Joins N number of strings into a single
string
EXACT(text1,text2) Compares two exact case-sensitive strings
to see if they are equal
FIND(find_text, within_text.[start_num]) Returns the starting position of a substring
within another string
LEFT(text,[num_chars]) Returns a specified number of characters
from the beginning of the text
LEN(text) Returns the number of characters in a text
LOWER(text) Converts text to lowercase
MID(text,start_num,num_chr) Returns a specified number of characters
beginning at a specified position within a
string
PROPER(text) Converts text to Proper case (first letter of
each word gets capitalised)
REPLACE(old_text,start_num,num_chrs,new_text) Replaces text that occurs in a specific
location with a string. Use the function
when you know the position of the text to
be replaced but not the actual text

2
ANSI – American National Standards Institute

27
REPT(text,number_times) Repeats a text string specified number of
times
RIGHT(text,[num_chrs]) Returns the right-most specified number
of characters of a string
SEARCH(find_text,within_text,[start_num]) Find a substring within another text string
SUBSTITUTE(text_old_text,new_text,[instance_num]) Replaces specified string in a text. Use
when you know the characters to be
replaces and not the position
TEXT(value,[format_text]) Formats values and converts to text
TRIM(text) Removes trailing spaces from text
UPPER(text) Converts text to UPPERCASE
VALUE(text) Converts text to number

Logical and Conditional Functions


These functions help us test conditions or compare more than one value. Logical and
conditional functions are useful when there is the need to make decisions in a formula.

Table 3: Some logical and conditional functions

Function Description
AND(logical1,[logical2],...) Returns TRUE if all the arguments resolve to true
OR(logical1,[logical2],…) Returns TRUE if any of the arguments resolves to
true
NOT(logical) Reverses the logical value of the argument. i.e. if
the argument is TRUE, FALSE is returned
XOR(logical1,[logical2],..) Returns TRUE if one and only one of the
arguments is true
IF(logical_test,[value_if_true],[value_if_false]) Returns a specified number of characters from
the beginning of the text

Below are some examples of each of the commonest and most used functions in Table 3 and
a description of its use in each of the cases. Let us begin with some varying examples of AND.

Table 4: Example of the use of AND

Formula Description
=AND(A3>=75,A3<=100) Returns TRUE if the value in A3 is greater than or
equal to 75 and the same value is less than or
equal 100, FALSE otherwise
=AND(A3=”Female”,B3>18) Returns TRUE if the text in A3 is “Female” and the
value in B3 is greater than 18, FALSE otherwise
=AND(A3=”Commerce”,B3>90,C3=”INF1002F”) Returns TRUE if the text in A3 is “Commerce” and
the value in B3 is greater than 90 and the text in
C3 is “INF1002F”, FALSE otherwise

28
Below are varying examples for the OR function

Table 5: Example of the use of OR

Formula Description
=OR(A3>45,B3>=23) Returns TRUE if the value in A3 is greater than 45
to 45 OR B3 is greater than or equal 23, FALSE
otherwise
=OR (A3=”Tuesday”,A3=”Wednesday”) Returns TRUE if the text in A3 is “Tuesday” OR the
text in A3 is “Wednesday”, FALSE otherwise

The IF function is one of the most powerful functions in Excel. Combining the IF function with
the logical functions can be very useful in writing complex formulas to achieve various tasks.
Let us the take the following scenario. We would like to check if the mark obtained by a student
constitutes a pass or fail based on the pass mark.

Figure 18: Applying the IF conditional function

In Figure 18, the logical test here is F5>=60. If the mark obtained by the student is greater
than or equal to 60, it is a Pass, and Fail otherwise. The final output for the formula is shown
in Figure 19. We will see some other examples in the class activity later. You will also practice
on your own with the assignment.

29
Figure 19: Final output of the conditional function applied to the marks

Array Formulas
Array formulas are one of Excel’s most powerful features. In order to write array formulas, you
will need to understand the concept of arrays. An array is simply a collection of similar items
or objects or elements arranged in an orderly manner. Think of arrays as row or columns of
values, or a grid or bloc of elements in a cells of a worksheet.

In Excel, an array formula can be used to perform multiple calculations on one or more
elements in an array. There are two types of array formulas used in Excel – single-cell and
multicell array formulas. We going to take a look at each of them using simple examples.
• Multi-cell Array Formula
In Excel, an array formula can be used to perform multiple calculations on one or more
elements in an array. Consider the formula in cell F4. One can decide to copy the cell to the

Figure 20: A cell with formula for the total amount

30
cells below, F5:F14, to replicate the formula. In Week 2, we learnt how this can be achieved
using the fill operations in Excel. You should have a mastery of fill operations by now.

The formula in F4, =D4*E4, can be replicated in the cells mentioned earlier to calculate the
Total Amount per item. We can also achieve this once, using a multi-cell array formula. To do
this we select the cells of interest, F4:F14, and in the formula bar enter =D4:D14*E4:E14 and
then Shift + CTRL + Enter. The selected cells will autofill with the calculated values.

Figure 21: Selected cell range

The multi-cell array formula will return an array the size of the selected cell-range. When you
view the formula in the formula bar, you will should see the formula {=D4:D14*E4:E14}.

Figure 22: Multi-cell formula in use

31
A careful look at the formula shows two curly braces surrounding the formula. This is an
indication that it is an array formula. It is should be noted that you cannot insert a table into
cells which have multicell arrays or convert ranges which have multicell arrays into a table.
Multicell array formulas ensure that all formulas in a range of cells are the same.

• Single-Cell Array Formula


Unlike multicell array formulas, single-cell array formulas produce a single result. It acts on a
group of cell ranges to produce an outcome. Consider the last example from the multicell
example. Assuming we wanted to compute the Grand Total of the items sold, which is the
overall sum of the number of items for each sale multiplied by the unit cost. It is simply a sum
of the Total Amount column elements (F4:F14).

Figure 23: Single-cell array formula used to calculate the Grand Total

We can achieve the same result using a single-cell array formula by following the following
steps:
a) In cell E16, we enter the formula =SUM(D4:D14:E4*E14)
b) Just as we did in the multi-cell array section, press Shift + CTRL + Enter
The cell with the single-cell array formula automatically gets inserted into curly braces like
previously. Figure 23 shows the outcome of using a multicell array formula to calculate the
grand total.

32
Array formulas provide a number of advantages. There is consistency in formula entry. With
the multicell example, you enter the formula ones and it is applied to all other cells. Also, you
cannot overwrite components of a multicell array. You can try this by selecting any of the cells
from F5 in the multicell example and try deleting it, Excel will not allow you to that. The safety
of your data is guaranteed. There is also efficiency as you can use them to write complex
functions.

Date and Time Functions


Date and time are an important part of our daily activities. Consider the following examples;
a company receipt will have date and time for auditing purpose or as a the manager you create
a schedule of activities with various dates and times for your employees or a production
schedule. You will need to be able to use some of the functions provided in excel to achieve
the purpose.

Table 6: Some date functions

Function Description
DATE(year, month, day) Creates a date value for a date with the entered year,
month and day
DAY(date) Extracts the day of the month from the entered date
MONTH(date) Extracts month from the date entered ( Jan – 1, Feb –
2 etc)
YEAR(date) Extracts year from the date entered
NETWORKDAYS(start,end,[holidays]) Calculates the number of complete work days
between the start and end dates. You can exclude
holidays by optionally providing it
WEEKDAY(date[,return_type]) Calculates the weekday from the date (by default Sun
– 1, Mon – 2, …)
WORKDAY(start, days,[holidays]) Returns the workday after days workdays have
passed since the start date; to exclude holidays, add
the optional holidays argument containing a list of
holiday dates to skip
NOW() Returns current date and time
TODAY() Returns today’s date

Excel understands dates as serial numbers. This number represents the number of days that
have elapsed since 1/1/1990 (January 1, 1990). Dates are entered directly as serial numbers
and then formatted as date or you enter it as any of the recognisable excel date formats.

33
Open a new workbook and enter the following dates in the cells: 19-1-24, 24 January
2019, 24 jan 2019. What are your observations?

Similarly, you can treat time entries as you did dates. Enter the dates in a format that is
accepted by Excel and it will automatically convert it to time.

Figure 24: Formatting date and time

Formatting the date and time in excel can be done easily. Right click on the cell with the date
entry, choose Format Cells on the pop-up or context menu. A dialogue box as shown in Figure
24 will appear. Go ahead and choose the desired date and time format.

Nested Functions
Nested function have arguments which are also functions in themselves. When you have a
function that is inside another function, the resulting formula is called a nested function. They
help perform complex calculations which combine many other excel functions.

34
Let us look at a few examples.

Figure 25: Example of a nested function - A nested IF is used for grading

The first part of the formula =IF(AND(F12>=75,F12<=100),”1”, in Figure 25 fulfils the first grade
symbol, 1. The formula use AND function to determine a TRUE/FALSE output, that is, is the
mark obtained by the student, in a particular cell in column F between 75 AND 100? Excel
expects this outcome to be a TRUE or FALSE. If true, the second part then assigns a symbol. If
the outcome is false, another IF condition is passed until all the criteria for our result symbols
are met. In the last part of the formula, we the EXACT function already discussed under text
functions, to compare the Mark in column F to result symbol PA. This is only one example of
how nested functions can be useful. There are more complex ways one can use nested
functions to automate tasks. We will be taking a look at a number of examples in the practical
sessions and you will also be given assignments that will involve a number of them.

Conditional Formatting
Conditional formatting is used to visually format a cell if the contents match a specified
condition. It can be used in many ways, for example, highlighting say duplicate values in a cell
range.

To apply conditional formatting to a cell range:

35
• Highlight the range of cells you will like to apply the formatting to. On the
• On the Home tab, click on Conditional Formatting as shown in Figure 26
• Select the desired formatting option you prefer and apply the appropriate rules
• Click OK to apply the rules and see it take effect

Figure 26: Applying conditional formatting

The final conditional formatting as applied is shown in Figure 27. There are several forms of
conditional formatting and you have to explore to see how to use them for various tasks. We
have only explored a simple one and further reading and practical will enable you understand
the other types in Excel. Some examples of other conditional formatting types are data bars,
colour scales, and icon sets. You will get to explore some of them in the practical session and
assignments.

36
Figure 27: Complete conditional formatting applied to the grades

The complete formatting applied to the dataset is shown in Figure 28.

Figure 28: Final formatted dataset

37
Financial Functions
We all make financial decisions every day, for example for deferred payments, loan
repayments, investments and amortisation. Excel provides very powerful functions for some
of these important financial calculations. Before we begin with the various functions available
in Excel for this purpose, we will try to understand some concepts about the time value of
money.

The Time Value of Money (TVM) is a concept that money available at a present time is worth
more than the same money at a future time. Let us assume some decides to give you R 2,000
today or asks you to wait and receive R 2,000 in a year. You are likely and instinctively going
to take the money today as you will be able to do more today with that amount than you will
do in a year. Whatever you do with the money now will be worth more now. You can also
increase the future value of the money by investing it. Thus, the time value of the money one
has is important in helping us make smart financial decisions.

In order to be able to understand the TVM and calculate how much a given amount of money
will be worth either in the future or present, there are some concepts one needs to familiarise
themselves with.

o Present Value (PV)


The PV is the principal amount or the value of money at present in an investment.
o Future Value (FV)
FV is the value of an asset at a future date based on an assumed growth rate.
o Payment (PMT)
The payment is the principal or the principal and any interest additions.
o Interest Rate
The proportion or percentage of the principal. Interest rates are often are often given
per annum.
o Period
This represents the specific point in time for payment of an interest on a loan or
investment

38
We are going to look at how these functions are used in examples.

Loan Repayment - PMT


The PMT function can used to calculate the loan repayment amount on a principal over a
period. The usage of the function is as follows:

PMT(rate, nper, pv,[fv],[type])

The rate argument is the interest rate over the given period, nper is the total number of
repayment periods, pv is the present value of the loan amount. The function has two optional
arguments that can be used; fv which is the future value of the loan and type which specifies
when the interest is charged on the loan, that is at the end of the loan period(type=0) or at
the beginning (type=1).

Let’s consider the following example. What will the monthly repayment of various amounts at
2.5%, 5%, 6.25%, 7%, 10% and 15% be over 4 years as shown in Figure 29.

Figure 29: Setup for a loan repayment

We are going to use the PMT function to do the calculations.

39
In cell D7 the formula is given as =PMT(D$5/12,$D$2,$C7). Since the loan repayment is monthly,
the interest rates in cell range D7:I7 will be divided by 12 to obtain the rate value. As you will
notice in D2, the loan repayment period is over 4 years and since it is a monthly repayment, it
is multiplied by 12 to get 48 for the nper value. The last argument in the formula is the pv,
which is given in cell range C7:C18. We are trying to get different repayment amounts for
different interest rates and principal. Note how a mixed referencing style is used to move
across the various cells.

Figure 30: Calculated loan repayment amounts using PMT

40
RATE (nper, pmt, pv, [fv], [type], [guess])
Let’s consider a loan of R 5 000 where you pay R100 monthly for 60 months. From Figure 31,
the number of period in months found in M9 is 60 months, the monthly payment M8, and the
loan amount in M7.

Figure 31: Using the Rate function on a loan repayment

The entire formula is multiplied by 12 to get the annual percentage rate as the period is in
months.

Figure 32: Calculated interest rate

The calculation returns an interest rate of about 7% as shown in Figure 32.

41
FV (rate, nper, pmt, [pv], [type])
Consider the following data provided in the

Figure 33: Data for FV calculation

From Figure 33, the present value is R25 000, compounded monthly, over a 15 year period at
yearly rate of 4%. The rate is given in terms of the cells as D24/D26, the total number of
payment periods is given by D25*D26 which is 15*12, since we are calculating the future value,
and not doing any payment, we put 0 there and finally the present value is our R25 000 found
in cell D23. The present value is negated for future value calculation.

Figure 34: FV formula with the cells

The result for our future value calculation is shown below.

42
Figure 35: Calculated value for FV

Self-Study

• PPMT
• IPMT
• NPER
• PV

43
Class Activity 3

Important
• Each activity is supposed to only assess your personal progress and not for marks.
However, you are expected to complete and upload to vula on completion.
• If you are unable to able to complete the class activity during the practical session, kindly
talk to myself or a tutor present

2a - 1

This activity uses a modified dataset from our assignment in during Week 2 to under nested
functions and conditional statements. For activities 3-1 and 3-2, you download the
dataset Activity_2a_AuntAgatha.xlsx. In this activity, we are going to look at some string,
date, numeric functions, and nested functions.
1. Insert a new column next to the Client column found in column C. To do this, select column
C as shown in the diagram below and insert a new column. You should also know how to
do this by now if you have gone through the notes.

2. In cell C7, label the header Day


3. Enter the formula “=TEXT(B8;”dddd”)” in cell C8. This will produce the day of the week on
which a transaction was made. Note: In some versions of excel, you will have to use a comma
(,) to separate attributes in a function e.g.=TEXT(B8,”dddd”)

4. Use autofill to fill the range that follows


5. In cell M19, enter Sunday and use the fill handle to fill the range M20:M25
44
6. Right-align range M19:M25
7. In cell M18, enter the text, Day of Week, and in N18 enter the text Count of Day, make font
in both cells bold, apply background White, Background 1, Darker 15%, and top and bottom
borders.
8. Input the formula ”=COUNTIF($C$8:$C$107;M19)” in cell N19. Use the fill handle to fill for
the rest of the week (up to N25). Centre the contents of range N19:N25, and apply bottom
border to range M25:N25. Can you think of using other formulas 3 to achieve the same
result?
9. In range M29:M31 enter the categories 1-3, enter the label Category in cell M28, and
Category Count in N28. Apply the same format as we did in Step 8
10. In cell N29, enter a formula that will count the number of categories like we did in Step 8
and autofill the remaining cells

2a - 2
This activity will help your understanding of logical and conditional functions. Auntie Agatha’s
Bakery has three price divisions based on whether a client belongs to categories 1, 2, or 3, and
her commissions are also based on the quantity of bread sold by the clients as shown on the
worksheet. The commissions are given as 15,5% if the client cells less than nor equal to 20
loafs of, 20% for quantity greater than 20 and less than 80, and finally the client earns 25%
commission if the quantity sold is greater than 80. Category 3 produces the highest sales. We
want to use conditional formatting to identify the various categories.

Note: In some versions of excel, decimal separators are denoted using a full-stop (.) e.g., 15.5%

1. In cell G8, we will use an if statement to computer the Amount. Enter the formula
“=IF(E8=$N$5;$N$6*F8;IF(E8=$O$5;F8*$O$6;$P$6*F8))” . Here, the IF function is being used
to calculate the amount based on the category described. Take note the way relative
referencing is used
2. Use autofill to copy the formulas the cells the that follow
3. Enter the formula ”=IF(F8<=20;G8*$N$10;IF(AND(F8>20;F8<80);G8*$O$10;G8*$P$10))” in cell
H8. This is also based our condition earlier. This nested IF formula with a logical statement.
Try and rewrite the formula in another way to product the same thing, the flexibility is
endless

3
Try “=SUMPRODUCT(1*($C$8:$C$107=M19))” or the Array Formula “=SUM(IF(C8:C107=M19;1))” and
CTRL+Shift+Enter.

45
4. Use autofill to copy the formulas to the cells below
5. In cell I8, enter a formula to calculate the Amount earned from each transaction and use
autofill to copy the formulas over the remaining cells
6. In range E108:E110, enter the texts TOTAL-Category 1, TOTAL-Category 2, and TOTAL-
Category 3 respectively
7. Apply a background colour of White, Background 1, Darker 15% to range E108:I110, and
make the font bold.
8. Apply a bottom border to ranges A107:I107 and E110:I110 respectively
9. Enter TOTAL in cell E111 and use the format painter too to copy the format from E110
10. Calculate the total amount sold per category. Enter “=SUMIF($E$8:$E$107;1;$F$8:$F$108)” in
cell F108. Modify the formula to obtain the total amount per category in range F109:F110
11. Use a SUM function to calculate the totals in F111 for all three categories
12. In ranges G108:G110, H108:H110, and I108:I110, apply a similar formula to calculate the
Amount, Client Amount Earned, and Amount (Less Commission) for each category
13. Format range G108:I111 as currency
14. Create a new code using the Transaction No and Client. To do so, insert a new column after
the Transaction No column. You should how to do so by now. Label cell B7 as TransClient
Code
15. In cell B8, let’s use the concatenate function to merge the two from the columns. Enter
“=CONCATENATE(A8;"-";E8)”. As seen from the formula, we are combining the Transaction
No which is an integer and the Client code/text. We have a dash between the two.
16. Apply autofill to copy the formulas down the range
17. Select range F8:F107 and apply conditional formatting. On the home tab choose
Conditional Formatting > New Rule... Use a 3-Color Scale, let the Minimum, Midpoint and
Maximum be set to Number with the numbers 1, 2, and 3. Leave the first two default
colours for 1 and 2, and change the last one to Green, then click on OK

46
2a - 3

This activity will be on using the PMT function for loan repayment. Assume that you want to
calculate the monthly loan repayments on a loan amount of R 15 000 to be paid off in 5 years.
An annual interest rate of 5% is charged.

1. Open a new worksheet and call it Financial


2. In cell B2, enter Loan Repayment Calculator, increase the font size to 14, format bold and
merge cells B2:C2. Change background colour to Blue, Accent 1, Lighter 40%
3. Enter Loan Amount, Periods, Interest Rate in range B4:B6 respectively, and Monthly
Payment in B8
4. Enter the corresponding figures in the adjacent range – C4:C6; R15 000, 5, and 5%
respectively
5. In cell C8 let’s use the PMT formula to calculate the loan repayment amount. Take not that,
the Period of payment is over 5 years, but it has to be in months so we multiply by 12, and
since our interest rate is an annual rate, it will be divided by 12. Enter the formula
“=PMT(C6/12;C5*12;C4) “

47

You might also like