academic resource center - jwalkonline.org 2007/excel 2007 part 3 …  · web viewto find all...

47
5/12/2012 ACHIEVEMENT & LEARNING CENTER UNIVERSITY OF BALTIMORE MICROSOFT EXCEL 2007 PART 3 BY: MICHAEL J. WALK, M.S. www.jwalkonline.org/main @MichaelJWalk [email protected] Excel 2007 Part 3 (v1.0) 1 of 47 ©2012 Michael J. Walk

Upload: buitram

Post on 06-Feb-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

ACHIEVEMENT & LEARNING CENTER

UNIVERSITY OF BALTIMORE

M I C R OS O F T E XC EL 2 0 0 7

P A RT 3

BY: MIC H AEL J . WA LK, M.S .

www.jwalkonline.org/main@MichaelJWalk

[email protected]

Excel 2007 Part 3 (v1.0) 1 of 40 ©2012 Michael J. Walk

Page 2: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

TABLE OF CONTENTS

Data Management.......................................................................................................................................................................4

filtering Data............................................................................................................................................................................ 4

Finding Data (And replacing)...........................................................................................................................................6

Find and Replace...............................................................................................................................................................7

Naming Cell Ranges and Constants................................................................................................................................7

Data analysis................................................................................................................................................................................. 9

Advanced Chart Design....................................................................................................................................................... 9

Dual-Axis Charts................................................................................................................................................................9

Adding Data Labels........................................................................................................................................................14

Area Charts........................................................................................................................................................................15

Adding Trendlines......................................................................................................................................................... 16

Conditional Formatting....................................................................................................................................................20

Automatic Conditions...................................................................................................................................................20

Fixed Value Conditional Formatting......................................................................................................................22

Data Manipulatoin................................................................................................................................................................... 24

Logical Functions................................................................................................................................................................ 24

IF…Then............................................................................................................................................................................. 25

And() / or()....................................................................................................................................................................... 25

Condition-Dependent Sums and Counts...................................................................................................................26

CountIf().............................................................................................................................................................................26

SumIf()................................................................................................................................................................................ 26

Text Functions...................................................................................................................................................................... 27

Left, Mid, Right.................................................................................................................................................................27

Concatenate...................................................................................................................................................................... 28

Date FUnctions.....................................................................................................................................................................29

Get the Current Date and/or Time.........................................................................................................................29

Turn a Text Date to an actual date: DateValue()..............................................................................................29

Find the Weekday of a Date (Sun, Mon, Tue…): Weekday()........................................................................30

Other Date Functions....................................................................................................................................................30

Lookup Functions............................................................................................................................................................... 30

Excel 2007 Part 3 (v1.0) 2 of 40 ©2012 Michael J. Walk

Page 3: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

Searching for desired Functions...................................................................................................................................31

Removing Duplicates.........................................................................................................................................................32

Workbook Management........................................................................................................................................................33

Password Protection......................................................................................................................................................... 33

Locking Sheets or Ranges of Cells................................................................................................................................34

Manual vs. Automatic Recalculation...........................................................................................................................34

Macros........................................................................................................................................................................................... 35

Exercises...................................................................................................................................................................................... 37

Exercise 1: Filtering........................................................................................................................................................... 37

Exercise 2: Find and Replace.........................................................................................................................................38

Exercise 3: Named Constants and Ranges................................................................................................................38

Exercise 4: Dual-Axis Graph with Labels..................................................................................................................38

Exercise 5: Adding a Trendline.....................................................................................................................................39

Exercise 6: Conditional Formatting............................................................................................................................39

Exercise 7: If/And/Or/Count(Sum)If.........................................................................................................................40

Exercise 8: Remove Duplicate Names and Caculate Total Sales and Profit...............................................40

Excel 2007 Part 3 (v1.0) 3 of 40 ©2012 Michael J. Walk

Page 4: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

DATA MANAGEMENT

Excel has a lot of ways for us to quickly manage our data, including filtering, searching, naming constants, and other tricks. This section gives you the skills to be able to manage datasets.

FILTERING DATA

Open the class file: 1_filtering.xslx

Filtering data is a quick way to only find and view rows of data in a data table that meet your criteria. To filter your data, your data must meet the following criteria:

1. You must have a table of data with column headers.2. Your table of data should have no space between columns and no space between the header

row and your first row of data.3. There cannot be any empty rows in your data table (empty cells are ok, but completely

empty rows will trick Excel into thinking that the data table ends at the empty row).

Follow these steps to filter your data:

1. Select any cell in your data table’s header row.2. Click on Data Sort and Filter section Filter. This will add filter selectors to each cell

in your header row.

3. Use the filter selectors at the right of each cell to designate your criteria.4. There are several filter types

a. Text datai. Exact value filters (use the check boxers to select or de-select values you

want to see)ii. Text filters, for example:

1. Begins with2. Ends with3. Contains, etc.

b. Date data: Date data gets grouped into years, months, and daysi. Date filters allow you to select or de-select entire years, months, or days

ii. Date range filters allow you to select data between two dates, or data that is within a certain date range (e.g., this quarter, next quarter, this week, next week, etc.). See below for a screen shot:

Excel 2007 Part 3 (v1.0) 4 of 40 ©2012 Michael J. Walk

