Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Power excel 2016 with mrexcel Master Pivot Tables, Subtotals, Charts, VLOOKUP, IF, Data Analysis in Excel 2010–2013 (Bill Jelen) (z-lib.org).pdf
Скачиваний:
4
Добавлен:
14.08.2022
Размер:
49.75 Mб
Скачать

PART 3: WRANGLING DATA

325

 

 

Figure 835 Totals by year.

CREATE A YEAR-OVER-YEAR REPORT

Problem: I have two years of data by daily dates. I would like to see year-over-year sales by month.

Strategy: Amazingly, it takes only 10 mouse clicks to create this report. Follow these steps: 1. Select one cell in your data set.

2. Insert, Pivot Table, OK.

3. In the PivotTable Field List, choose Date and Revenue.

4. At this point, the Row Labels heading is selected. Move down one cell so that the cell pointer is on a date.

5. Choose Group Field. Months is already selected. Add Years. Click OK.

6. In the PivotTable Field List, drag Years from the Row Labels drop zone to the Column Labels drop zone. You will now have this report.

3

Figure 836 Pivot years to go across the report.

7. On the Design tab, open the Grand Totals dropdown and choose On For Columns Only which is the very strange way to delete the grand totals along the right side of the report.

8. In D4, type % Growth.

9. In D5, type =D5/C5-1. Do not use the mouse or arrow keys while entering this formula!

10.Format D5 as a percentage with 1 decimal place. 11.Copy D5 down to all rows.

12.Select the Sum of Revenue heading. In the Analyze ribbon tab, click in the Active Field box and change the field name to “Revenue “ (with a space after the word Revenue.)

13.On the Analyze ribbon tab, click the Field Headers to prevent those from being shown in the report.

326

POWER EXCEL WITH MR EXCEL

 

 

Figure 837 Year-over-year report created with a pivot table.

Gotcha: If you used the mouse in step 9, you will find that the percentage growth does not change as you copy it down. Go back and re-enter the formula, or follow the steps in "Calculations Outside of Pivot Tables" on page 355.

GROUP BY WEEK IN A PIVOT TABLE

Problem: The Grouping dialog allows grouping by second, minute, hour, day, month, quarter, and year. I need to group by week. How do I do it?

Strategy: In order to set up this grouping option correctly, you need to figure out the weekday where your data starts. The data set we’re using in this example has data for January 2, 2014. Use the Long Date format to see that this is Thursday. You will later make the report start at December 29, 2013 to that the weeks run from Monday through Sunday.

Now follow these steps:

1. Create a pivot table with dates in the Row area. Select any date cell and choose Group Field from the Options dialog.

2. In the Grouping dialog, Excel defaults to showing the entire range of dates of the data set. If you left the Starting At field unchanged, your weeks would all start on Thursday. Change the 1/2/2014 date to 12/29/2013 to have your weeks start on Monday.

3. Unselect the Months selection by choosing it with the mouse. Select the Days choice. This will en- able the Number of Days field at the bottom of the dialog. Use the spin button to move up to 7 days.

Figure 838 The Number of Days is only available if you choose only Days.

Results: The report will be redrawn as a weekly report.

PART 3: WRANGLING DATA

327

 

 

Figure 839 Excel will produce a report by week.

Additional Details: Excel does not add a “Week” field to the PivotTable Field List dialog. Instead, the field that formerly contained dates now contains weeks but is still called Date.

Additional Details: Some manufacturing companies use a 13-month calendar. You can group by 28 days to replicate this calendar. For bi-weekly payroll, group by 14 day periods.

Gotcha: After you group by weeks, Excel will not allow you to group by months, quarters, years, or any other selection.

LIMIT A PIVOT REPORT TO SHOW JUST THE TOP 5 CUSTOMERS

Problem: Many times my customer reports have hundreds of customers. If I’m preparing a report for the senior vice president of sales, he may not care about the 400 customers who bought spare batteries this month. He wants to see only the top 10 or 20 or 5 customers each month.

Strategy: You can accommodate this vice president by using the Top 10 Filter feature that is available in pivot tables. Follow these steps:

1. Build a pivot table with Customers in the row area.

2. Open the dropdown at the top of the customer dropdown. Choose Value Filters and then Top 10.

3

Figure 840 The top 10 can do to or bottom, 5, 10, 20, and more.

Excel displays the Top 10 Filter (Customer) dialog. By default, the dialog wants to show the top 10 items based on Sum of Revenue. Although it is called the “Top 10” feature, it is far more flexible than that. The first dropdown offers to filter to the top or bottom customers. You can use the spin button to change 10 to any other number. The third field offers Items, Percent, and Sum.

3. Change 10 to 5.

Figure 841 Show top five customers.

4. Click OK.

328

POWER EXCEL WITH MR EXCEL

 

 

Figure 842 The pivot table shows the top five customers.

Results: The report will be filtered to show just the top five customers. Note that a Filter icon appears in cell A3 to indicate that you are not seeing all customers. You can hover over this icon to see a list of the filters applied

Gotcha: If there is a tie for fifth place, the list may contain more than five customers. If you filter the pivot table to an obscure product purchased by only a few customers, you might have a hundred-way tie at $0 for fifth place.

Additional Details: Another common request might be to show enough customers to represent 80% of the total.

Figure 843 Show top 80%.

Or, you can ask for enough customers so the sum is $2,000,000. Excel will include the largest customers until the total is over $2,000,000.

Figure 844 Show enough customers to be over $2,000,000.

Gotcha: The total on each report includes only the customers shown in that report. My VP of Sales wants the other customers grouped into one line called Other. See the next topic for an alternate strategy.

Additional Details: To clear a filter, you use the dropdown at the top of that column and select Clear

Filters from Customer..

BUILD A BETTER TOP FIVE USING GROUPS

Problem: I want to show the top five customers, then one line for Other, then a total of the whole data set.