Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
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б
Скачать

320

POWER EXCEL WITH MR EXCEL

 

 

Figure 819 This doesn’t look like a pivot table, but harnesses the power.

Additional Details: Cell P1 in the report is a date that I type manually each month. Formulas in row 4 use that date to show “Actual” or “Plan” based on the date. =IF(MONTH(DATEVALUE(E3&" 1, 2014"))<=MO NTH($P$1),"Actual","Plan").

MANUALLY RE-SEQUENCE THE ORDER OF DATA IN A PIVOT TABLE

Problem: By default, a pivot table organizes data alphabetically. For the Region field, this means the data is organized with Central first, East second, and West third. My manager wants the regions to appear in the order East, Central, West. After unsuccessfully lobbying to have the Central region renamed Middle,

I need to find a way to have my table sequenced with the East region first.

Figure 820 Central, East, West is the alphabetical sequence.

Strategy: It is amazing that this trick works. Try it: 1. Select cell B4 in the pivot table.

2. In cell B4, type the word East.

Figure 821 Go to the Central cell and type a new heading.

3. When you press Enter, Excel senses what you are trying to do. All the data from the East region moves to Column B. Excel automatically moves the Central region heading and data to column C.

PART 3: WRANGLING DATA

321

 

 

Figure 822 East and Central switch! Never try this outside a pivot table.

You can easily use this trick to re-sequence the fields into any order as necessary.

Additional Details: This technique will only change the Region sequence in a single pivot table. If you would like to change the sequence in all future pivot tables, you need to create a custom list with the re- gions in the proper sequence. See "Have the Fill Handle Fill Your List of Part Numbers" on page 42. Any pivot tables created will follow the custom list sequence.

PRESENT A PIVOT TABLE IN HIGH-TO-LOW ORDER BY REVENUE

Problem: A pivot table organizes data alphabetically by default. I want to produce a report that is sorted high to low by revenue.

 

Figure 823 Reports are normally sorted alphabetically.

 

Strategy: Each pivot table field offers a sort option. To access the sort options for a field, follow these steps:

 

3

1.

Open the Customer field dropdown in cell A3.

Gotcha: Depending on the layout, this field might be

 

2.

called Row Labels instead of Customer.

 

 

 

 

Choose More Sort Options.

 

 

Figure 824 Choose More Sort Options.

3. Excel displays the Sort (Customer) dialog. Initially, the sort is set to Manual. This option lets you re-sequence items by dragging or retyping as discussed in the previous topic. Choose Descending. Open the dropdown under Descending and choose Revenue.

Figure 825 Choose descending by Revenue.

Results: The report will be sequenced with the largest customers at the top.

322

POWER EXCEL WITH MR EXCEL

 

 

Figure 826 Largest customers at the top.

Further, as you continue to pivot this report, Excel will remember that customers should always be sorted based on descending revenue. In this figure, product is added as an outermost row field. The report is au- tomatically sorted, this time with Exxon at the top.

Figure 827 Customer continues to re-sort after pivoting.

Additional Details: If you use the Compact Form layout with multiple row fields, there is an extra step. When you open Row Labels, you have to choose from a second dropdown to choose which field you want to sort.

Figure 828 Extra dropdown in Compact Form layout.

An alternate method for accessing the Sort dialog is to hover over the Customer field in the top of the Pivot- Table Field List dialog. A dropdown appears. You can choose to sort or filter from this dropdown.

EXCEL 2016 SOMETIMES AUTO-GROUPS DAILY DATES TO MONTH

Problem: I just upgraded to Excel 2016. When I add dates to a pivot table, it sometimes automatically groups to months or months quarters and years. Other times, it does not.

Strategy: Most people could not figure out how to manually group daily dates by month as discussed in the next topic. New logic in Excel 2016 will automatically group daily dates if they span a long enough period.

Here are the rules:

● If all of the dates are in one month, no grouping will occur.

● If the dates start in one month and end in another month, the report will group by month and day. Only Month will initially appear.

● If the dates start in one year and end in another year, the report will group by years, quarters, and months. But individual days will not be available.

The report will start with dates grouped to the highest level, as shown here:

Figure 829 Drag daily dates to the pivot table, and you might get this view.

PART 3: WRANGLING DATA

323

 

 

Click on the cell for year 2018 and click the Expand Field icon on the Analyze tab. The years will expand and show quarters.

Figure 830 Expand years to quarters. Click on Qtr3 and expand again to see months.

If you don’t like the Auto-grouping, you can choose any date field and select Group Field to change the settings. Or, immediately after dragging Date to the pivot table, press Ctrl+Z to undo the grouping. Or - to turn it off permanently, there is a registry setting described at http://mrx.cl/stopautogroup.

GROUP DAILY DATES BY MONTH IN A PIVOT TABLE

Problem: My data set has a date on which each item was shipped. When I produce a pivot table with the date field, it provides sales by day. My plant manager loves sales by day, but everyone else in the company would rather see sales by month.

3

Figure 831 Excel reports daily dates.

Strategy: You can group daily dates to show year, quarter, and month. To do so, you build a pivot table with dates in the Row area of the pivot table:

1. Select a cell that contains a date. Click the Group Field icon in the Analyze tab. Excel displays the

Grouping dialog.

324

POWER EXCEL WITH MR EXCEL

 

 

2.The Grouping dialog defaults to selecting months. If your data spans more than one year, it is crucial that you also select years. Select Months and Years. If you don’t choose Years, Excel will group January from one year and January from another year into a single value called January.

The Date field is now replaced with Months. There is a field called Years. Years and Months are shown in the pivot ta- ble, although the pivot table is not showing subtotals for each year.

Figure 832 Select Months and Years.

3.To add the subtotals for the years field, select a years field, then choose Field Settings as shown.

Figure 833 500 rows of daily dates are now 24 rows of months.

4. In the Field Setting dialog, change Subtotals from None to Automatic.

Figure 834 Change the Years field to use Automatic Subtotals.

The result is a report with a subtotal for each year.