0% found this document useful (0 votes)
70 views

MS Excel Notes

Uploaded by

bikadhoraphael
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

MS Excel Notes

Uploaded by

bikadhoraphael
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 34

MICROSOFT EXCEL

Microsoft Excel is an excellent program for organizing, formatting, and calculating


numeric data. Excel displays data in a row-and-column format, with gridlines
between the rows and columns, similar to accounting ledger books or graph paper.
Consequently, Excel is well suited for working with numeric data for accounting,
scientific research, statistical recording, and any other situation that can benefit
from organizing data in a table-like format. Teachers often record student grade
information in Excel, and managers often store lists of data—such as inventory
(stock) records or personnel records—in Excel. As you work through this course,
you’ll learn how Excel makes it easy to perform calculations on numeric data and
provides dozens of ways to format data for presentation purposes, including charts
and reports.

Creating a Workbook
You start Excel by using any of the methods that you use to start other Microsoft
Windows programs. One common method is clicking the Start button, pointing to All
Programs, and choosing Microsoft Office then Microsoft office Excel on the
submenu. You can also click a shortcut icon, if one exists, on the desktop or on the
Quick Launch bar.
When you start Excel, a blank workbook, titled Book1, opens by default. A
workbook is a file that can contain multiple worksheets. In turn, a worksheet is a
grid of rows and columns in which you can enter data. For example, you might
create four budget worksheets in a single workbook, with each worksheet
containing a budget for one quarter of the upcoming fiscal year. If you’re a teacher
using Excel, you might create grading worksheets in the same workbook, with each
worksheet storing grade records for a semester of the same class. As you can see, a
workbook allows you to assemble worksheets that contain related data. After you
create a workbook, you can save it as a single file on your hard disk.
On the Windows taskbar, click the Start button, point to All Programs, Microsoft
Office and click Microsoft office Excel e.g. 2007. Excel opens with Book1 ready
for you to use. Title bar

1
Tool
bar Formula bar Ask a question box

Menu bar

Workbook
window

The following table describes the elements in the Excel window. Status bar

Element Description
Title bar Identifies the current program and the name of the current workbook.
Menu bar Lists the names of the menus in Excel.
Toolbars Give you quick access to functions that you use frequently, such as
formatting, aligning, and totaling cell entries. The Standard and
Formatting toolbars appear by default.
Name Box Displays the address of the active cell.
Formula Bar Displays the contents of the active cell.
Task pane Lets you open files, paste data from the Clipboard, create blank
workbooks, and create Excel workbooks based on existing files.
Ask A Displays the help topics that match your request, when you type a
Question box question in the box.
Status bar Displays information about a selected command. It also indicates the
status (on or off) of the Caps Lock and Num Lock keys.
Scroll bars Include a vertical and a horizontal scroll bar and four scroll arrows,
each of which is used to display different areas of the worksheet.

2
Select All Selects every cell in a worksheet.
button
Sheet tabs Let you display worksheets in the open workbook.
Worksheet A grid of vertical columns (identified by alphabetic characters) and
horizontal rows (identified by numeric digits). Columns and rows
intersect to form cells. Each cell can be identified by a full-cell
reference, or address, consisting of the column and row coordinates
of that cell—for example, B3.
Active cell The cell, designated by a thick border, which will be affected when you
type or edit data.
Minimize Minimizes the window to a button on the taskbar.
button
Maximize/ Toggles (switches back and forth) between maximizing a window and
Restore Down restoring a window to its previous size.
button
Close button Closes the window on which the button appears.

3
In this exercise, you will work with Excel window elements.
1 clicks Insert button on the menu bar to view different Charts Wizard.
A ScreenTip appears, displaying the different Chart Wizards.
2 Point to the Name Box, which contains the cell address A1.
A ScreenTip appears, displaying the title Name Box.
3 Click Home button on the menu bar to access different Tools at the
Formatting toolbar.
A menu with tool options appears.

4 Position your mouse pointer over each newly displayed tool button.
A ScreenTip appears to explain each button.

Selecting Cells
Before you can enter data into a worksheet, you must identify the cell (the
intersection of a row and a column) in which you want to put the data. This is known
as selecting the cell. You can select a single cell, a row, a column, and groups of
adjacent and nonadjacent cells.
To select a single cell, simply click that cell. When a cell is selected, a black border
surrounds it, and that cell becomes the active cell.
You can select all of the cells in a worksheet by clicking the Select All button at the
top-left corner of the worksheet.

Select all
button

4
You can select a single row or column in a worksheet by clicking the corresponding
row or column selector.

Selecting a Range of Cells


A range is normally identified by the references for its first and last cells with a colon
between them. For example, the vertical range extending from cell A1 to cell A9 is
identified as A1:A9. Likewise, the horizontal range extending from cell C3 to cell G3
is identified as C3:G3. Ranges that extend across a block of columns and rows are
identified by the addresses for the cells in the top-left and bottom-right corners of
that block (C5:F9), as shown in the following illustration.