Page 5: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

c. Numeric data:i. Exact value filters (select or de-select the exact values you want to see)

ii. Value range filters (select the minimum and/or maximum values)iii. Top values filters (see only the top or bottom values; for example, the top

10%)5. Apply whatever filters you want using the filter selectors.

In-Class Example

1. Filter the sales records for only Product Category Furniture 2. Occurred in 20103. Above average profit

NOTE: When your data is filtered, you can copy the filtered data and paste just the visible rows into a different area, if desired. If you delete the values in multiple cells, you are only deleting visible cells.

Go to Exercise 1.

Excel 2007 Part 3 (v1.0) 5 of 40 ©2012 Michael J. Walk

Page 6: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

FINDING DATA (AND REPLACING)

Continue using the data file 1_filtering.xlsx. Remove all filters.

Excel allows us to search for values in our worksheet. We can also replace all cells that match our search with a new value.

1) To start a find, you can either: press CTRL + F or Home Editing section Find & Select Find.

2) Type the value you want to search for in the Find what box

3) Click Find Next to jump to the next cell with the search value. Continue clicking Find Next until you find the cell you had in mind.

a. Also, clicking Find All produces a list of cells that contain the search value. You can then click each cell in the list to navigate directly to the cell.

Excel 2007 Part 3 (v1.0) 6 of 40 ©2012 Michael J. Walk

Page 7: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

FIND AND REPLACE

To find all cells containing a specific value and then replacing those cells with a new value:

1) Click Home Editing section Find & Replace Replace

2) Type the value you want to find in the Find what box. Type the value you want to replace it with in the Replace cells box.

3) You can replace the values one at a time by clicking on Replace or replace ALL the values by clicking Replace All.

4) You will get a confirmation message of how many cells were replaced.

Go to Exercise 2.

NAMING CELL RANGES AND CONSTANTS

We often need quick ways to access or reference cell ranges or standard values without having to keep highlighting the cells or typing the values in. We can do this by naming cells ranges or constants. Range and constant names cannot have spaces and cannot be just numbers.

Naming Ranges

Naming a cell range allows you to quickly call up or access a range of cells (of any size) with a single name.

1) You can give a range of cells its own name so that you can easily select the range with a single click. This name can be used in place of a cell reference.

2) Select the cells in the range you wish to name.3) Type the name for the cell range in the Name Box.

Practice by naming the data in the sales column, “Sales.”

1) Highlight all the values in the Sales column.

Excel 2007 Part 3 (v1.0) 7 of 40 ©2012 Michael J. Walk

Page 8: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

2) Then type the name Sales in the Name Box.3) Press Enter.

Naming Constants

Naming a constant is the equivalent of assigning a value to a word. For instance, you could create a constant called “tax,” which is equal to 6%. You could then use tax in any formula for calculation.

(Start with a new blank file.)

1) Formulas Defined names section Define name2) Give a name to the constant; enter it in the Name box.3) Define the scope of the constant by using the drop down in the Scope box. (Constants that

can be used throughout the entire workbook should have a scope of Workbook.)4) Type the value of the constant in the Refers to box.

5) Click OK

You can then view your named constant by clicking Formulas Name Manager.

Excel 2007 Part 3 (v1.0) 8 of 40 ©2012 Michael J. Walk

Page 9: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

You can edit your named constant by selecting it in the Name Manager and then clicking Edit.

To use your constant, simply type the constant name into a cell formula. For example, to calculate the tax on a $100 purchase, type =100*tax.

Go to Exercise 3.

DATA ANALYSIS

One of the most powerful components of Excel is its ability to quickly and easily analyze data. Excel’s data analysis capabilities not only include charts and graphs but also conditional formatting, formulas, and even inferential statistical analyses.

ADVANCED CHART DESIGN

Charts are a very powerful tool in Excel; however, their true power is rarely unleashed by a novice user. There are several advanced features that can prove useful. We will discuss a few here.

DUAL-AXIS CHARTS

Dual-axis line graphs allow you to display 2 different pieces of data that are on much different scales (e.g., total sales and percent of profit) on the same graph.

Open the class file: 3_advanced charts.xlsx.

We are going to create a chart that displays the quarterly sales and quarterly profitability of the Alice Mutton product.

1) Make sure you have clicked OUT of your data table.2) Click Insert Chart Column 2-D Column

Excel 2007 Part 3 (v1.0) 9 of 40 ©2012 Michael J. Walk

Page 10: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

3) This will create a blank chart. You will need to select the source data. Click on Design Select Data.

4) Click on Add under the Legend Entries to add data to the chart.5) Click in the Series name box, and type the word, Sales.6) Click in the Series values box, and then use your mouse to select the cells containing the

sales values for Alice Mutton (B2:E2). Click OK.

Excel 2007 Part 3 (v1.0) 10 of 40 ©2012 Michael J. Walk

Page 11: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

7) Click on Add to add the profit rate series to the chart as well. Type Profit Rate into the Series name box. Select the range of cells containing the profit rates.

8) Click on Edit under the Horizontal Axis Labels box to use the quarter labels for the X-axis.9) Select the cell range containing the quarter names. Click OK.

10) All data is now selected. Click OK.11) Your chart will have both columns: Sales and Profit Rate; however, Profit Rate won’t be

