Friday, 20 July 2012

18: Creating Pivot Tables

Pivot table reports, or pivot tables as they are often called, can help you answer questions about your spreadsheet by analyzing the numerical information in various ways. If you work with spreadsheets with a lot of data, pivot tables can be an extremely useful tool. Pivot table reports give you power because you can quickly find the answer to many different questions, and manipulate your data in many different ways.

In this lesson, you will learn the basics of inserting and working with pivot table reports.

Pivot Tables

Why are They Named Pivot Tables?
You may be wondering why it is called a pivot table. Basically, pivot tables allow you to pivot, or move, data so that you can produce answers to questions. Once you create a pivot table, you can very easily see what effect pivoting the data has on the spreadsheet information.
To Create a Pivot Table Report (Part I):
  • Select the cells in your spreadsheet that you want to use in the pivot table report.
  • Select the Insert tab.
  • Click the PivotTable command.
  • Click PivotTable again. Excel selects cells in the actual spreadsheet and the Create PivotTable dialog box opens.
    • Select a table or range is already selected and the Table/Range field shows the range of the selected data. New Worksheet is also selected by default as the place where the report will be placed.
Pivot Table Dialog Box

  • Click Existing Worksheet and select a worksheet, if you do not want the pivot table to appear in a new worksheet.
  • Click OK.

Creating a Pivot Table Report
If you use the sample spreadsheet to create a pivot table, you can see that the column headings are salesperson,regionaccountorder amount, and month. When you create a pivot table, each column label in your data becomes a field that can be used in the report. The Field List appears on the right side of the report, while thelayout area appears on the left.
Pivot Table View

To Create a Pivot Table Report (Part 2):
  • Determine what question you want your pivot table report to answer. For example, using the sample spreadsheet, you might want to know which salesperson sold the greatest dollar amount.
  • Determine the fields that are necessary to answer this question. In this example, salesperson and order amount.
  • Select the check box next to the Salesperson field in the PivotTable Field List. The field will appear in the drag and drop area at the bottom of the field list and in the layout area. The order amount data appears on the right. This is a default setting in Excel – data with numbers will always appear on the right.
  • Select the check box next to the Order Amount field in the PivotTable Field List. The field will appear in the drag and drop area at the bottom of the field list and in the layout area. All of the salesperson data appears on the left side as rows.
  • You can now see the answer to your question in the report on the left.
Pivot Table Example

To Add a Report Filter:
  • Select a field in the Field List. In this example, choose Region. By default, it will appear in the Row Labels group.
  • Click and drag Region into the Report Filter section.
  • Release the mouse button. The region appears at the top of the report as a filter.
  • The arrow by the Region fields shows (All). To show just the data for a specific region, click the drop-down arrow and select the region. To see multiple regions, click the Multiple Regions box, select the regions to display, and then, click OK.

Moving, or Pivoting Data:
  • Click and drag a field from one area to another.
Move Data

  • Release the mouse button to drop the field in the new area. In this example, we move Region from Report Filter to Column Label. The pivot table report will change.
Move Data Part II

  • Right-click one of the rows. A menu will appear.
  • Select Move and then select a move option.
Right-Click Menu

To Create a PivotChart
  • Select the Pivot Chart command from the Options tab. The Insert Chart dialog box appears.

  • Select the chart you’d like to insert.
  • Click OK. The chart will now appear on the same sheet as the Pivot Table.
The information in the chart includes the information in the pivot table, rather than all the original source data.

17: Using Conditional Formatting

Imagine you have a spreadsheet with thousands of rows of data. It would be extremely difficult to see patterns and trends just from examining the raw data. Excel gives us several tools that will make this task easier. One of these tools is called conditional formatting. With conditional formatting, you can apply formatting to one or more cells based on the value of the cell. You can highlight interesting or unusual cell values, and visualize the data using formatting such as data bars.

In this lesson, you will learn how to apply, modify, and delete conditional formatting rules.

Conditional Formatting