You select a range of cells by dragging the mouse pointer over the cells. When you
select a range of cells, the first cell chosen becomes the active cell. The active cell is
white, and the range of cells is blue.
In this exercise, you select a group of adjacent cells in the current worksheet.
1 Click cell E3, hold down the mouse button, drag the mouse pointer down to
cell E12, and release the mouse button.
The range E3:E12 is selected, and E3 remains the active cell.

Entering Text in a Worksheet


You can enter three basic categories of data in an Excel worksheet: text, numbers,
and formulas. To enter text or numbers in a cell, you select the cell and type the
information. As you type, each character appears in the Formula bar and in the
active cell, along with the insertion point. The insertion point indicates where the
next character will be inserted.
A text entry, which is sometimes called a label, is one that contains the characters A
through Z, or any other character that doesn’t have a purely numeric value.
Sometimes a text entry includes numbers, such as in a street address.
By default, a text entry appears left-justified in a cell. If the entry is longer than the
defined width of the cell, it either “spills over” into the adjacent cell (if that cell is

5
empty), or it appears in truncated form (if the adjacent cell is not empty). Internally,
however, the text is stored in only one cell and includes each character originally
entered.

Entering Dates in a Worksheet


Dates in Excel worksheets can be represented using only numbers or a combination
of text and numbers. For example, January 22, 2004, and 1/22/04 are two ways of
entering the same date. Like text, dates are often used as row and column labels.
But unlike text, dates are considered serial numbers; they are sequential and can be
added, subtracted, and used in calculations.
Be careful when representing a year with just the last two digits of the year. Excel
interprets two-digit years from 00 to 29 to represent the years 2000 to 2029; two-
digit years from 30 to 99 are interpreted as 1930 to 1999. The default year format
uses two digits; however, it is a good idea to type four-digit years and avoid
ambiguity.

Editing Cell Contents


After you have entered data in a cell, you can easily change the contents of the cell.
However, you must first double-click the cell or click the cell and click in the Formula
bar. Either of these actions puts Excel in Edit mode, which you can verify by checking
that the word Edit appears in the Status bar. After that, you type and press the
Delete or Backspace key to edit the data in the cell. When Excel is in Edit mode, two
buttons appear to the left of the Formula bar: Cancel and Enter.

Moving Between Worksheets


Each Excel workbook is made up of individual worksheets. This gives you the
flexibility to group worksheets with similar subject matter together in one
workbook. By default, a new workbook contains three blank worksheets. More
worksheets can be added as needed and unused worksheets can be deleted if
desired. The names of the sheets appear in tabs along the bottom of the workbook
window.

In this exercise, you view two worksheets within the same workbook.
1 Click the Sheet2 tab at the bottom of the workbook window.
Sheet2 and its contents appear. The worksheet is blank.
6
2 Click the Sheet1 tab at the bottom of the workbook window.
Sheet1 and its contents reappear.

Naming and Saving a Workbook


When you finish entering and editing data in a workbook, you need to name and
save the workbook on your hard disk so that the information will be available the
next time you start your computer. Saving workbook files is similar to saving other
types of files in Windows programs. The first time you save a workbook, you need to
name it and specify in which folder you want to save it. You can save it in a folder on
your computer’s hard disk or, if your computer is connected to a network, on a hard
disk in a different computer. You can even create a folder in which to save the
workbook by using tools within Excel. After you’ve saved a workbook, you can just
click the Save button on the Standard toolbar to save any changes you made after
the last time you saved. The workbook will be saved with the same name and in the
same place.
If you want to save the workbook with a different name or in a different folder, you
can make those changes by performing the same steps that you performed when
you saved the workbook for the first time. As with any other Windows file, a
workbook’s name can be up to 255 characters long, but it can’t contain any of the
following characters:
/\><*?“|:;
Opening a Workbook
After you save an Excel workbook, you can reopen it at any time to review its
contents and make changes. Excel keeps track of the last four workbooks you
opened and places their file names at the bottom of the File menu.

Renaming a Worksheet, By default, the worksheets in each Excel workbook are


named Sheet1, Sheet2, and Sheet3. Just as giving a unique name to your workbook
helps you remember what is in it, renaming a worksheet can remind you of its
contents.
In this exercise, you give a worksheet a different name.
1 Double-click the Sheet1 sheet tab.
Sheet1 is selected within the tab.
2 Type Directory, and press Enter.
Directory appears in the sheet tab.

7
Previewing and Printing a Worksheet
After a worksheet is complete, you can preview and print its contents. To print a
worksheet, you begin by displaying the Print dialog box. In this dialog box, you can
change most print settings, preview the data, and print the worksheet.
The distinguishing feature of a spreadsheet program such as Excel is that it allows
you to create mathematical formulas and execute functions. Otherwise, it is not
much more than a large table for displaying text. This page will show you how to
create these calculations.

Operators in Excel

(a) Arithmetic Operators


OPERATOR DESCRIPTION
+ (Plus) Addition
- (Minus) Subtraction
* (Asterisk) Multiplication
/ (Forward slash) Division
^ (Curate) Exponential
% (Percent) Percentage

(b) Comparison Operators