visible, because the numbers are so small compared to the Sales columns.

Excel 2007 Part 3 (v1.0) 11 of 40 ©2012 Michael J. Walk

Page 12: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

12) To select the Profit Rate series, click through Chart Tools Layout use the drop-down box at the left Series “Profit Rate” then click on Format Selection.

13) On the dialog box that opens up, select Plot Series On Secondary Axis. This will place the Profit Rate values on a different Y-axis. Click Close.

Excel 2007 Part 3 (v1.0) 12 of 40 ©2012 Michael J. Walk

Page 13: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

14) Right-click on the Profit Rate column, then select Change Series Chart Type.

15) Select a line chart. This will turn the Profit Rate series into a line.

Excel 2007 Part 3 (v1.0) 13 of 40 ©2012 Michael J. Walk

Page 14: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

ADDING DATA LABELS

Data labels are a helpful way to show the values contained in your chart so your reader does not have to guess about what the values actually are.

1) Click on the chart series you wish to add data labels to.2) Then click through Chart Tools Layout Data Labels Above (or a different

position)

Excel 2007 Part 3 (v1.0) 14 of 40 ©2012 Michael J. Walk

Page 15: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

Go to Exercise 4.

AREA CHARTS

An area chart creates a solid polygon to depict the values in your data. They are especially helpful to see the cumulative effects of several series values working together. For example, an area chart of our 4 products’ sales would help us see not only trends in individual products but also overall sales.

1) Highlight the data to be charted.2) Click through Insert Chart section Area Stacked Area

3) This creates a stacked area graph, where the 4 products are depicted as different colors, and their sales are “stacked” on top of each other so that the top of the colored area also depicts the total sales.

$-

$2,000.00

$4,000.00

$6,000.00

$8,000.00

$10,000.00

$12,000.00

$14,000.00

$16,000.00

$18,000.00

$20,000.00

Qtr 1 Qtr 2 Qtr 3 Qtr 4

Camembert Pierrot

Boston Crab Meat

Aniseed Syrup

Alice Mutton

ADDING TRENDLINES

Excel 2007 Part 3 (v1.0) 15 of 40 ©2012 Michael J. Walk

Page 16: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

If you have a lot of longitudinal (time series) data to display (e.g., more than 12 data points), it is often beneficial to add a trendline to your chart to see if there is any particular trend (positive or negative).

1) Create the chart you want for displaying the data.2) Select the chart series you want to add the trendline to by clicking on it.3) Click through Chart Tools Layout Trendline (choose trendline)

Let’s practice. Open the class file: 4_trendline.xlsx.

1) Make a line chart of the daily sales.2) Then, click on the line in your chart, and go to Chart Tools Layout Trendlne

Linear Trendline

3) This will add a straight trendline to your graph to help you detect any general upward or downward trends.

$0.00$2000.00$4000.00$6000.00$8000.00

$10000.00$12000.00$14000.00$16000.00$18000.00$20000.00

9/3/2011 10/3/2011 11/3/2011 12/3/2011

Sales

Sales

Linear (Sales)

4) Add a weekly moving average by clicking through: Chart Tools Layout Trendline More trendline options.

Excel 2007 Part 3 (v1.0) 16 of 40 ©2012 Michael J. Walk

Page 17: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

5) Select Moving Average and type 7 in the Period box (for 7 days).6) Rename the trendline by clicking under Trendline Name Custom. Enter Weekly Avg into

the Custom box. Click Close.7) Make the Weekly Avg trendline dark blue and thick

a. Right click on the Weekly Avg lineb. Click Format Trendlinec. Click on Line Color, then Solid Line. Pick your color.

Excel 2007 Part 3 (v1.0) 17 of 40 ©2012 Michael J. Walk

Page 18: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

d. Click Line Style. Change the width to 3.e. Click Close.

8) Make the daily value line blue but thin.a. Right click on the Sales line. Choose Format Data Series.b. Change the Line Style to .5.

9) Adjust the X-axis labels so that they are displayed at a 45-degree angle.a. Right click on the X-axis labels.b. Click Format axis.c. On the Alignment section, enter -45 into the custom angle box.

d. Click Close.

$0.00$2000.00$4000.00$6000.00$8000.00

$10000.00$12000.00$14000.00$16000.00$18000.00$20000.00

Sales

Sales

Linear (Sales)

Weekly Avg

Go to Exercise 5.

Excel 2007 Part 3 (v1.0) 18 of 40 ©2012 Michael J. Walk

Page 19: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

CONDITIONAL FORMATTING

Conditional formatting is a way to change cell colors, icons, or other formatting features based on cell values or other types of rules. This is a great way to get a snapshot of what’s happening in your data.

AUTOMATIC CONDITIONS

There are several conditional formatting types that can be used automatically in Excel. They are Data Bars, Color Scales, and Icon Sets. These conditional formats are usually applied to cell ranges in order to quickly give visual indications about the values contained in the individual cells.

Open the class file: 5_conditional formats.xlsx

DATA BARS

1) Highlight the cells that contain the data you want to apply conditional formatting to.2) Then, click through Home Styles section Conditional Formatting Data Bars

(Pick a data bar color)

3) Excel automatically creates data bars inside all of the selected cells based on the relative value contained in each cell. (Note: the biggest value cell contains the biggest bar; the smallest value cell contains the smallest bar.)

