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

358

POWER EXCEL WITH MR EXCEL

 

 

 

SHOW CUSTOMER ACCOUNT & NAME

Problem: My source data comes from the sales reps. They don’t use consistent names, so I end up with multiple customer names for one account number.

Figure 919 Bad for pivot tables.

This forces me to put both Acct and Customer in the row area. This looks horrible. The customer name doesn’t appear on the totals for each account.

Figure 920 You want Acct and Customer on the total row.

Strategy: This common problem would be solved if the Excel team would allow you to add Customer

Name to the pivot table with a calculation of “First” or “Last”. Look; we don’t really care if we get G.E. or General Electric…either one is a million times better than an empty cell on the total row.

But, for now, we don’t have First or Last. Your best bet is likely to be creating a pivot table with Acct and

Revenue. Copy the entire pivot table. Paste as Values.

PART 3: WRANGLING DATA

359

 

 

Figure 921 Convert the pivot table to values.

You are now allowed to insert a blank column between Acct and Revenue. Use a VLOOKUP back into the original data set to fill in the customer name.

Figure 922 Use a VLOOKUP to get the text fields.

3

Alternate Strategy: You can do the FIRST yourself back in the original data set. Add a column called Acct - Customer. Use a formula to concatenate the Acct with a VLOOKUP to return the first customer from the list.

Figure 923 Build your own Acct-Customer field.

When you build the pivot table, put this field in the row labels.

Figure 924 This has the data that you need and avoids the duplicate customer names.

360

POWER EXCEL WITH MR EXCEL

 

 

 

SHOW MONTHS WITH ZERO SALES

Problem: I built a pivot table to show sales by month for one customer. For the large customers, I get all 12 months.

Figure 925 All 12 months appear.

But for the smaller customers, I don’t see all of the months. I was thinking of adding 12 dummy records for every customer, one per month, but with

300 customers, that would be 3600 fake records just to solve this stupid problem.

Figure 926 Months without sales are missing.

Strategy: Select a cell in the data column. Click the Field Settings icon in the Analyze tab. This time, go to the second tab in the dialog, called Layout and

Print. On that tab, click Show Items With No Data.

Gotcha: You are not done yet. The months now ap- pear, but they are empty cells instead of zero. Also, a strange entry appears at the top and the bottom of the data set. There are no records in the data set before 1/1/2014, so this is a pure annoyance from Microsoft.

To fix the empty cells, right-click the pivot table and choose Options. Fill in the For Empty Cells

Show box with a zero.

Figure 928 Replace empty cells with zero.

Figure 927 Strange entries in row 4 & 17.

PART 3: WRANGLING DATA

361

 

 

Go to the filter dropdown for Dates. Uncheck the

<1/1/2014 and the >12/29/2014 entries.

Figure 929 Turn off the < and > values.

The result: a pivot table that will show all 12 months for every customer.

Figure 930 Easier than adding 3,600 fake zero records to the data.

CREATE A UNIQUE LIST OF CUSTOMERS WITH A PIVOT TABLE

Problem: I need to create a unique list of customers from a large list.

3

Strategy: You can build a pivot table report with Customer in the Row area of the layout. Because the

 

 

pivot table creates a summary report, the first column of the table will include the unique list of custom-

 

ers. Here’s what you do:

 

1.

Select Insert, Pivot Table. Click OK in the Create PivotTable dialog.

 

2.

Click the Customer field in the PivotTable Field List dialog.

 

That’s it. You are done. You can now copy the customers from column A of the new sheet and use Paste

Values to put the unique list of customers wherever you need it.

Figure 931 Four clicks to create a unique list of customers.