OPERATOR DESCRIPTION
< Less than
> Greater than
= Equal to
<> Not equal to
>= or => Greater than or equal
to

(c) Logical Operators


Operator Description
AND Logical and, returns true if both expressions are true
OR Logical or, returns true if either of the expressions is true
NOT Logical not, returns false if the expression is true and true if the
8
expression is false
() Parenthesis for grouping
TRUE Returns logical value True
FALSE Returns logical value False

Building a Formula in Excel


To build a formula, we must begin with equal signs in the cell where we want the
result to appear. Then we make use of cell addresses of the cells containing the
actual data items.
For example suppose we enter the following values 10, 20, 5, 25, 40, 25, 40, 18, 2,
15 in cell addresses, C1, C2, C3, C4, C5, C6, C7, C8, C9 and C10 and we want the
result to appear in cell C11 then we type the following formula
=(C1+C2+C3+C4+C5+C6+C7+C8+C9+C10) in cell C11

Functions in Excel
Functions shorten formulae. For example, to add the values in the cellsC1 to C10,
the formula is =(C1+C2+C3+C4+C5+C6+C7+C8+C9+C10). If a function is used, we
need to type only =SUM (C1:C10)
Complex formulae can be created using functions and some tasks can be
accomplished only by using functions
For example, to display the current date and time use TODAY () and NOW ()
functions.
Mathematical and Statistical Functions
(a) SUM ()
It is a mathematical function used to add the numeric value in a range of cells. A
maximum of 30 arguments can be provided
It has the syntax below:
=SUM(range)
Example Description
=SUM(C5:C10) Total of numbers in the range C5 to C10
=SUM(C5,C7,C10,D5) Total of numbers in the cells C5,C7,C10
and D5

9
(b) AVERAGE ()
It is a statistical function used to calculate and return the average (arithmetic mean)
of numeric values in the range of cells. It has the syntax below:
=AVERAGE(range)
Example Description
=AVERAGE(C5:C10) Average of numbers in the range C5 to C10
=AVERAGE(C5,C7,C10,D5) Average of numbers in the cells C5,C7,C10
and D5
(c) PRODUCT ()
Multiplies values in a range of cells and returns the result in a specified cell.
Its syntax is given below;
=PRODUCT(range)
(d) MODE()
it is a statistical function that returns the most frequently occurring value in a set of
values
its syntax is;
=MODE(range)
(e) MAX()
It is a statistical function that returns the largest value in the range.
It has the syntax below:
=MAX(range)

Example Description
=MAX(C5:C10) Highest value in the range C5 to C10
=MAX(10,5,18,7) Highest value 18
(f) MIN ()
It is a statistical function that returns the lowest value in the range
It has the syntax below:
=MIN(range)
(g) COUNT()
It is a statistical function that counts the number of cells that contain numbers in the
specified range
It has the syntax
=COUNT(range)

10
TEXT FUNCTIONS
E.g. suppose the cell B1 contains a text DESIGNATION
(a) LEN() Returns the length of a text string. Spaces are counted as characters
Syntax:
=LEN(string)
EXAMPLE RESULT
=LEN(B1) 11
=LEN(“NAME”) 4
(b) LEFT()
Returns the specified number of characters form the left side of a text string. If the
number is not specified, it returns the first character. Its syntax is given below:
=LEFT(String, number)
EXAMPLE RESULT
=LEFT(B1,5) DESIG
=LEFT(B1) D
=LEFT(“NAME”,3) NAM
(c) RIGHT()
It is the opposite of the former. Its syntax is given below:
=RIGHT(String, number)
(e) UPPER()
Coverts all lower case letters in a text string to upper case. Its syntax is given below:
=UPPER(String)
EXAMPLE RESULT
=UPPER(B1) DESIGNATION
=UPPER(“clean me”) CLEAN ME
(f) LOWER().
It’s the opposite of the former. Its syntax is given below:
=LOWER(String)
Logical Functions
The functions are used to see whether a condition is true or false or to check for
multiple conditions.
1. IF()
11
The function IF is used to determine whether a condition is true or false: One value
is returned if the condition is true, and a different value is returned if the condition
is false.
Its syntax is given below:
IF(condition, true action, false action)

Formulas
Formulas are entered in the worksheet cell and must begin with an equal sign "=".
The formula then includes the addresses of the cells whose values will be
manipulated with appropriate operands placed in between. After the formula is
typed into the cell, the calculation executes immediately and the formula itself is
visible in the formula bar. See the example below to view the formula for calculating
the sub total for a number of textbooks. The formula multiplies the quantity and
price of each textbook and adds the subtotal for each book. The interface below is
for MS Office 2003

Linking Worksheets
You may want to use the value from a cell in another worksheet within the same
workbook in a formula. For example, the value of cell A1 in the current worksheet
and cell A2 in the second worksheet can be added using the format "sheetname!
celladdress". The formula for this example would be "=A1+Sheet2!A2" where the
value of cell A1 in the current worksheet is added to the value of cell A2 in the
worksheet named "Sheet2".

Relative, Absolute, and Mixed Referencing