Excel 2007 Part 3 (v1.0) 19 of 40 ©2012 Michael J. Walk

Page 20: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

Removing rules:

1) Select the cells from which you want to remove the rules.2) Click through Home Styles section Conditional Formatting Clear Rules Clear

Rules from Selected Cells

ICON SETS

Icon sets apply different colored and/or shaped icons to the selected cells based on the relative value of the cell.

1) Select the cells you wish to conditionally format.2) Click through Home Styles section Conditional Formatting Icon Sets (pick

and icon set)

Excel 2007 Part 3 (v1.0) 20 of 40 ©2012 Michael J. Walk

Page 21: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

3) Excel automatically breaks the selected data into percentile groups based on how many icons there are (e.g., three icons results in three percentile groups—the 33rd percentile, the 33rd -66th percentile, and the 66th-100th percentile), and then determines which percentile group every individual cell is in and applies the appropriate icon for that percentile group (e.g., the lowest percentile group gets the red icon).

COLOR SCALES

Color scales are also often called “heat maps,” and refer to the action of applying a range of colors to cells enable quick “hot-spot” analysis or “cold-spot” analysis (i.e., quickly find the highest or lowest values in a range of cells).

1) Select the cells to which you want to apply conditional formatting.2) Click through: Home Styles section Conditional Formatting Color Scales

(pick a color scale)

3) You can now quickly find the largest and smallest cells in the range.

FIXED VALUE CONDITIONAL FORMATTING

Sometimes you want to quickly locate cells that cross a certain threshold or that have a certain rank in your data set. This is done through fixed-value conditional formatting.

Example: Finding bus routes with lower than 80% on-time performance

1) Select the cells you want to apply conditional formatting to (should be ALL cells)2) Click through: Home Styles section Conditional Formatting New Rule

Excel 2007 Part 3 (v1.0) 21 of 40 ©2012 Michael J. Walk

Page 22: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

3) This will bring up the conditional formatting rule box.

4) Use the drop-down boxes to build your rule. We want to find Cell Values that are less than .8 (type .8 in the box).

5) Then click on the Format button to assign a format that will be applied to any cells less than 0.8.

Excel 2007 Part 3 (v1.0) 22 of 40 ©2012 Michael J. Walk

Page 23: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

6) Click on the Fill tab, then select a fill color (RED, for this example).7) Click on the Font tab, and select the Bold style.8) Click OK. Click OK again.

Bus Route On Time %1 80%2 75%3 65%4 85%5 75%

Go to Exercise 6.

DATA MANIPULATOIN

Often, our data does not come in the exact format we need to be able to get done what we want to get done. Therefore, we have to exercise our Excel skills in order to get the data in the exact format that we need. This often takes the use of advanced formula skills beyond basic mathematical formulae.

LOGICAL FUNCTIONS

There are many formulas to perform logical “decisions” including, If(), Or(), And(), IfError().

IF…THEN

The If() function needs three arguments:

Excel 2007 Part 3 (v1.0) 23 of 40 ©2012 Michael J. Walk

Page 24: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

Expression to evaluate Value if expression evaluates to true Value if expression evaluates to false

Use the open class file: 5_conditional formats.xlsx, Bus Data worksheet. Add a column called Problem to the right of the On-Time % column.

We are going to put an “X” in the cells where OTP is less than 80%.

1) In the cell C1, where you want the formula, type =If(2) Then, add the expression to evaluate: B2<.83) Then type a comma4) Then add the value if the expression is true: “X” (include the quotes)5) Then type a comma6) Then add the value if the expression is false: “” (this will give a blank cell)7) Your finished formula should look like this:

=IF(B2<0.8,"X","")

8) Drag your formula down through the rest of the cells.

Bus Route On Time % Problem1 80%2 75% X3 65% X4 85%5 75% X

AND() / OR()

Sometimes we want to evaluate two or more expressions in our If() functions. And() allows us to specify multiple expressions, separated by commas, that all must evaluate to TRUE for the entire And() function to evaluate TRUE. Or() allows us to specify multiple expressions, separated by commas, so that if ANY of the expressions evaluate to TRUE, the entire Or() function will evaluate to TRUE.

Open the class file: 6_and or.xlsx

1) In cell E2, begin with your If() function: =If(2) Then, we are going to test if BOTH requirements are met; that is, the person is at least 60

and has at least 20 years of service. This requires an And() function: And(C2>=60,D2>=20).3) Type a comma4) Type the value to display if the And() returns true: “Yes”5) Type a comma6) Type the value to display if the And() returns false: “No”7) Drag the formula to the other cells.

=IF(AND(C2>=60,D2>=20),"Yes","No")

Excel 2007 Part 3 (v1.0) 24 of 40 ©2012 Michael J. Walk

Page 25: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

Name Age Years of Service Eligible to Retire?Michael 61 21 YesPhil 59 20 NoGertrude 60 19 NoEmily 62 25 YesCornelius 55 22 No

CONDITION-DEPENDENT SUMS AND COUNTS

Sometimes we only want to count cells that contain certain values or sum cells that meet certain criteria. To accomplish this, Excel gives us the CountIf() and SumIf() functions.

COUNTIF()

