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

316

POWER EXCEL WITH MR EXCEL

 

 

If you have multiple column fields, you can select various columns by hovering near the top of the label for a column.

Gotcha: This feature can be turned off. To ensure that it’s not turned off, enable the Enable Selection set- ting under the Select dropdown on the Analyze tab.

APPLY CONDITIONAL FORMATTING TO A PIVOT TABLE

Problem: The new conditional formatting options in Excel are amazing, but they require special care in pivot tables. If you include the grand total row, it will get the largest data bars, and the detail cells have relatively meaningless bars.

Strategy: You can use the Manage Rules dialog to assign conditional formatting to only certain cells. You can initially create the “wrong” formatting and then edit it to refer to only the selected cells. For example, follow these steps:

1. Select cells B5:B15. You want the first cell in the selection to be the correct type of cell. In this case, it is a value for a product.

2. Select Home, Conditional Formatting, Data Bars, Solid Fill, Red. Excel applies data bars, but the region totals are getting the largest bars.

Figure 810 Cells B8 & B12 artificially get the largest data bars.

3. Open the pivot options dropdown at the bottom right corner of the pivot table. Choose to apply the formatting rule to only cells for revenue and product.

Figure 811 A dropdown appears in the grid.

Figure 812 Go to the Edit Rules dialog in Excel 2007.

Results: the data bars are applied only to the detail product rows.

PART 3: WRANGLING DATA

317

 

 

Figure 813 The data bars are applied only to like cells.

Additional Details: Similar settings are available for icon sets and color scales.

CAN I SAVE FORMATTING IN A TEMPLATE?

Problem: Every month, I have to change my pivot table formatting. Can I create a template to remember my favorite settings?

Strategy: The pivot table template concept is a frequent request as I do my Power Excel seminars. I predict that Microsoft won’t add this, because the people inside of Microsoft have embraced building a 3 template using GetPivotData.

I first learned this technique from a former Microsoft staffer. It really is a cool way to improve your monthly reporting workflow. It will take an extra 15 minutes during the first month, but then it will save time in the future.

1. Build an ugly, unformatted pivot table with every field that you will need in your final report.

2. On a new worksheet, build a non-pivot table report shell that contains all of the formatting that you want to use.

3. Start in one cell of the report shell. Type an equals sign. Go to the pivot table and find the cell that contains the correct information. Click that cell and press Enter. Microsoft will build a GETPIVOTDATA formula for you. Gotcha: The fields in the formula are hard-coded and can not be copied to other cells in the report.

4. Edit the first formula to use labels in your report.

5. Copy the formula throughout your report.

Each month, the workflow becomes: Add new data to the data set. Refresh the ugly pivot table. Print the nicely formatted report that draws its numbers from the pivot table.

Here are some examples.

This figure shows a very ugly pivot table. Excel adds Plan+Actual in column D which is useless. There is no way to get Actuals for Jan through May and Plan for June through December without showing both fields for every month.

318

POWER EXCEL WITH MR EXCEL

 

 

Figure 814 An ugly pivot table.

Typically, each month, you would create this pivot table, copy the table and paste as values. You would get rid of the columns you don’t need. You would resequence the stores in a geographic fashion. It would take half an hour to format the copied report.

Instead, build a report shell on a new worksheet. Format the report the way that you want it to be shown. If you want underlines and double-underlines, add them. If you want $ on row 1 and the total row, do that.

If you want (gasp) a blank row, add it. You can do whatever you want, since this is not a pivot table. It is just Excel.

Figure 815 Do any formatting in a non-pivot table report.

The first data cell in the report is for Baybrook Mall, January, Actuals. Choose that cell. Type an equals sign. Navigate to the pivot table worksheet and find the cell for Baybrook, January, Actual. Click on that cell and click OK.

Most of the time when Excel inserts a GETPIVOTDATA formula, it is an annoying side-effect of building a formula with a mouse. This time, it is crucial to building this report.

Gotcha: Most people are annoyed by Excel insert GETPIVOTDATA. Later in this book, in "Calculations Outside of Pivot Tables" on page 355, I will show you how to turn this feature off. If someone has turned the feature off on your computer, you need to turn it back on.

The fundamental problem with the automatically generated GETPIVOTDATA function is that the label values are hard-coded in the formula instead of pointing to cells in the worksheet.

PART 3: WRANGLING DATA

319

 

 

Figure 816 Changes this text to point to cells in the report.

The accountants at Microsoft who use this trick regularly call this next step, “Parameterizing the For- mula.” Change the three text values in the formula to point to cell addresses. Make sure to use the proper dollar signs. Replace Baybrook with $D6. Replace Jan with E$3. Replace Actual with E$4.

3

Figure 817 Replace text with cell addresses.

You can now copy that first formula and Paste Special Formulas to all the other report cells.

Figure 818 Copy the first formula and paste the formula throughout.

The result is a beautifully formatted report that is getting the data from the pivot table. Next month, add the May actuals, refresh the pivot table, and the report will update with new values.