Calling cells by just their column and row labels (such as "A1") is called relative
referencing. When a formula contains relative referencing and it is copied from one
12
cell to another, Excel does not create an exact copy of the formula. It will change cell
addresses relative to the row and column they are moved to. For example, if a
simple addition formula in cell C1 "=(A1+B1)" is copied to cell C2, the formula would
change to "=(A2+B2)" to reflect the new row. To prevent this change, cells must be
called by absolute referencing and this is accomplished by placing dollar signs "$"
within the cell addresses in the formula. Continuing the previous example, the
formula in cell C1 would read "=($A$1+$B$1)" if the value of cell C2 should be the
sum of cells A1 and B1. Both the column and row of both cells are absolute and will
not change when copied. Mixed referencing can also be used where only the row
OR column is fixed. For example, in the formula "=(A$1+$B2)", the row of cell A1 is
fixed and the column of cell B2 is fixed.
Basic Functions
Functions can be a more efficient way of performing mathematical operations than formulas.
For example, if you wanted to add the values of cells D1 through D10, you would type the
formula "=D1+D2+D3+D4+D5+D6+D7+D8+D9+D10". A shorter way would be to use the
SUM function and simply type "=SUM(D1:D10)". Several other functions and examples are
given in the table below:

Function Example Description


SUM =SUM(A1:100) finds the sum of cells A1 through A100
AVERAGE =AVERAGE(B1:B10) finds the average of cells B1 through B10
returns the highest number from cells C1 through
MAX =MAX(C1:C100)
C100
returns the lowest number from cells D1 through
MIN =MIN(D1:D100)
D100
SQRT =SQRT(D10) finds the square root of the value in cell D10
returns the current date (leave the parentheses
TODAY =TODAY()
empty)
Function Wizard
View all functions available in Excel by using the Function Wizard.
 Activate the cell where the function will be placed and click the Function
Wizard button on the standard toolbar.
 From the Paste Function dialog box, browse through the functions by clicking
in the Function category menu on the left and select the function from the
Function name choices on the right. As each function name is highlighted a

13
description and example of use is provided below the two boxes-excel 2003

 Click OK to select a function.


 The next window allows you to choose the cells that will be included in the
function. In the example below, cells B4 and C4 were automatically selected
for the sum function by Excel. The cell values {2, 3} are located to the right of
the Number 1 field where the cell addresses are listed. If another set of cells,
such as B5 and C5, needed to be added to the function, those cells would be
added in the format "B5:C5" to the Number 2 field.

 Click OK when all the cells for the function have been selected.

Autosum
Use the Autosum function to add the contents of a cluster of adjacent cells.
 Select the cell that the sum will appear in that is outside the cluster of cells
whose values will be added. Cell C2 was used in this example.
 Click the Autosum button (Greek letter sigma) on the standard toolbar.
 Highlight the group of cells that will be summed (cells A2 through B2 in this
example).
 Press the ENTER key on the keyboard or click the green check mark button on
the formula bar .

Sorting and Filling Graphics »

14
Basic Sorts

To execute a basic descending or ascending sort based on one column, highlight the
cells that will be sorted and click the Sort Ascending (A-Z) button or Sort Descending
(Z-A) button on the standard toolbar.
Complex Sorts
To sort by multiple columns in excel 2003, follow these steps:
 Highlight the cells, rows, or columns that will be sorted.
 Select Data|Sort from the menu bar.
 From the Sort dialog box, select the first column for sorting from the Sort By
drop-down menu and choose either ascending or descending.
 Select the second column and, if necessary, the third sort column from the
Then By drop-down menus.

 If the cells you highlighted included the text headings in the first row, mark
My list has...Header row and the first row will remain at the top of the
worksheet.
 Click the Options button for special non-alphabetic or numeric sorts such as
months of the year and days of the week.

 Click OK to execute the sort.


Autofill
The Autofill feature allows you to quickly fill cells with repetitive or sequential data
such as chronological dates or numbers, and repeated text.
 Type the beginning number or date of an incrementing series or the text that
will be repeated into a cell.
15
 Select the handle at the bottom, right corner of the cell with the left mouse
button and drag it down as many cells as you want to fill.
 Release the mouse button.
If you want to autofill a column with cells displaying the same number or date you
must enter identical data to two adjacent cells in a column. Highlight the two cells
and drag the handle of the selection with the mouse.

Alternating Text and Numbers with Autofill


The Autofill feature can also be used for alternating text or numbers. For example,
to make a repeating list of the days of the week, type the seven days into seven
adjacent cells in a column. Highlight the seven cells and drag down with the mouse.
Autofilling Functions
Autofill can also be used to copy functions. In the example below, column A and
column B each contain lists of numbers and column C contains the sums of columns
A and B for each row. The function in cell C2 would be "=SUM(A2:B2)". This function
can then be copied to the remaining cells of column C by activating cell C2 and
dragging the handle down to fill in the remaining cells. The autofill feature will
automatically update the row numbers as shown below if the cells are reference
relatively.

Charts Page Properties and Printing »