Count if allows us to count cells that meet a certain criteria. Let’s count how many people are eligible to retire.

1) Add a row named “Total” to your list of names.2) In cell E7, add a CountIf() function

a. =CountIf(b. Select the range of cells to countc. Type a commad. Type your criteria: “Yes”e. Type the closing parenthesis: )f. Your formula should look like this

=COUNTIF(E2:E6,"Yes")

g. Your result should be 2.

SUMIF()

SumIf() allows us to sum only those values that meet a certain criteria. With SumIf, the criteria can also be in adjacent cells or aligned cells (e.g., cells on the same row).

Let’s calculate the total years of service for those employees who are eligible to retire.

1) In the cell D&, add the SumIf() function2) Type =SumIf(3) Select the range of cells against which you are placing your criteria. In this example, it’s the

range of cells containing retirement eligibility: E2:E64) Type a comma5) Type the criteria (we only want those individuals with “Yes”): “Yes”6) Type a comma7) Select the range of cells containing the cells to sum: D2:D78) Type the closing parenthesis: )9) Your formula should look like this

Excel 2007 Part 3 (v1.0) 25 of 40 ©2012 Michael J. Walk

Page 26: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

=SUMIF(E2:E6,"Yes",D2:D7)

10) Your result should be 46.

Practice by calculating the average age of employees eligible to retire in cell C7. (Hint: Find the sum of the ages of eligible employees, divided by the number of eligible employees.)

Name Age Years of Service Eligible to Retire?Michael 61 21 YesPhil 59 20 NoGertrude 60 19 NoEmily 62 25 YesCornelius 55 22 NoTotal 61.5 46 2

Go to Exercise 7.

TEXT FUNCTIONS

There are some functions especially designed for dealing with text. Here are a few.

LEFT, MID, RIGHT

The Left(), Mid(), and Right() functions allow us to parse our strings of data (piece apart text).

Open the class file: 8_text functions.xlsx

1) Extract the year from the date column by using the Left() functiona. In cell C2, type =Left(b. Select the cell from which to extract the year: B2c. Type a commad. Type the number of characters from the left you want to extract: 4e. Type the closing parenthesis: )f. Your formula should look like this: =LEFT(B2,4)g. Fill your formula down the column

2) Extract the month from the date column by using the Mid() functiona. In cell D2, type =Mid(b. Select the cell from which to extract the year: B2c. Type a commad. Type the starting character number (e.g., to start with the 5th character in the cell,

type 5): 5e. Type a commaf. Type the number for how many characters you want to extract: 2g. Type a commah. Type the closing parenthesis: )i. Your formula should look like this: =MID(B2,5,2)j. Fill your formula down the column

3) Extract the day from the date column by using the Right() function

Excel 2007 Part 3 (v1.0) 26 of 40 ©2012 Michael J. Walk

Page 27: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

a. In cell E2, type =Right(b. Select the cell from which to extract the day: B2c. Type a commad. Type the number of characters from the right you want to extract: 2e. Type the closing parenthesis: )f. Your formula should look like this: =RIGHT(B2,2)g. Fill your formula down the column

CONCATENATE

Concatenate takes values in multiple cells and/or other values you type in and combines them into a single cell.

Let’s combine the exacted year, month, and day, and put them into a single cell with the format: mm-dd-yyyy.

1) In cell F2, type =Concatenate(2) Then, begin selecting the text to string together, separated by commas

a. Select the cell for the month: D2b. Type a commac. Type: “-“d. Type a commae. Select a cell for the day: E2f. Type a comma, “-“, and another commag. Select a cell for the year: C2h. Type the closing parenthesis: )

3) Your formula should look like this: =CONCATENATE(D2,"-",E2,"-",C2)

Your completed dataset should look like this:

Date Year Month Day Date Text20120101 2012 01 01 01-01-201220120116 2012 01 16 01-16-201220120122 2012 01 22 01-22-201220120202 2012 02 02 02-02-201220120208 2012 02 08 02-08-201220120210 2012 02 10 02-10-201220120225 2012 02 25 02-25-201220120303 2012 03 03 03-03-201220120315 2012 03 15 03-15-201220120325 2012 03 25 03-25-201220120409 2012 04 09 04-09-201220120421 2012 04 21 04-21-201220120423 2012 04 23 04-23-201220120503 2012 05 03 05-03-201220120505 2012 05 05 05-05-201220120509 2012 05 09 05-09-201220120511 2012 05 11 05-11-201220120512 2012 05 12 05-12-201220120523 2012 05 23 05-23-201220120529 2012 05 29 05-29-2012

Excel 2007 Part 3 (v1.0) 27 of 40 ©2012 Michael J. Walk

Page 28: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

DATE FUNCTIONS

Excel has a large assortment of functions to deal with dates. Here are a few.

GET THE CURRENT DATE AND/OR TIME

Open a blank workbook.

1) =Today() returns the current datea. In cell A1, type =Today()

2) =Now() returns the current date and timea. IN cell B1, type =Now()

3) These cells with automatically update every time you change cell values in your workbook and/or when you open the workbooks.

TURN A TEXT DATE TO AN ACTUAL DATE: DATEVALUE()

Use the class file 8_text functions.xlsx.

