Lecture 3-Excel
Lecture 3-Excel
2
Software Orientation
3
Software Orientation
4
Software Orientation
5
Software Orientation
6
Using Formulas to
Conditionally Summarize
Data
– Conditional formulas add another dimension to data analysis
by summarizing data that meets one or more criteria.
– Criteria can be a number, text, or expression that tests which
cells to sum, count, or average.
– A conditional formula is one in which the result is determined
by the presence or absence of a particular condition.
– Conditional formulas used in Excel include the functions
SUMIF, COUNTIF, and AVERAGEIF that check for one criterion,
or their counterpoints SUMIFS, COUNTIFS, and AVERAGEIFS
that check for multiple criteria.
7
Using SUMIF
– The SUMIF function calculates the total of only those cells that meet a given
criterion or condition.
– The syntax for the SUMIF function is SUMIF(Range, Criteria, Sum_range).
– The values that a function uses to perform operations or calculations in a formula
are called arguments.
– The arguments of the SUMIF function are Range, Criteria, and Sum_range.
– Cells within the Range that do not meet the criterion are not included in the total.
– If you use the numbers in the range for the sum, the Sum_range argument is not
required.
– If you are using the criteria to test which values to sum from a different column,
then the range becomes the tested values and the Sum_range determines which
numbers to total in the same rows as the matching criteria.
8
Step by Step: Use the
SUMIF Function
9
Step by Step: Use the
SUMIF Function
– LAUNCH Excel.
1. OPEN the 10 Fabrikam Sales file for this lesson, and SAVE it to your
Excel Lesson 10 folder as 10 Fabrikam Sales Solution.
2. Select H5. Click the Formulas tab and then in the Function Library
group, click Math & Trig. Scroll to and click SUMIF. The Function
Arguments dialog box opens with text boxes for the arguments, a
description of the formula, and a description of each argument.
3. In the Function Arguments dialog box, click the Collapse Dialog
button for the Range argument. This allows you to see more of the
worksheet. Select the cell range C5:C16. Press Enter. By doing this,
you apply the cell range that the formula will use in the calculation.
10
Step by Step: Use the
SUMIF Function
4. In the Criteria box, type >200000 and then press Tab. The
figure below shows that the Sum_ range text box is not
bold. This means that this argument is optional. If you
leave the Sum_range blank, Excel sums the cells you
enter in the Range box. You now applied
your criteria to sum
all values that are
greater than
$200,000.
11
Step by Step: Use the
SUMIF Function
5. Click OK to accept the changes and close the dialog box. You see that $1,657,100 of
Fabrikam’s December revenue came from properties valued in excess of $200,000.
6. If for some reason
you need to edit
the formula, select
the cell that
contains the
function, and
on the Formulas
tab, or in the
Formula Bar, click
the Insert Function
button to return to
the Function Arguments
dialog box (shown here).
12
Step by Step: Use the
SUMIF Function
14
Using SUMIFS
– The SUMIFS function adds cells in a range that meet multiple criteria.
– The order of arguments in this function is different from the order
used with SUMIF.
– In SUMIFS, Sum_range is the first argument.
– In this exercise, you create and use two SUMIFS formulas, each of
which analyzes data based on two criteria.
• The first SUMIFS formula adds the selling price of the properties that
Fabrikam sold for more than $200,000 and that were on the market 60
days or less.
• The second formula adds the properties that sold at less than 3%
difference from their listed price within 60 days.
15
Step by Step: Use the
SUMIFS Function
17
Step by Step: Use the
SUMIFS Function
11. In the Criteria_range2 box, select cells E5:E16. Type <3% in
the Criteria2 box and then press Tab. To see all arguments,
scroll back to the top of the dialog box (see below).
12. Click OK. After applying this formula, Excel returns a value
of $433,000.
13. SAVE the workbook.
– LEAVE the workbook
open for the next
exercise.
18
Step by Step: Use the
SUMIFS Function
– The formulas you use in this exercise analyze the data on two
criteria. You can continue to add up to 127 criteria on which data
can be evaluated.
– Because the order of arguments is different in SUMIF and SUMIFS,
if you want to copy and edit these similar functions, be sure to put
the arguments in the correct order (first, second, third, and so
on).
– In this exercise, you practice using the COUNTIF function twice to
calculate the number of homes sold and listed >=200,000.
• The ranges you specify in these COUNTIF formulas are prices of
homes.
• The criterion selects only those homes that are $200,000 or 19
more.
Using COUNTIF
20
Step by Step: Use the
COUNTIF Function
1. Select H9. In the Function Library group, click More Functions, select Statistical,
and then click COUNTIF.
2. In the Function Arguments dialog box, in the Range box, select cells B5:B16.
3. In the Criteria box, type >=200000 and then press Tab. Preview the result and then
click OK. You set your criteria of values greater than or equal to $200,000. Excel
returns a value of 9.
4. Select H10 and then in the Function Library group, click Recently Used.
5. Select COUNTIF. In the Functions Arguments dialog box, in the Range box, select
cells C5:C16.
6. In the Criteria box, type >=200000 and press Tab. Preview the result and click OK.
A value of 7 is returned when the formula is applied to the cell.
7. SAVE the workbook. 21
23
Step by Step: Use the
COUNTIFS Function
24
Step by Step: Use the
COUNTIFS Function
25
Using AVERAGEIF
– The AVERAGEIF function returns the arithmetic mean of all the cells in a
range that meet a given criteria.
– The syntax is AVERAGEIF(Range, Criteria, Average_range).
– In the AVERAGEIF syntax, Range is the set of cells you want to average.
– For example, in this exercise, you use the AVERAGEIF function to calculate
the average number of days that properties valued at $200,000 or more
were on the market before they were sold.
• The range in this formula is B5:B16 (cells that contain the listed value of
the homes that were sold).
• The criterion is the condition against which you want the cells to be
evaluated, that is, >=200000.
• Average_range is the actual set of cells to average—the number of days
each home was on the market before it was sold. Average_range, is 26
optional if the range contains the cells that both match the criteria and
Step by Step: Use the
AVERAGEIF Function
28
Step by Step: Use the
AVERAGEIFS Function
7. In the Criteria_range2 box, select cells E5:E16 and then press Tab. You have
selected your second criteria range.
8. In the Criteria2 box, type <=5% and then press Tab. Click OK. Excel returns a
value of 60.
9. SAVE the workbook and then CLOSE it.
– LEAVE Excel open for the next exercise.
– You entered only two criteria for the SUMIFS, COUNTIFS, and AVERAGEIFS
formulas you created in the previous exercises.
– In large worksheets, you often need to use multiple criteria for the formula to
return a value that is meaningful for your analysis.
– You can enter up to 127 conditions that data must match in order for a cell to be
included in the conditional summary that results from a SUMIFS, COUNTIFS, or
AVERAGEIFS formula.
30
Step by Step: Use the
AVERAGEIFS Function
31
Using Formulas to Look
Up Data in a Workbook
32
Using VLOOKUP
33
Using VLOOKUP
34
Using VLOOKUP
36
Step by Step: Use the
VLOOKUP Function
5. In the Lookup_value text box, type B5 and then press Tab. The insertion
point moves to the Table_array box.
6. In the Defined Names group of the Formulas tab, click Use in Formula
and then select Bonus. Press Tab. The insertion point moves to the next
text box.
7. In the Col_index_num box, type 2, which is the column containing the
individual bonus amounts. Press Tab.
8. In the Range_lookup box, type True, which means that VLOOKUP can
check for the nearest value that does not go over the number in the first
column; the same bonus is paid for a range of years, so you enter True in
the Range_lookup box so that a value will be returned for all agents. The
Function Arguments dialog box should look similar to the one shown in
the figure on the next slide. Click OK. Excel returns a value of 2.5%.
38
Step by Step: Use the
VLOOKUP Function
39
Step by Step: Use the
VLOOKUP Function
9. Using the fill handle in cell E5, copy the formula to the range E6:E11.
This calculates bonus rates for the other sales agents. The #N/A
error message appears in cell E11 because a value is not available
for agents who have been employed for less than one year. (Agents
become eligible for a bonus only after a full year of service.)
10. Click in cell F5 and type =VLOOKUP(B5,Bonus,3). Notice that the
ScreenTip gives you information and help as you go. This looks up
values in the third column of the Bonus range. Press Enter.
11. Copy the formula from F5 to the range F6:F11.
12. SAVE the workbook.
– LEAVE the workbook open for the next exercise.
40
Using HLOOKUP
41
Using HLOOKUP
42
Step by Step: Use the
HLOOKUP Function
8. In cell E11, type CO2 and notice that the result changes to the result for the CO2
column for 5 beds, which is 3.
9. Click cell D11 and then type 7. Notice that you get a #REF! error because the table
only goes up to five beds.
10. In cell D11, type 1. Cell F11 displays a result of 1.
11. SAVE the workbook.
– LEAVE the workbook open for the next exercise.
– It might be difficult to remember the syntax for an HLOOKUP or VLOOKUP function.
– Use the Function Arguments dialog box to help you remember the order of the
arguments for any and all functions.
– When you click in each field, review the tips that appear on the right side, as well as
the explanation below the argument boxes that tells the purpose of each argument in
the function.
45
Adding Conditional
Logic Functions to
Formulas
– You can use the AND and OR functions to create conditional
formulas that result in a logical value, that is, TRUE or FALSE.
– Such formulas test whether a series of conditions evaluate to
TRUE or FALSE.
– You can also use the IF conditional formula that checks if a
calculation evaluates as TRUE or FALSE.
– You can then tell IF to return one value (text, number, or
logical value) if the calculation is TRUE or a different value if
it is FALSE.
46
Using IF
47
Step by Step: Use the
IF Function
49
Step by Step: Use the
IF Function
13. The final pending sale of $700,000 of the year came through. In D5, type
$3,900,000. Notice that H5 and the amounts in column I go from 0 to
bonuses (see below).
51
Using AND
– The AND function returns TRUE if all its arguments are true,
and FALSE if one or more arguments are false.
– The Syntax is AND(Logical1, Logical2, …).
– In this exercise, you use the AND function to determine
whether Fabrikam’s total annual sales met the strategic
goal and whether the sales goal exceeded the previous
year’s sales by 5 percent.
52
Step by Step: Use the
AND Function
53
Step by Step: Use the
AND Function
54
Step by Step: Use the
AND Function
55
Using OR
56
Step by Step: Use the
OR Function
57
Step by Step: Use the
OR Function
7. Cell J7 is the first in the column that returns a TRUE
value. To see each of the arguments, click cell J7 and
then click the Insert Function button and you return to
the Function Arguments dialog box (see below).
58
Step by Step: Use the
OR Function
59
Using Formulas to
Modify Text
– When you get files from other people or programs, you often
have to manipulate the data before you can begin using it.
– Sometimes you receive files in a text format with commas
separating what should go in columns. Some text can be
combined into one long string or other text can be all in
lowercase or uppercase.
– In Excel, use the PROPER, UPPER, and LOWER functions to
capitalize the first letter in each word of a text string or to
convert all characters in a text string to uppercase or
lowercase.
60
Using Formulas to
Modify Text
– This section presents you with a text file from the alarm
company.
– There is a lot of useful information in the file.
– It is coded for the alarm system rather than for use in a
spreadsheet.
– You will convert the information into a usable format.
61
Converting Text to
Columns
62
Step by Step: Convert
Text to Columns
– LAUNCH Excel if necessary.
1. OPEN the 10 Fabrikam Alarm Codes workbook and then
SAVE it to your Excel Lesson 10 folder as 10 Fabrikam
Alarm Codes Solution. Figure 10-13 shows what the file
looks like before you convert the rows to columns and
the figure below shows the same data after the
conversion.
63
Step by Step: Convert
Text to Columns
2. Select cells A2:A8. Click the Data tab and then in the Data
Tools group, click Text to Columns.
3. The Convert Text to Columns Wizard opens with Delimited
selected as the default, because Excel recognizes that the
data in the selected range is separated with commas. Click
Next to move to the next step in the wizard.
4. Select Comma as the delimiter. If other delimiters are
checked, deselect them.
5. Click Next and then click Finish.
64
Step by Step: Convert
Text to Columns
6. Data is separated into seven columns. To help identify the columns, type the
text shown in row 1 of the figure below. Apply the Heading 3 style to the
range A1:O1 (you will add data to columns H:O in later exercises). Increase
the widths of columns A:G as necessary so you can see the cell contents.
65
Using LEFT
66
Step by Step: Use the
LEFT Function
68
Step by Step: Use the
RIGHT Function
69
Using MID
70
Step by Step: Use the
Mid Function
72
Step by Step: Use the
TRIM Function
74
Step by Step: Use the
PROPER Function
75
Using UPPER
76
Step by Step: Use the
UPPER Function
78
Step by Step: Use the
LOWER Function
82
Step by Step: Use the
CONCATENATE Function
83
Exercise 1
Exercise 2