The Conditional Formatting Options
You have many conditional formatting rules, or options, that you can apply to cells in your spreadsheet. Each rulewill affect selected cells differently. Before you choose a formatting rule, you need to identify what questions you are trying to answer. For example, in a sales spreadsheet, you might want to identify the salespeople with lower than average sales. To do this, you need to choose a conditional formatting rule that will show you this answer. Not all of the options will provide you with this information.
Some of the Conditional Formatting Options Include:
  • Highlight Cell Rules: This rule highlights specific cells based on your option choice. For example, you can choose for Excel to highlight cells that are greater than, less than, or equal to a number, and between two numbers. Also, you can choose for Excel to highlight cells that contain specific text, including a specific date. If you choose this option, a dialog box will appear, and you will have to specify the cells to highlight, and the color you would like to highlight the cells.
Highlight Cell Rules

Highlight Cell Rules

  • Top/Bottom Rules: This conditional formatting option highlights cell values that meet specific criteria, such as top or bottom 10%, above average, and below average. If you choose this option, a dialog box will appear, and you will have to specify the cells to highlight, and the color you would like to highlight the cells.
Highlight Cell Rules

Highlight Cell Rules

  • Data Bars: This is an interesting option that formats the selected cells with colored bars. The length of the data bar represents the value in the cell. The longer the bar, the higher the value.
Highlight Cell Rules

  • Color Scales: This option applies a two or three color gradient to the cells. Different shades and colors represent specific values.
Highlight Cell Rules

To Apply Conditional Formatting:
  • Select the cells you would like to format.
  • Select the Home tab.
  • Locate the Styles group.
  • Click the Conditional Formatting command. A menu will appear with your formatting options.
Conditional Formatting

  • Select one of the options to apply it to the selected cells. A cascading menu will appear.
Conditional Formatting

  • An additional dialog box may appear, depending on the option you choose.
  • If so, make the necessary choices, and click OK.

To Remove Conditional Formatting Rules:
  • Click the Conditional Formatting command.
  • Select Clear Rules. A cascading menu appears.
  • Choose to clear rules from the entire worksheet or the selected cells.

To Manage Conditional Formatting Rules:
  • Click the Conditional Formatting command.
  • Select Manage Rules from the menu. The Conditional Formatting Rules Manager dialog box will appear.
Conditional Formatting

  • From here you can edit a rule, delete a rule, or change the order of rules.

16: Working with Charts

chart is a tool you can use in Excel to communicate your data graphically. Charts allow your audience to more easily see the meaning behind the numbers in the spreadsheet, and make showing comparisons and trends a lot easier. In this lesson, you will learn how to insert and modify Excel charts and see how they can be an effective tool for communicating information.

Working with Charts

Creating a Chart

Charts can be a useful way to communicate data. When you insert a chart in Excel, it appears in the selected worksheet with the source data, by default.
To Create a Chart:
  • Select the worksheet you want to work with. In this example, we use the Summary worksheet.
  • Select the cells that you want to chart, including the column titles and the row labels.
  • Click the Insert tab.
  • Hover over each Chart option in the Charts group to learn more about it.
  • Select one of the Chart options. In this example, we use the Columns command.
  • Select a type of chart from the list that appears. For this example, we use a 2-D Clustered Column. The chart appears in the worksheet.
Select Data for Chart

Identifying the Parts of a Chart

Have you ever read something you didn't fully understand but when you saw a chart or graph, the concept became clear and understandable? Charts are a visual representation of data in a worksheet. Charts make it easy to see comparisons, patterns, and trends in the data.
Chart Example
Source Data
The range of cells that make up a chart. The chart is updated automatically whenever the information in these cells change.
The title of the chart.
The chart key, which identifies each color on the chart represents.
The vertical and horizontal parts of a chart. The vertical axis is often referred to as the Y axis, and the horizontal axis is referred to as the X axis.
Data Series
The actual charted values, usually rows or columns of the source data.
Value Axis
The axis that represents the values or units of the source data.
Category Axis
The axis identifying each data series.

Chart Tools

Once you insert a chart, a new set of Chart Tools, arranged into 3 tabs, will appear above the Ribbon. These are only visible when the chart is selected.
Select Data for Chart
To Change the Chart Type:
  • Select the Design tab.
  • Click the Change Chart Type command. A dialog box appears.
Change Chart Type

  • Select another chart type.
  • Click OK.