Sometimes we have text that represents a date, but Excel has not recognized the data as a date. We can do this by using the DateValue() function.

1) Add a new column called Date2) In cell G2, type =Datevalue(3) Select the cell that contains the date text4) Type the closing parenthesis: )5) Your formula should look like this: =DATEVALUE(F2)6) Change the cell format to a short date.7) Drag the formula down the column.

Date Year Month Day Date Text Date20120101 2012 01 01 01-01-2012 1/1/201220120116 2012 01 16 01-16-2012 1/16/201220120122 2012 01 22 01-22-2012 1/22/201220120202 2012 02 02 02-02-2012 2/2/201220120208 2012 02 08 02-08-2012 2/8/201220120210 2012 02 10 02-10-2012 2/10/201220120225 2012 02 25 02-25-2012 2/25/201220120303 2012 03 03 03-03-2012 3/3/201220120315 2012 03 15 03-15-2012 3/15/201220120325 2012 03 25 03-25-2012 3/25/201220120409 2012 04 09 04-09-2012 4/9/201220120421 2012 04 21 04-21-2012 4/21/201220120423 2012 04 23 04-23-2012 4/23/201220120503 2012 05 03 05-03-2012 5/3/201220120505 2012 05 05 05-05-2012 5/5/201220120509 2012 05 09 05-09-2012 5/9/201220120511 2012 05 11 05-11-2012 5/11/201220120512 2012 05 12 05-12-2012 5/12/201220120523 2012 05 23 05-23-2012 5/23/201220120529 2012 05 29 05-29-2012 5/29/2012

Excel 2007 Part 3 (v1.0) 28 of 40 ©2012 Michael J. Walk

Page 29: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

FIND THE WEEKDAY OF A DATE (SUN, MON, TUE…): WEEKDAY()

The Weekday() function returns the weekday number (from 1 – 7, with 1 being Sunday).

1) Add a new column called Day of Week2) In cell H2, type: =Weekday(3) Select the cell with the date from which to extract the weekday number: G24) Type the closing parenthesis: )5) Your formula should look like this: =WEEKDAY(G2)

OTHER DATE FUNCTIONS

1) Month() returns the month number from any date2) Day() returns the date number of any date3) Year() returns the year number of any date4) Date(year, month, day): creates a date by inputting a year, month, and day.5) EOMONTH(start_date,months): returns the date of the end of the month for the month that

is the indicated number of months after the start date.a. For example, EOMONTH(1/2/2012,3) would return April 30th.

LOOKUP FUNCTIONS

Lookup functions allow you search through the first row or column of a table of values and then return a particular cell value when your search is successful. There are two Lookup functions:

1) HLOOKUP(): performs a Horizontal search across the top row in a table.2) VLOOKUP(): performance a Vertical search down the first column in a table.

Open the class file: 9_lookups.xlsx.

We want to find the profit and product sold on each of the three dates in the Results table.

1) We are going to search first column of our source data, so we will be using VLOOKUP()2) In cell K3 (under product for date 12/1/2011 in the Results table), type =Vlookup(3) VLOOKUP needs 4 pieces of information: the value to search for, where the data is located,

which column of data we want to return, and whether we allow approximate searches.a. Value to search for

i. Select the cell that contains the value you want to find in your source data. For us, we want to find the date 12/1/2011, so click the cell J3.

ii. Type a commab. Source data

i. Our source table is all the cells from A1 to H21: A1:H21.ii. Make the source data table an ABSOLUTE REFERENCE.

iii. Type a commac. Column to return

i. For the product in the results, we need the Product column from the source.ii. The Product column is the 4th column in the source data, so type: 4

iii. Type a comma

Excel 2007 Part 3 (v1.0) 29 of 40 ©2012 Michael J. Walk

Page 30: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

d. Approximate search allowed? No! Type: False.4) Your formula should look like this: =VLOOKUP(J3,$A$2:$H$21,4,FALSE)5) Drag your formula down the column.

Date Product Profit12/1/2011 File Labels

12/13/2011 Fruits and Vegetables12/22/2011 Frames

Results

For your practice, add the date’s profit to the results table. You should get these results:

Date Product Profit12/1/2011 File Labels 71.42$

12/13/2011 Fruits and Vegetables 434.77$ 12/22/2011 Frames 537.88$

Results

SEARCHING FOR DESIRED FUNCTIONS

If you don’t what formula to use, you can also use the Formulas tab in the ribbon to search for the formula you want.

If you click on Formulas Insert Formula, a dialog box will pop up, which allows you to search for specific functionalities that you may not know what the function name or category is. For example, if you want to perform a trend analysis, you could type Trend in the search box.

REMOVING DUPLICATES

Many times, our data needs to be cleaned up by either removing duplicates.

When you remove duplicates, you will also delete any other data in the data set that is on the same row as the “duplicates.”

Excel 2007 Part 3 (v1.0) 30 of 40 ©2012 Michael J. Walk

Page 31: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

Open the class file: 10_duplicates.xlsx.

Let’s create a list of the product categories to display on the Summary tab.

1) Copy the list of products on the Source Data tab and past the list on the Summary worksheet.

2) Select a cell in the column of data that has duplicates we want to remove (any cell in column B on the Summary worksheet).

3) Click through: Data Remove Duplicates. This will bring up the remove duplicates dialog box.

