Module 3 MS Excel
Module 3 MS Excel
Outline
• Microsoft Excel
• Functions in Excel (COUNTIF, SUMIF and AVERAGEIF Functions)
• Filtering & Sorting
• Conditional Formatting
• Data Validation
• Charts and Pivot Tables
Microsoft Excel is a spreadsheet application that can help you calculate and analyze
numerical information for budgets, company finances, inventory and more. It is composed
of cells that represented in rows and columns designed to perform basic arithmetic
operations. It is widely used in accounting and financial applications, as well as statistics
and engineering calculations.
Calculate with the use of Functions
A function is a ready-made formula in Microsoft Excel which performs a series of
operations. A function has its name and arguments and mathematical function in
parenthesis.
To use the function, do the following:
1. Encode the data on each cell.
2. Click the cell where you want to put the result of the computation.
3. Choose the Formulas tab and select fx Insert Function
Using fx (Insert Function)
How to Start Using COUNTIF, SUMIF, and AVERAGEIF in Excel
• COUNTIF - Used to count the number of times that "Restaurant" appears in the list.
• SUMIF - Calculates the total expense for items labeled "Restaurant."
• AVERAGIEF - Averages out all of my "Restaurant" expenses in the list.
Here's what each of those formulas do for you, and how you might use them to your
advantage:
SUMIF - Add values if a condition is met, such as adding up all purchases from one
category.
COUNTIF - Count up the number of items that meet a condition, such as counting the
number of times a name appears in a list.
AVERAGEIF - Conditionally average values; for instance, you could average your grades
for only exams.
Here's how the SUMIF formula works:
=SUMIF (Cells to check, what to check for, Sum of cells that meet the rules)
I want to know two things:
1. The total of what I spent at restaurants for the month.
2. All purchases greater than $50 for the month, from any category.
To find my total restaurant expense, I'll sum up all values with the expense type of
"Restaurant", which is in column B.
Here's the formula I'll use for this example:
=SUMIF(B2:B17,"Restaurant",C2:C17)
• This formula does three key things:
• Looks at what's in cells B2 to B17 for the category of expense
• Uses "Restaurant" for the criteria of what to sum up
• Uses the values in cells C2 to C17 to total up the amounts
Let's write a simple formula to find the sum of all purchases greater than $50:
=SUMIF (C2:C17,">50")
In this case, the formula is a bit simpler: since we're summing up the same values
that we're testing (C2 to C17), we just need to specify those cells. Then, we'll add a comma
and ">50" to only sum values greater than $50.
COUNTIF will count up the number of times something appears in a given set of data.
Here's the general format for the COUNTIF formula:
=COUNTIF (cells to count, criteria to count)
Let's count two key pieces of information:
• The number of clothing purchases I made in a month
• The number of purchases $100 or greater
My first COUNTIF will look at the expense type and count up the number of "Clothing"
purchases in my transactions.
The final formula will be:
=COUNTIF (B2:B17,"Clothing")
That formula looks at the "Expense Type" column, counts up the number of times it sees
clothing, and counts them. The result is 2.
let's count the number of transactions that were $100 or greater in my list.
Here's the formula I'll use:
=COUNTIF (C2:C17,">100")
AVERAGEIF can be used to average specific values, based on a condition that we'll give
Excel.
The format for an AVERAGEIF formula is:
=AVERAGEIF (Cells to check, what to check for, Average of cells that meet the rules)
Let's use the AVERAGEIF formula to calculate two key stats about my spending:
• The average of my restaurant expenses.
• The average of all expenses less than $25
To average my restaurant expenses, I'll write an AVERAGEIF formula to average all
amounts based on the category.
=AVERAGEIF(B2:B17,"Restaurant",C2:C17)
There are three parts to this formula, each separated by a comma:
B2:B17 specifies the cells to check a condition for. Since the expense type is specified in
this column.
"Restaurant" gives the formula something to look for.
Finally, C2:C17 are the cells to average out in our calculation.
Filtering Data
Filter allows you to better analyze your data. When data is filtered, only rows that meet the
filter criteria will display and other rows will be hidden. With filtered data, you can then
copy, format, print, etc., your data, without having to sort or move it first. To use a filter,
Go to the Home ribbon,
click the arrow below the
Sort & Filtering icon in the
Editing group and choose Filter.
You will notice that all of your column headings now have an arrow next to the heading
name. Click on the arrow next to the heading with which you want to filter, and you will see
a list of all the unique values in that column. Check the box next to the criteria you wish to
match and click OK. Click on the arrow next to another heading to further filter the data.
To clear the filter, choose one of these options:
Click on the Filter icon next to the heading and choose Clear Filter from “Name of Heading”.
Go to the Data ribbon and click the Clear icon in the Sort & Filter group.
Go to the Home ribbon, click the arrow below the Sort & Filter icon in the Editing group
and choose Clear.
Sorting Data
For a quick sort, click the arrow below the Sort & Filtering icon in the Editing group of the
Home ribbon and choose the Sort A to Z / Z to A icons in the Sort & Filter group of the
Data ribbon.
For a more complex sort, go to the Home ribbon, click the arrow below the Sort &
Filter icon in the Editing group and choose Custom Sort. This takes you to the same Sort
dialog box you get with the Sort icon in the Sort & Filter group of the Data ribbon.
1. Under Column, choose the first column that you would like to sort. If you want to
sort multiple columns, click the Add Level button.
2. Under Sort On, choose how you would like to sort. Note that Excel can sort by cell or
font color in addition to values.
3. Under Order, choose A to Z (ascending), Z to A (descending), or Custom List.
4. Click OK to perform the sort.
Tip 1: Skip to important data with highlighted cells
• Select your quantity column. In our case, it’s range C4:C26.
• In the ‘Home’ tab of the ribbon (that’s geek for the menu in the top with all the
buttons) click ‘Conditional Formatting’.
• Then hold your pointer over the option ‘Highlight cells rules’ and click ‘Less than…’
• In the left box, you enter the value that the cell content must be less than in
order to “trigger” the conditional formatting.
• So if you enter 100, something will happen when the value is less than 100. What
that “something” is we’ll define in the box to the right.
• As you see the standard option is “Light Red Fill with Dark Red Text”.
• If you just click OK now, all the quantities that are below 100 will be formatted this
way.
• If you want to change that (and you probably will) click the drop-down arrow next to
the right box and select one of the other presets.
• Click ‘Custom Format…’ and pick your favorite cell formatting for the cells that are
below 100.
Tip 2: Highlight cells that contain text
Example:
Look for all the M compatible adapters (in the sample file)
1. Select some data with text. In the sample file, we’ll select the range from B4 to B26.
So basically all our “Item” names.
2. Then click the ‘Conditional Formatting’ button on the ‘Home’ tab, hover your mouse
over ‘Hightlight Cells Rules’ and click ‘Text that Contains…’.
3. If you write “M compatible” in the left field, then all cells that contain the text “M
compatible” will be formatted as you chose in the right box.
So a cell containing more text than you write in the left field will “trigger” the conditional
formatting if some of the text is “M compatible”.
Tip 3: Delete a conditional formatting rule
Click the ‘Conditional Formatting’ button on the ‘Home’ tab and hover your mouse over
‘Clear Rules’
Then click ‘Clear Rules from Entire Sheet’.
Data Validation
Excel Data Validation is a feature that restricts (validates) user input to a worksheet.
Technically, you create a validation create a validation rule that controls what kind of data
can be entered into a certain cell.
• Here are just a few examples of what Excel's data validation can do:
• Allow only numeric or text values in a cell.
• Allow only numbers within a specified range.
• Allow data entries of a specific length.
• Restrict dates and times outside a given range.
• Restrict entries to a selection from a drop-down list.
• Validate an entry based on another cell.
• Show an input message when the user selects a cell.
• Show a warning message when incorrect data has been entered.
• Find incorrect entries in validated cells.
For example, you can set up a rule that limits data entry to 4-digit numbers between 1000
and 9999. If the user types something different, Excel will show an error alert explaining
what they have done wrong:
To add data validation in Excel, perform the following steps.
1. Open the Data Validation dialog box
• Select one or more cells to validate, go to the Data tab > Data Tools group, and click
the Data Validation button.
• You can also open the Data Validation dialog box by pressing Alt > D > L, with each
key pressed separately.
If you change your data on the source spreadsheet, be sure to click on the Refresh icon in
the Data group under the PivotTable Tools Analyze ribbon (Excel 2016 offers an Analyze
ribbon rather than an Options ribbon seen in older versions).