The chart in the example compares each salesperson's monthly sales to his/her other month's sales; however you can change what is being compared. Just click the Switch Row/Column Data command, which will rotate the data displayed on the x and y axes. To return to the original view, click the Switch Row/Column command again.
To Change Chart Layout:
  • Select the Design tab.
  • Locate the Chart Layouts group.
  • Click the More arrow to view all your layout options.
Change Chart Layout

  • Left-click a layout to select it.
If your new layout includes chart titles, axes, or legend labels, just insert your cursor into the text and begin typing to add your own text.

To Change Chart Style:
  • Select the Design tab.
  • Locate the Chart Style group.
  • Click the More arrow to view all your style options.
  • Left-click a style to select it.
Change Chart Style

To Move the Chart to a Different Worksheet:
  • Select the Design tab.
  • Click the Move Chart command. A dialog box appears. The current location of the chart is selected.
  • Select the desired location for the chart (i.e., choose an existing worksheet, or select New Sheet and name it).
Move Chart

15: Using What-If Analysis

The real power in Excel comes in its ability to perform multiple mathematical calculations for you. One of the tools in Excel that you can use to perform these calculations is a Data tool called What-If Analysis. What-If analysis allows you to see the effect that different values have in formulas. Have you ever thought, "What interest rate do I need to qualify for to have a car payment of $400 on the car I want?" This question can be answered using What-If Analysis. 

In this lesson, you will learn how to use a What-If Analysis tool called Goal Seek.

What-If Analysis

What-if Analysis: Example

You need a loan to buy a new car. You know how much money you want to borrow, how long of a period you want to take to pay off the loan (the term), and what payment you can afford to make each month. But what you need to know is what interest rate you need to qualify for to make the payment $400 a month. In the image below, you can see that if you didn’t have interest and just divided this $20,000 into 60 monthly payments, you would pay $333.33 a month. The What-If Analysis tool will allow you to easily calculate the interest rate.
Where Did the Formula Come From?
The formula that appears in cell B5 in the example image is a function. It isn't part of the What-if Analysis tool, so you will need to understand functions thoroughly before you use What-if Analysis. For the example scenario described above, you need a formula that will calculate the monthly payment. Instead of writing the formula yourself, you can insert a function to do the calculation for you.
To Insert a Payment Function:
  • Select the Formula tab.
  • Click the Insert Function command. A dialog box appears.
  • Select PMT.
  • Click OK. A dialog box appears.
  • Insert your cursor in the first field. A description about the needed information appears at the bottom of the dialog box.
Payment Function Example

  • Select the cell in the spreadsheet with the needed information.
  • Insert your cursor in the next field. A description about the needed information appears at the bottom of the dialog box.
  • Select the cell in the spreadsheet with the needed information.
  • Repeat the last two steps until all the necessary information is entered in the dialog box.
  • Click OK.

What-If Analysis Tools

There are three What-If analysis tools that you can use. To access these, select the Data tab, and locate the What-If Analysis command. If you click this command, a menu with three options appears.

Goal seek is useful if you know the needed result, but need to find the input value that will give you the desired result. In this example, we know the desired result (a $400 monthly payment), and are seeking the input value (the interest rate).

Goal Seek

To Use Goal Seek to Determine an Interest Rate:
  • Select the Data tab.
  • Locate the Data Tools group.
  • Click the What-If Analysis command. A list of three options appears.
Select What-If Command

  • Select Goal Seek. A small dialog box appears.
  • Select the cell that you want to set to a specific value. In this example, we want to set B5, the Payment cell.
Goal Seek Example

  • Insert the cursor in the next field.
  • Enter a value in the value field. In this example, type -$400. Since we’re making a payment that will be subtracted from our loan amount, we have to enter the payment as a negative number.
Goal Seek Example

  • Insert the cursor in the next field.
  • Select the cell that you want to change. This will be the cell that tries various input values. In this example, select cell B4, which is the interest rate.
Goal Seek Example

  • Click OK.
  • Then, click OK again. The interest rate appears in the cell. This indicates that a 7% interest rate will give us a $400 a month payment on a $20,000 loan that is paid off over 5 years, or 60 months.
Goal Seek End of Example