Charts allow you to present data entered into the worksheet in a visual format using
a variety of graph types. Before you can make a chart you must first enter data into
a worksheet. This page explains how you can create simple charts from the data.
Chart Wizard
The Chart Wizard brings you through the process of creating a chart by displaying a
series of dialog boxes.

16
 Enter the data into the worksheet and highlight all the cells that will be
included in the chart including headers.

 Click the insert button on the menu bar and select the Chart type of your
choice i.e. column graph, pie chart, line graph, bar graph etc.
 Chart Location – right click and move chart to a location

Resizing the Chart


To resize the chart, click on its border and drag any of the nine black handles to
change the size. Handles on the corners will resize the chart proportionally while
handles along the lines will stretch the chart.
Moving the Chart
Select the border of the chart, hold down the left mouse button, and drag the chart
to a new location. Elements within the chart such as the title and labels may also be
moved within the chart. Click on the element to activate it, and use the mouse to
drag the element to move it.
Chart Formatting Toolbar: right click and format the chart as expected
Change chart Type – right Click and change chart type.
You can copy chart to word

17
Practical questions

1. TABLE SHOWING MILK CONSUMPTION


NAME NUMBER OF LITRES PRICE PER TOTAL
LITRE COST
John 23 1000
James 6
Kato 36
Mukasa 15
Calculate the following.
(i) The Total cost for each persons consumption.
(ii) Total number of litres sold.
(iii) The lowest consumption.
(iv) The highest consumption.
(v) Average consumption
(vi) The count of consumption.
(vii) Align the Names in the table left, and the figures to the right.
(viii) Draw a column graph with a title X and Y-axis represented
18
Question 2
Examination marks table
COURSE
NAME THEORY PRACTICAL WORK FINAL MARKS
John
Mpezi 60 39 20
Peter
Notu 70 50 25
John
Bantude85 60 21
Jane
Meta 55 29 85
(a) Find the total marks for each student
(b) Sort the table by name in ascending order and copy the result to sheet2
(c)Filter the students that scored practical over 55%
(d) Draw a graph copied to sheet2 and show percent on it.
(e) Use the if condition to create a remark that a student who has scored a total
mark less than 139 as failed, else the others who have scored greater have
passed.
Question 3
Enter the data into a worksheet
POLICE PAYMENT TABLE
PAYROLL FOR THE MONTH OF JUNE 2001 for UGANDA POLICE
NO SURNAME OTHER TITLE MARITAL BASIC ALLOWANCE
NAMES STATUS PAY
1 Kasirye Ignatius SSP MARRIED
2 Rwabushaij Margaret ASP SINGLE
a
3 Komugisha Rovincer SP DIVORCED
4 Kimbugwe Mariam SP DIVORCED
Nankya
5 Oloyi Ignatius ACP MARRIED
6 Ameeda Agnes ASP DIVORCED
7 Mudali Davis SP SINGLE

19
(A) Generate the basic pay using the IF statement assuming that it’s paid
according to title as shown below.
Title Basic Pay
ACP 700,000
SP 444,000
SSP 300,000
ASP 639,000

(B) Generate the allowances using the IF statement assuming it’s paid according
to the marital status as shown below:
Marital Status Allowance
Married 850,000
Divorced 980,000
Single 350,000
© Sort by title and add sub totals for basic pay for each title.
(d) Auto format the table using the auto format style called list1.

QUESTION 4
A B C D E
1 NAME SEX BANK DEPT. SALARY
2 SARAH F UCB FN. 300000
3 TOM M NILE ACCTS 200000
4 TIM M BOU ADM 600000
5 BEN M UDB FN. 500000
Write down formulas to compute the following
i. Total amount of salary earned by the employees
ii. Minimum salary
iii. Maximum salary
iv. Count of salary
v. Average salary
QUESTION 5

A B C D E F H I
1 NAME BASIC HOUSING TRANSPORT MEDICAL GROSS NSSF NET
2 JOHN 100000 30000 10000 20000

20
3 SARAH 120000 40000 20000 22000
4 ANYAU 200000 60000 30000 25000
Questions:
Write down formulas to:
a. Calculate the GROSS pay for employee
b. Charge 5% of gross pay to get NSSF.
c. Calculate the PAYE (Pay as You Earn), which is charged at 10% of Gross
pay.
d. Calculate the Net pay for employee

Question6
a. The table below shows students/pupil selection to Senior One.

A B C D E F G
1 PUPID ENG MATHS GP AGGREGATE AVERAGE REMARKS
2 P001 4 2 1
3 P002 6 9 2
4 P003 1 3 2
5 P004 6 9 4

(i) Write a formula you would enter in E2 to compute the total aggregate mark.

(ii) Write a formula you would enter in F2 to compute the average mark.
(iii) Write a formula you would enter in G 2 to comment on whether a pupil is in first
grade or other grade
Note: If total aggregate mark is less than 8 a pupil was in “First Grade” otherwise
“Other grade”.
(iv) Write formulas in H2 and I2 to compute the poorly and best done subjects
respectively.