4) Click OK.5) You will be left with a list of only unique product categories.

Product Category Sales ProfitStationeryFurnitureGrocery

Go to Exercise 8.

WORKBOOK MANAGEMENT

As we become advanced users of Excel, we have to become better at managing our workbooks in a shared-user environment. This may entail password-protecting our workbook, changing workbook properties, tracking changes among multiple users, or altering key default settings.

PASSWORD PROTECTION

1) Office Button Prepare Encrypt Document

Excel 2007 Part 3 (v1.0) 31 of 40 ©2012 Michael J. Walk

Page 32: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

2) Type your password into the pop-up box.3) This will make your workbook password-protected. You will not be able to open it without

the password.4) WARNING!!! THERE IS NO PASSWORD RETRIEVAL. DO NOT FORGET YOUR PASSWORD.

LOCKING SHEETS OR RANGES OF CELLS

You can also make certain worksheets within your workbook protected with an additional password.

1) Make sure you have the sheet you want to protect active.2) Review Protect Sheet3) Type your password into the provided box4) Select what you want people without the password to be allowed to do.5) Click OK.

Excel 2007 Part 3 (v1.0) 32 of 40 ©2012 Michael J. Walk

Page 33: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

MANUAL VS. AUTOMATIC RECALCULATION

If you have A LOT of formulae and calculations going on, you may want to limit how often Excel updates the contents of calculated cells. By default, Excel does this automatically (every time a cell value is changed.) To turn off automatic recalculation:

1) Click through: Formulas Calculation Options Manual

Excel 2007 Part 3 (v1.0) 33 of 40 ©2012 Michael J. Walk

Page 34: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

2) Once in manual mode, you must go to Formulas Calculate Now to update cell values.

MACROS

A macro is essentially a set of actions in an Excel workbook that are repeatable. For example, you may have a template that you use for recording some data, and, before moving on to your next project, you clear all the data out of your template. You can add a single button to your worksheet that will perform this task of clearing cells.

Open the class file: 11_macros.xlsx.

1) View Macros Record Macro

Excel 2007 Part 3 (v1.0) 34 of 40 ©2012 Michael J. Walk

Page 35: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

2) Give the macro a name and a description:a. Call it ClearSheet

3) Click OK to start recording your actions. Everything you do after this point will be recorded and replicable.

a. Delete the Date cellb. Delete the Site cellc. Delete the contents below row 5d. Place your cursor in the Date cell.

4) Click the stop icon in the lower left of your screen.

Excel 2007 Part 3 (v1.0) 35 of 40 ©2012 Michael J. Walk

Page 36: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

5) To save your macro, you will have to save the file as a Macro-Enabled Workbook.6) Type some data into the cells you just deleted.7) Run your macro by: View Macros View Macros (select your Macro) Run.

EXERCISES

EXERCISE 1: FILTERING

Use the data from class file 1_filtering.xlsx.

1) Remove all filters on the data and start with an unfiltered data set.2) Find all sales with customers whose names start with “M”3) In the West region4) Greater than $500 sales

Date Region Product Category Product Customer Name Sales Cost Profit9/17/2011 West Grocery Fruits and Vegetables Mathew Reese $3916.91 $1231.38 $2685.53

10/30/2010 West Stationery Computer Paper Mathew Reese $2330.29 $585.7 $1744.599/24/2010 West Grocery Fruits and Vegetables Maxwell Schwartz $5084.34 $1804.98 $3279.3612/6/2009 West Furniture Office Chairs Munaf Patel $711.44 $87.48 $623.966/30/2009 West Grocery Fruits and Vegetables Michael Angelo $853.88 $298.4 $555.48

10/30/2008 West Stationery Computer Paper Mathew Reese $2330.29 $585.7 $1744.599/24/2008 West Grocery Fruits and Vegetables Maxwell Schwartz $5084.34 $1804.98 $3279.364/20/2008 West Grocery Fruits and Vegetables Mathew Reese $4794.07 $1850.13 $2943.941/14/2008 West Stationery Computer Paper Mary Elizabeth $670.79 $240.31 $430.481/9/2008 West Grocery Fruits and Vegetables Michael Nathan $2969.55 $877.34 $2092.21

Excel 2007 Part 3 (v1.0) 36 of 40 ©2012 Michael J. Walk

Page 37: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

EXERCISE 2: FIND AND REPLACE

Use the current excel file (1_filtering.xlsx).

1) Find all sales for Jency Johnah and replace them with Jency Jurik2) Write down how many cells were replaced: ________________

EXERCISE 3: NAMED CONSTANTS AND RANGES

Use the class file: 2_naming.xlsx.

1) Create a named range for all the salaries. Call the range of cells from C4 to C8, Salaries.2) Using the named range, Salaries, calculate the total payroll (before bonuses) in a cell. Also

calculate the average payment per employee (before bonuses) in a different cell.3) Using the named constant, bonus_percent, create a formula to calculate the bonus amount

for each employee.4) Name the cell range for the bonuses, Bonuses.5) Add a cell for total bonuses paid. Add a cell for the average bonus paid. (Make sure you use

the named range Bonuses in your formulas.6) Add a cell that calculates the total payroll, including bonuses.

Salary Bonus Amount

