Reading history

Excel PivotTables and Data Analysis

5 min read 0 views

Learn to prepare data, build and customise PivotTables, add PivotCharts and slicers, and use Remove Duplicates, Data Validation and Goal Seek in Excel.

A stationery company has a sheet with thousands of sales rows. The manager asks: “How much did each district sell, month by month?” You could spend an hour writing SUMIFS formulas, or you could build a PivotTable in under a minute. In this lesson you will learn how to prepare data, build and change PivotTables, and use a few other quick analysis tools: Remove Duplicates, Data Validation and Goal Seek.

In this lesson you will learn

  • How to prepare data as a clean Excel table
  • How to create a PivotTable and use its four areas
  • How to change the summary, sort, filter and refresh
  • PivotCharts and slicers
  • Remove Duplicates, Data Validation and Goal Seek

You should know Excel’s conditional functions such as SUMIF.

Preparing the Data

PivotTables need data laid out as a simple list:

  • One row of headings at the top, each heading different.
  • One record per row, with no blank rows or columns in the middle.
  • No merged cells and no subtotal rows inside the data.

Click anywhere in the data and press Ctrl + T to make it an Excel Table. A table grows automatically when you add rows, so your PivotTable will always include the new data after a refresh.

Month   District     Item       Sales (Tk)
Jan     Dhaka        Pen          5,000
Jan     Khulna       Pen          3,000
Jan     Dhaka        Notebook     8,000
Feb     Khulna       Notebook     4,000
Feb     Dhaka        Pen          6,000
Feb     Chattogram   Pen          2,000
Feb     Chattogram   Notebook     7,000
Jan     Chattogram   Notebook     5,000

Creating a PivotTable

  1. Click inside the data.
  2. Choose Insert → PivotTable and select New Worksheet.
  3. In the PivotTable Fields pane, drag field names into the four areas.
Source dataMonthDistrictItemSales(8 rows)PivotTable FieldsFilters(Item)ColumnsMonthRowsDistrictValuesSum ofSalesSum of SalesJanFebTotalChattogram5,0009,00014,000Dhaka13,0006,00019,000Khulna3,0004,0007,000Grand Total21,00019,00040,000
  • Rows: the categories listed down the side (District).
  • Columns: the categories across the top (Month).
  • Values: the numbers to summarise (Sum of Sales).
  • Filters: a drop-down at the top to show only some data, such as one Item.
Sum of Sales     Jan       Feb      Grand Total
Chattogram      5,000     9,000       14,000
Dhaka          13,000     6,000       19,000
Khulna          3,000     4,000        7,000
Grand Total    21,000    19,000       40,000

Eight rows became a clear summary, and the same steps work for eighty thousand rows. Drag Item into Rows below District to see each district broken down by item.

Changing the Summary

  • Different calculation: right-click a value → Summarize Values By → Count, Average, Max or Min. Count tells you how many sales were made, not their value.
  • Percentages: right-click → Show Values As → % of Grand Total. Dhaka becomes 47.5%.
  • Sorting: right-click a total → Sort → Largest to Smallest to rank districts.
  • Grouping dates: if you have real dates, right-click one → Group to group by month, quarter or year.
  • Refresh: a PivotTable does not update by itself. After changing the source data, right-click it and choose Refresh (or Alt + F5).

PivotCharts and Slicers

With the PivotTable selected, choose PivotTable Analyze → PivotChart. The chart follows the PivotTable: filter the table and the chart changes too.

A slicer (PivotTable Analyze → Insert Slicer) adds a panel of buttons, such as one for each Item. Click “Pen” and the whole PivotTable shows pen sales only. Slicers make reports easy for anyone to explore, even people who do not know Excel well.

Other Quick Analysis Tools

  • Remove Duplicates (Data tab): deletes repeated rows, for example a student entered twice. Make a copy of your data first, because it deletes rows straight away.
  • Data Validation (Data tab): limits what can be typed in a cell. You can allow only whole numbers from 0 to 100 in a marks column, or give a drop-down list of districts so nobody types “Dhka”.
  • Goal Seek (Data → What-If Analysis): works backwards from the answer you want.
Goal Seek example
B1: 75   B2: 82   B3: (final exam, unknown)
B4: =AVERAGE(B1:B3)
Set cell B4 to value 80 by changing cell B3
→ Goal Seek puts 83 in B3, since (75 + 82 + 83) ÷ 3 = 80

Common Mistakes

  1. Blank or repeated headings. Every column needs its own unique heading.
  2. Forgetting to refresh. Old totals stay until you click Refresh.
  3. Numbers stored as text. If Sales were typed as text, the PivotTable shows Count instead of Sum. Convert them to numbers first.
  4. Typing over a PivotTable. Change the source data or the field settings, not the cells of the PivotTable itself.

Practice Exercises

Exercise 1. Using the sample data, what is the total sales of notebooks?

Show answer

8,000 + 4,000 + 7,000 + 5,000 = 24,000 Tk. In a PivotTable, put Item in Rows and Sales in Values.

Exercise 2. You want to know how many separate sales each district made, not their value. What do you change?

Show answer

Change the value field to Count: right-click a value → Summarize Values By → Count. Dhaka 3, Chattogram 3, Khulna 2.

Exercise 3. How would you stop people typing a mark above 100 in column D?

Show answer

Select column D, then Data → Data Validation → Allow: Whole number, between 0 and 100. Add an error message such as “Marks must be 0 to 100”.

Frequently Asked Questions

What is a PivotTable used for in Excel?

A PivotTable quickly summarises a large list of data, for example total sales by district and month, without writing formulas. You drag fields into Rows, Columns, Values and Filters, and can rearrange them at any time.

Why is my PivotTable not showing new data?

PivotTables do not update automatically. Right-click inside it and choose Refresh. If your new rows are outside the original range, convert the data to an Excel Table with Ctrl plus T so the range grows automatically.

Summary

  • Prepare data as a clean list with one heading row; Ctrl + T makes it a Table.
  • A PivotTable uses Rows, Columns, Values and Filters to summarise data instantly.
  • Change the summary type, show percentages, sort, group and always refresh after changes.
  • PivotCharts and slicers make reports visual; Remove Duplicates, Data Validation and Goal Seek help clean and analyse data.

Next: MS Word Mail Merge and Long Documents.

Lessons are also marked complete when you click Next.

Leave a Reply

Your email address will not be published. Required fields are marked *