Excel Sort
Sorting in Excel lets you easily reorder your data based on the type of sorting that
you choose. This lesson will show you how to do a normal and reverse alphabetical
sort, as well as descending numerical ordering.

21
Raw Unordered Data
Imagine that you were teaching an English class and just collected the homework
assignment for that day. The papers are in no special order, but you know that Excel
can sort it all out for you anyways. You plough through the jumble of papers and
enter the data into Excel, ending up with something that looks like...

With the data entered you are now ready to begin sorting in Excel.
Excel Sorting: Alphabetical Order (Ascending)
The most common type of sorting, and one that is applicable to our situation, is
alphabetical ordering. This kind of ordering places the cells that start with the early
letters of the alphabet (a, b, c...) at the top and the later letters (t, u, v...) at the
bottom of the list.
1. First we need to select all the data so we can begin to sort it. Because each
name has a corresponding score we need to select both columns to preserve
the students' correct scores.
2. Left-click and hold on cell A1 then drag down-right to cell B10 to highlight all
the data for sorting! Your spreadsheet should look like this:

3. Left-click the "sort ascending" button, located near the top, on the shortcut
bar (it has a blue A on top and a red Z on bottom with a downward pointing
arrow).

22
4. Your spreadsheet should now be sorted.

Notice that your column titles (Name and Score) have not been included for sorting
because Excel is smart enough to know that you do not want these special cells (A1
and B1) included.
Reverse Alphabetical Order (Descending)
The steps for reverse alphabetical order are the same as above, except that you
need to click the "sort descending" button instead.
1. Select the data you wish to sort (left-click in cell A1 and drag down-right to
B10)

2. Left-click the "sort descending" button, located near the top, on the shortcut
bar (it has a red Z on top and a blue A on bottom downward pointing arrow).
3. Your spreadsheet should now be sorted in reverse alphabetical order.

Numerical Ordering
If you wanted to instead sort the homework assignments by highest to lowest score
you would follow these steps to use Excel's numeric sorting. The only difference
between this example and our previous examples is which column you start your
selection from, so pay close attention to the first step!

23
1. Left-click cell B1 and drag down-left to cell A10

2. Left-click the "sort descending" button, located near the top, on the shortcut
bar (it has a red Z on top and a blue A on bottom with a downward pointing
arrow).
3. Your Excel data should now look like:

Congratulations, you now know how to sort columns of both numbers and words in
Excel!
Note: Be sure that you select your data before going to the manual sorting feature.
This will let Excel know which data you want to sort.

Excel - If Statement (simple if statement)


An If Statement is used in Excel to do certain actions only if something is true. For
example, you might want to print out the message "We are losing money" if total
sales for the quarter are below some amount. Otherwise, you'd just want to print
out "We're making money!"
The IF function lets you do these kinds of value based decisions. This lesson will
show you a couple basic examples of how you can make use of the IF function.
Excel - IF Function
The IF function needs to have some sort of comparison to operate properly. A very
common type of comparison is greater/less than (>/<). These math symbols can be
used to form logical expressions like "A2 < 40000", which in English means "Cell A2 is
less than 40000".
Now that logical expression can be either true or false and the IF function lets you do
something for each result. In this little example we will be making our IF function
print out something our boss might say.
Your excel spreadsheet should look like this:
24
Excel - IF Function's 3 Parts
The IF function has three parts:
1. The comparison you will be doing. We are using A2 < 40000
2. What to do if the If statement is true
3. What to do if the If statement is false
If all that information is confusing to you, don't worry, Excel has a built in wizard to
help you make your own If functions.
1. Go to the Insert menu and choose Function
2. Select the Logical functions from the drop down selector

3. Choose the IF function and click OK


4.

5. Put "A2<40000" as the logical expression


6. Put "We are losing money?" as the true value
7. Put "We are making money!" as the false value

8. Press OK
Because our sales were only $30,000 the if statement should be printing out "We
are losing money?"

Else

25
Notice that when the value of A2 was $30,000 it was less than $40,000 and our IF
function was set to print out "We are losing money?" when A2 was less than
40,0000. However, when we changed the value of A2 to $50,000 the IF statement
was now false and it printed out "We are making money!"

IF Function Syntax
The syntax of the IF function is =IF(logical test, value if true, value if false). The
logical test is any value or expression that Excel evaluates as true or false. Some
examples of expressions are B4>C4, B7<100, and
B8<=999.
Suppose you want to display a warning message if the nutrient content of Vitamin A
in cell B4 is less than 50% and display the message “Value is at least 50%” if not low.
You could use the formula: =IF(B4<50%, “Value is less than 50%!”,”Value is at least
50%”).

Practice: Using the IF Function to Evaluate a Product


Use the IF function to calculate whether the Slim Slurp product or the PowerPunch
product contains the higher potency of each nutrient.
1. In cell D4, enter the IF function that indicates which product has the higher
potency of Vitamin A: =IF(B4>C4, “Slim Slurp”, “PowerPunch”)
2. Make sure the text Slim Slurp appears in cell D4.

3. If the text in cell D4 is correct, replicate this formula from cell D4 through cell
D20.