Fredericks $1,035.00 $46.58Taylor $2,057.85 $92.60Kevin $795.32 $35.79Smith $1,353.00 $60.89Johns $5,678.00 $255.51

Total $10,919.17 $491.36Average $2,183.83 $98.27

Total Pay $11,410.53

EXERCISE 4: DUAL-AXIS GRAPH WITH LABELS

Using the current Excel file (3_advanced charts.xlsx)…

1) Create a column and line chart that displays the quarterly sales and profit rate for Boston Crab Meat.

2) The sales should be columns. The profit rate should be a line.3) Add data labels that are displayed at the bottom of the columns.4) Add a title to the chart: Boston Crab Meat.5) Add axis labels to both Y axes and the X axis.6) Remove the horizontal gridlines7) Move the legend to the top.

Excel 2007 Part 3 (v1.0) 37 of 40 ©2012 Michael J. Walk

Page 38: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

8) Your chart should look like this:

$1,768.41 $1,978.00 $4,412.32 $1,656.00 0

0.2

0.4

0.6

0.8

1

$-

$1,000.00

$2,000.00

$3,000.00

$4,000.00

$5,000.00

Qtr 1 Qtr 2 Qtr 3 Qtr 4

Profi

t Rat

e

Sale

s

Quarter

Boston Crab MeatSales Profit Rate

EXERCISE 5: ADDING A TRENDLINE

Use the open file 4_trendline.

1) Create a line chart for the cost data2) Add a 14-day moving average (call the trend line 14-day Avg)3) Add titles to all axes and the graph itself.4) Move the legend so that it overlays the chart on the right. Change the fill of the legend so

you can’t see through it.5) Your chart should look like this

$0.00

$500.00

$1000.00

$1500.00

$2000.00

$2500.00

$3000.00

$3500.00

$4000.00

9/3/2011 10/3/2011 11/3/2011 12/3/2011

Cost

Date

Daily CostCost

14-day Avg

EXERCISE 6: CONDITIONAL FORMATTING

Use the open file 5_conditional formats.xlsx, Store Data sheet.

Excel 2007 Part 3 (v1.0) 38 of 40 ©2012 Michael J. Walk

Page 39: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

1) Apply conditional formatting to the Cost column so that the Top 10 cells are filled green with dark green text.

2) Apply a filter to the data set based on the green color fill. (Note, I haven’t taught you exactly how to do this, but I’m sure you can figure it out. Hint: Data Filter, then use the filter selectors.)

EXERCISE 7: IF/AND/OR/COUNT(SUM)IF

Open the class file 7_advanced functions.xlsx.

1) In the blue row, count the number of people available on each date.2) In the Responded column, have “Yes” display if the person has responded (i.e., they have at

least one date indicated) and have “No” display if the person has no dates.3) In the All Available row, use a formula to place an “X” in the date where all the persons who

have responded so far are available. (Hint: you will have to use an absolute reference in this formula—remember that skill? If so, you’ll be in the $money—wink wink.)

Name 5/13/2012 5/14/2012 5/15/2012 5/16/2012 5/17/2012 Responded?Michael X X YesAngelique X X X X YesPhil X X X YesLisa NoCount 1 3 2 1 2 3All Available? Yes

Dates

4) Make Angelique available on 5/15/2012 and see how the data table changes.5) Make Lisa available on 5/15/2012 and see how the data table changes.

Name 5/13/2012 5/14/2012 5/15/2012 5/16/2012 5/17/2012 Responded?Michael X X YesAngelique X X X X X YesPhil X X X YesLisa X YesCount 1 4 3 1 2 4All Available? Yes

Dates

EXERCISE 8: REMOVE DUPLICATE NAMES AND CACULATE TOTAL SALES AND PROFIT

1) Use the existing class file: 10_duplicates.xlsx2) Create a list of unique names on the Summary worksheet under the column name Customer

Name (column G).3) Use SumIf formulae to calculate:

a. Total sales and profit per product categoryb. Total sales and profit per customer

Here’s a snapshot of your results:

Excel 2007 Part 3 (v1.0) 39 of 40 ©2012 Michael J. Walk

Page 40: Academic Resource Center - jwalkonline.org 2007/Excel 2007 Part 3 …  · Web viewTo find all cells containing a specific value and then ... a value to a word. ... called “heat

5/12/2012

Product Category Sales Profit Customer Name Sales ProfitStationery 6579.93 4118.54 Augustine Paul 1224.63 709.61Furniture 12314.75 11004.88 Jency Johnah 9288.95 147.32Grocery 39896.54 25716.8 Maxwell Schwartz 548.61 147.32

Florence Joy 715.79 5304.25Rhino Augustus 6576.57 687.43David Flashing 144.36 250.99Barbara Fisher 1233.29 147.32Hilary Holden 247.16 499.69Steve Waugh 1092.48 147.32Victor Price 176.97 147.32Shui Tom 2152.19 8708.95Peter Brian 908.01 537.88Michael Nathan 2232.75 952.93Grace Kelly 833.43 802.32Helen Magadalene 8082.92 203.84Venu Karthik 2103.63 53.23Pete Zachriah 334.65 53.23Harold Pawlan 613.62 540.7

Excel 2007 Part 3 (v1.0) 40 of 40 ©2012 Michael J. Walk