26
4. Next, enter a formula using the IF function that prints “Low” if any
PowerPunch nutrient falls below 75%, but if the value is at least 75%, it prints
a blank. To print a blank, just put a space in between the quotation marks.
5. Save your work.

Nested IF Statements
Remember that the IF function returns one value if a condition is TRUE and another
value if it is FALSE. From the previous exercise, you entered an IF function using the
syntax =IF(logical_test,value_if_true,value_if_false). A logical test is any value or
expression that can be evaluated to TRUE or FALSE. For example, A10=100 is a
logical expression; if the value in cell A10 is equal to 100, the expression evaluates as
TRUE. Otherwise, the expression evaluates as FALSE. This argument can use any
comparison calculation operator:
Comparison operator
Meaning (Example)

= (equal sign) Equal to (A1=B1)

> (greater than sign) Greater than (A1>B1)

< (less than sign) Less than (A1<B1)

>= (greater than or equal to sign) Greater than or equal to (A1>=B1)

<= (less than or equal to sign) Less than or equal to (A1<=B1)

<> (not equal to sign) Not equal to (A1<>B1)


Value_if_true is the value that is returned if the logical test is TRUE. For example, if
this argument is the text string "Within budget" and the logical test argument
evaluates to TRUE, then the IF function displays the text "Within budget". If the
logical test is TRUE and the value_if_true is blank, this argument returns 0 (zero). To
27
display the word TRUE, use the logical value TRUE for this argument. Also, the
value_if_true can be another formula.
Value_if_false is the value that is returned if the logical test is FALSE. For example, if
this argument is the text string "Over budget" and the logical test argument
evaluates to FALSE, then the IF function displays the text "Over budget". If the
logical test is FALSE and value_if_false is omitted, (that is, after value_if_true, there
is no comma), then the logical value FALSE is returned. If the logical test is FALSE and
value_if_false is blank (that is, after value_if_true, there is a comma followed by the
closing parenthesis), then the value 0 (zero) is returned. Value_if_false can be
another formula.
 Up to seven IF functions can be nested as value_if_true and value_if_false
arguments to construct more elaborate tests. See the last of the following
examples.
 When the value_if_true and value_if_false arguments are evaluated, IF
returns the value returned by those statements.
 If any of the arguments to IF are arrays (an ordered arrangement of data
elements), every element of the array is evaluated when the IF statement is
carried out.
 Microsoft Excel provides additional functions that can be used to analyze your
data based on a condition. For example, to count the number of occurrences
of a string of text or a number within a range of cells, use the COUNTIF
worksheet function. To calculate a sum based on a string of text or a number
within a range, use the SUMIF worksheet function.

Practice: Entering Nested IF Statements


1. Enter five test scores in column A as shown below:

2. In cell B2, enter the following formula using nested IF statements to assign a
letter grade to the first score. =IF(A2>89,"A",IF(A2>79,"B",
IF(A2>69,"C",IF(A2>59,"D","F"))))
3. Autofill the formulas by dragging down from the right bottom corner of the
cell when the cursor changes to a black cross to complete the column as
shown and save your work.
28
In the preceding example, the second IF statement is also the value_if_false
argument to the first IF statement. Similarly, the third IF statement is the
value_if_false argument to the second IF statement. For example, if the first
logical_test (Average>89) is TRUE, "A" is returned. If the first logical_test is FALSE,
the second IF statement is evaluated, and so on.
The letter grades are assigned to numbers using the following key.

If Score is Then return


Greater than 89 A
From 80 to 89 B
From 70 to 79 C
From 60 to 69 D
Less than 60 F

More about Nesting Functions within Functions


In certain cases, you may need to use a function as one of the arguments of another
function. For example, the following formula uses a nested AVERAGE function and
compares the result with the value 50.

Valid returns When a nested function is used as an argument, it must return the
same type of value that the argument uses. For example, if the argument returns a
TRUE or FALSE value, then the nested function must return a TRUE or FALSE. If it
doesn't, Microsoft Excel displays a #VALUE! error value.
Nesting level limits A formula can contain up to seven levels of nested functions.
When Function B is used as an argument in Function A, Function B is a second-level
function. For instance, the AVERAGE function and the SUM function are both
second-level functions because they are arguments of the IF function. A function
nested within the AVERAGE function would be a third-level function, and so on.
Example 1
29
If(mark>50,”PASS”,”FAIL”), will display a PASS if values are more than 50else it will
display FAIL
Example 2
Consider the spreadsheet below
A B C D E F
1 Name Designation Salary Age Tax Net pay
2 Abigail Officer 2500 26
3 Issac Manager 3750 24
4 Ruth Trainer 1550 29
5 Jackson Officer 2200 30

Suppose Tax is to be decided based on salary, according to the table


Salary Tax(on salary)
<2500 10% of salary
>=2500 25% of salary
Fill in the Tax column and Net pay column
We use the formula =if(C2<2500,C2*10%,C2*25%) to compute Tax
Net pay = Salary-Tax
Example 3
Suppose Tax is to be decided based on salary according to the table
Salary Tax(on salary)
<1500 10%
1500-2500 15%
2501-3500 20%
>3500 25%
We use the formula
if(C2<1500,C2*10%,if(C2<=2500,C2*15%,if(C2<3500,C2*20%,C2*25%))) to compute
the Tax
Exercise
Enter the information in the table below in a spreadsheet
Name Mark Grade
Mansa Musa 40
Jumba Jamil 89
Mukasa Hawa 60
Asio Angela 75
30
Dan 48
a) Compute the grades for each student using the information given in the table
below:
Marks Grade
<50 F
>=50 D
>=60 C
>=70 B
>=80 A
b) COUNTIF()
Counts the number of cells with in a specified range that meets a given condition its
syntax is give as: countif(range, criteria)
Using a formula, count the number of As and Fs
=countif(A2:A10,”A”)

Excel IF Statements, Part II: Nesting Functions

I taught you how to do simple IF statements based on one condition and one value if true or false.
This shows you how to do this with multiple conditions and multiple true/false values.

For this, let’s use some new data. Open a blank workbook in Excel and enter this data:

A B C D E

1 Name District Sales Emp. Yrs Job Level

2 Linda East $20,000.00 2

3 Joe West $42,302.00 9

4 Bill East $53,001.00 3

5 Mary South $12,000.00 12

31
6 Mark South $ 2,050.00 6

7 John North $9,000.00 0

8 Ted East $40,000.00 4

Let’s pretend this is data which shows your salespeople’s district, annual sales, and number of years
employed by your company. Now, let’s suppose you want a formula in column E that will assign a job
level based on two different criteria: Salespeople who have been employed for more than 5 years
AND have annual sales of more than $10,000 should be assigned a job level code of 2, and all others
should have a job level code of 1. To include two criteria, when both criteria must be met, you must
nest an AND function within your IF statement. Put this formula in cell E2:

=IF((AND(D2>5,C2>10000)),2,1)

Then, grab cell E2 by its fill handle and drag it down to cell E8 to “relatively” copy it to the rest of the
cells in column E.

You see this formula uses a nested AND function for its “logical test”. The AND function will decide if
both conditions are true. Remember, the IF function’s second and third arguments return a “value if
true” and a “value if false”, so if the AND function returns a “true”, a 2 will be placed in the cell and if
the AND function returns a “false”, a 1 will be placed in the cell. Excel will look into the deepest
nested function first, then work it’s way out, so the first thing it does is determine the result of the
AND function, then it goes out to the IF function and performs that, based on the results of the AND
function.

This formula, if entered correctly, should show job level code 2 for Joe and Mary only, because they
are the only two who have worked for the company more than five years AND had annual sales
greater than $10,000.

Similarly, you can use a nested OR function if you want a job level code of 2 to be applied if an
employee meets EITHER criterion, instead of both criteria. A nested OR function works the same way
as an AND function, except it will return the 2, if ANY of the criteria are met, instead of requiring that
ALL criteria are met.

Put this one in E2 now and copy it down to E8:

32
=IF((OR(D2>5,C2>10000)),2,1)

In this case, everyone is assigned a job level 2 except John, because he is the only one who did not
meet either criterion, since he has not worked for the company for more than 5 years OR had annual
sales greater than $10,000.

You can use more than two criteria in nested ANDs and ORs. Simply separate them by commas.

These examples work great when there are only two job levels, but what if there are more than two?
In this case, you will have more than two criteria and more than one value if true and value if false.

Let’s say we want to assign a job level 3 if the employee meets BOTH criteria above, a job level 2 if
the employee meets EITHER criteria above, and a job level 1 if the employee doesn’t meet any of the
criteria above.

Put this formula in E2 and copy it down to E8

=IF((AND(D2>5,C2>10000)),3,(IF((OR(D2>5,C2>10000)),2,1)))

Notice what we are doing here is basically nesting one IF statement within another. However, though
we have two different logical tests and two different values if true, we only have one value if false.
You can nest up to 7 IFs in one formula, so that means you can return up to 8 different results (7
different values if true and one value if false).

You can also nest multiple IFs if you want different results based on different values in the same cell.
For this example, let’s say all of the employees in the East district will be assigned a job level 4, the
West ones will be job level 3, the North ones will be job level 2, and the ones in the South will be job
level 1. Our formula would look like this:

=IF((B2="East"),4,IF((B2="West"),3,IF((B2="North"),2,IF((B2="South"),1,""))))

Note that the value if false is “”, which tells Excel to leave the cell empty if no match is found in
column B for that row. If you delete the contents of any cell in column B or change it to anything
other than East, West, North, or South, you will see the corresponding cell in column E would now be
empty. Remember, you must have something in your third argument (value if false) or Excel will
simply enter the text “FALSE” into that cell if it does not find a match.

I think I’ve given you enough information now, so you can build pretty extravagant IF statements. Just
remember that limit of seven nested IFs though, because there is no way to increase this using an IF
33
statement. However, when you really need more than eight conditions, there are other functions
that will serve you better than Nested IFs. One set of functions are the LOOKUP functions.

34

You might also like