This resource provides a detailed tutorial on using Excel pivot tables for summarizing and analyzing large datasets. It begins by explaining the purpose and usefulness of pivot tables, contrasting them with static Excel tables and demonstrating their dynamic nature. The material then focuses heavily on data cleaning techniques that are essential before creating a pivot table, covering the removal of blank rows, duplicates, and unwanted formatting, as well as using formulas and features like Flash Fill to standardize text, dates, and separate combined data. Finally, the tutorial walks through creating and building a pivot table from scratch, explaining the pivot table field list, adding and manipulating fields, understanding aggregation methods (sum, count, average, etc.), grouping data, and customizing the report layout with subtotals, grand totals, and blank rows.
Mastering Excel Pivot Tables
Based on the information from the sources, here is a discussion about Pivot Tables in Excel:
What are Pivot Tables and Why are They Useful?
Effectively, pivot tables are an interactive way of quickly summarizing large amounts of data. In our data-driven world, many individuals collect data from various sources to support better business decisions. However, simply looking at large datasets in an Excel spreadsheet doesn’t clearly highlight key metrics, issues, successes, failures, or trends. Pivot tables provide a way to take this data and make sense of it.
For example, with a dataset of over 14,000 rows of sales data including region, country, item type, sales channel, order priority, order date, order ID, ship date, units sold, unit price, unit cost, total revenue, total cost, and total profit, it’s difficult to easily see things like the top 10 countries by total profit or the number of high-priority orders. Using filter drop-downs is possible but much less efficient than using a pivot table.
The key difference between a regular Excel table and a pivot table is that pivot tables are dynamic. This means you can quickly change the analysis being performed. By moving fields around, you can instantly view the data summarized in different ways, such as seeing the sum of total profit by country after initially looking at units sold. You can add other fields to break down the analysis further, like dropping ‘item type’ into columns to see sales summarized by country and item type. You can also apply filters, for instance, to show only the top five countries to make the data more manageable. Once data is in a pivot table, it can be pivoted in various ways, allowing the creation of more pivot tables and even pivot charts. This opens up opportunities for visual analysis, which is often easier for people to interpret. Ultimately, this can lead to creating interactive dashboards showing key metrics with filters.
In summary, a pivot table is a dynamic, interactive tool for summarizing large datasets. They are useful because they help analyze large datasets in a clear and effective way.
Difference Between Excel Tables and Pivot Tables
It’s important to understand the distinction between Excel Tables and Pivot Tables, as they are not the same. Excel tables are essentially static; you can sort or filter the data, but you cannot easily analyze it in many different ways. In contrast, pivot tables are much more dynamic. With a pivot table, you can move fields around and add different fields to view your data in numerous ways, making them ideal for data analysis.
The sources strongly recommend putting your data into an Excel table prior to creating a pivot table. While it might seem like an extra step, there are many advantages to using Excel tables that make working with pivot tables much easier. One of the most useful features of Excel tables is their auto-expand capabilities. If you add new data to the bottom of an Excel table, it automatically expands to include that data. This means that any pivot table or chart linked to that Excel table will automatically include the new data after a simple refresh. If your data is not in an Excel table, you would have to manually reselect the data range to include new rows.
When data is formatted as an Excel table, it automatically gets some formatting like shading and borders, plus filter and sort drop-downs in the headers. An additional ribbon called Table Design appears when you select a cell within the table. This contextual ribbon contains tools to format the table, apply options, and access table tools.
Preparing Data Before Creating a Pivot Table (Data Cleaning)
Before analyzing data with a pivot table, it is extremely important to clean the data. Data cleaning refers to processes in Excel used to tidy up datasets, make them consistent, format them correctly, and present the data in a way that a pivot table can easily analyze and produce accurate results. Skipping this step can lead to inaccurate analysis. This is particularly crucial if data is downloaded from a third party, external source, or database, as it may not import into Excel in the expected format. Issues like columns being out of place, strange formatting, blank rows, blank cells, or duplicate entries can occur.
Several techniques are discussed for cleaning data:
- Removing Blank Rows: Blank rows make data harder to read and cause issues in pivot tables, appearing as a ‘blank’ entry. Manually deleting them is tedious for large datasets. Excel provides a quicker way:
- Select the data range (e.g., using Ctrl+A while clicked in the data).
- Go to the Home tab, in the Editing group, click Find & Select, and choose Go To Special.
- Select ‘Blanks’ and click OK. This selects all blank cells/rows in the selection.
- Go back to the Home tab, in the Cells group, click Delete, and select Delete Sheet Rows. Removing blank rows before creating a pivot table ensures accuracy and prevents the ‘blank’ entry from appearing.
- Removing Duplicates: Duplicates can also cause problems for pivot tables. The desired removal depends on the type of duplicate; for instance, removing duplicate records where every column is identical, as opposed to repeated values in a single column like ‘Online’/’Offline’ in sales channel. Excel has a Remove Duplicates utility for this.
- Click anywhere in the data.
- Go to the Data tab, in the Data Tools group, click Remove Duplicates.
- A dialog box appears allowing you to select which columns to consider when checking for duplicates.
- Formatting Data: Applying the correct formatting is important.
- Columns with text (like Region, Country, Item Type) can be formatted as Text using the Format Cells dialog box (Ctrl+1).
- Dates might appear as numbers if date formatting isn’t applied. This is because Excel stores dates as numbers, counting days since January 1st, 1900. To display them correctly, select the column and apply Short Date or Long Date format from the Home tab’s Number group.
- Numeric columns (like Unit Price, Total Revenue, Total Profit) should have appropriate number formatting. Currency and Accounting formats are common for monetary values. Accounting format often aligns currency symbols to the left and decimal places, which many find easier to read than Currency format where the symbol is next to the value. This can be applied via the Home tab or the Format Cells dialog box (Ctrl+1).
- Tidying Up Text: Inconsistencies in text, such as different cases (uppercase, lowercase, proper case) or erroneous spaces (leading, trailing, or multiple spaces between words), can make analysis inaccurate.
- Changing Case: Use Excel text formulas like UPPER(), LOWER(), or PROPER(). A recommended method is to use a “helper column” next to the column needing changes, write the formula (e.g., =PROPER(B4)) in the first cell, copy it down, then copy the results and use Paste Special > Paste Values over the original column to remove the formulas, and finally delete the helper column.
- Removing Spaces: The TRIM() function removes leading, trailing, and excessive spaces within text. Even if spaces aren’t visible, applying TRIM() is a good practice. Similar to changing case, use a helper column, the TRIM() formula (e.g., =TRIM(B4)), copy/paste values, and delete the helper column.
- Removing Line Breaks: The CLEAN() function removes non-printable characters, including line breaks. Again, use a helper column, the CLEAN() formula (e.g., =CLEAN(A4)), copy/paste values, and delete the helper column.
- Splitting Data: Sometimes a single column contains multiple pieces of data that should be separate (e.g., Order Date and Order ID combined).
- Text to Columns: This feature is useful when data is separated by a consistent delimiter (like a comma, tab, space, or other character).
- Select the column(s) you want to split.
- Go to the Data tab, in the Data Tools group, click Text to Columns.
- In the wizard, choose ‘Delimited’ if your data has separators or ‘Fixed width’ if data is aligned in columns.
- Specify the delimiter(s). The preview shows how the data will be split.
- Choose the data format for each new column (optional, General often works) and importantly, the Destination cell where the split data should start appearing.
- Click Finish.
- Flash Fill: This feature, introduced in Excel 2013, automatically fills data based on a detected pattern. It can be used to split data (e.g., first name and last name from a full name) or combine data.
- Type the desired output for the first item in a new column next to your data.
- Press Ctrl+Enter to stay in the cell.
- Go to the Data tab, in the Data Tools group, click Flash Fill (or use the shortcut Ctrl+E). Excel will attempt to apply the pattern to the rest of the column. You can also start typing the second item, and Flash Fill may show a grayed-out preview; hit Enter if it’s correct.
- Using Formulas: Excel functions like CONCAT() (or CONCATENATE() in older versions) can combine data from multiple cells. These are useful if you need to add specific text or characters (like a hyphen and spaces) between the combined data. Formulas require referencing the cells and enclosing text within quote marks.
- Replacing Data: You might need to replace specific text or values.
- Find and Replace: This utility (Ctrl+H) can find specific text and replace it with something else throughout the selected range.
- Substitute Formula: The SUBSTITUTE() function can replace specific text within a cell based on a formula (e.g., =SUBSTITUTE(B4,”UK”,”United Kingdom”)). Like other formulas, you’d use a helper column and Paste Special > Paste Values to apply the result.
- Spell Check: Running a spell check is crucial because if something is misspelled, a pivot table will treat it as a completely separate item, leading to inaccurate analysis. The Spell Checker is on the Review tab in the Proofing group (F7 shortcut). It starts checking from the currently selected cell. You can choose to ignore, change, change all, or add words to the dictionary (useful for names or brands not in the standard dictionary).
Putting Data into an Excel Table
As mentioned, it is highly recommended to put your clean data into an Excel Table before creating a pivot table. You must be clicked somewhere within your data set to do this.
There are two main ways to format data as a table:
- Go to the Home tab, in the Styles group, click the Format as Table drop-down and choose a table style.
- Click anywhere in the data and press the keyboard shortcut Ctrl+T. This opens the Create Table dialog box.
Both methods will ask if your table has headers. Once applied, your data gets default formatting and the Table Design contextual ribbon appears. From the Table Design ribbon, you can customize the style, add a total row, toggle banded rows or columns, and turn the filter button on/off.
In the Properties group of the Table Design ribbon, you can see and rename the table. It’s good practice to give your table a meaningful name (like Sales_Data) instead of the default generic name (like Table1) because it makes referencing the data easier, especially in workbooks with multiple tables. Table names cannot contain spaces.
Creating a Pivot Table
Once your data is clean and in an Excel table, you are ready to create a pivot table.
- Recommended Pivot Tables: Excel can analyze your data and suggest pivot table layouts.
- Click anywhere in your data table.
- Go to the Insert tab, in the Tables group, click Recommended PivotTables.
- A window pops up showing different suggested pivot table summaries based on your data (e.g., sum of unit price by region, sum of profit by item type).
- Select the one that best suits your needs and click OK. Excel creates a new worksheet with the pre-built pivot table. You can still modify this table afterward.
- Creating a Blank Pivot Table from Scratch: This gives you full control over the layout.
- Click anywhere in your data table.
- Go to the Insert tab, in the Tables group, click PivotTable. Alternatively, from the Table Design ribbon, in the Tools group, click Summarize with PivotTable. Both methods open the Create PivotTable dialog box.
- Choose the data: The dialog box should automatically detect and select your Excel table (e.g., Sales_Data). You can also choose to use an external data source from another file or database.
- Choose where to place the report: The common and recommended practice is to place the pivot table on a New Worksheet to keep your raw data separate from your analysis. You can also choose an existing worksheet.
- Click OK. Excel creates a new worksheet containing a blank pivot table report area and the PivotTable Fields pane on the right.
Understanding the Pivot Table Interface
When you click inside the blank pivot table report area, two additional contextual ribbons appear: PivotTable Analyze and PivotTable Design. These ribbons contain commands for managing, organizing, and changing the look of your pivot table. They disappear when you click outside the pivot table.
- PivotTable Design Ribbon: Focuses on the appearance and layout.
- PivotTable Styles: Similar to table styles, allows choosing a visual style. Styles are influenced by the workbook’s theme.
- PivotTable Style Options: Toggles elements like row/column headers, banded rows/columns.
- Layout: Controls subtotals (show/hide, position), grand totals (on/off for rows/columns), and report layout (Compact, Outline, Tabular forms). You can also insert or remove blank lines after each item.
- PivotTable Analyze Ribbon: Contains functional options.
- PivotTable Name: It’s good practice to rename pivot tables from generic names (e.g., PivotTable1) to meaningful names.
- Options: Accesses various pivot table settings, including layout and format options like auto-fitting column widths.
- Group: Used for grouping selected items or ungrouping.
- Insert Slicer / Insert Timeline: Visual filters for pivot tables (not covered in detail in this source).
- Refresh: Updates the pivot table with any changes to the source data.
- Show group: Toggle buttons to show/hide the Field List pane, plus/minus buttons, and headers. If the Field List disappears, check this button.
The PivotTable Fields pane (usually on the right) is crucial for building the pivot table. At the top, it lists all the column headings from your source data as fields. Below are four areas: Filters, Columns, Rows, and Values. These areas determine the layout and type of analysis.
Building and Modifying a Pivot Table
Building a pivot table involves dragging fields from the top section of the PivotTable Fields pane into one of the four areas.
- Rows Area: Typically used for fields you want to appear as row labels (e.g., Region, Item Type).
- Columns Area: Typically used for fields you want to appear as column labels (e.g., Sales Channel, Order Priority).
- Values Area: This is where you put fields containing numerical data that you want to summarize (e.g., Total Profit, Units Sold). By default, Excel often performs a Sum on numeric fields dragged here, or a Count if the field contains text or dates.
- Filters Area: Fields dragged here create report-level filters at the top of the pivot table, allowing you to filter the entire report by selections from that field (e.g., filtering by specific Countries or Order Dates).
You can easily change the layout by dragging fields between these areas. Dragging a field outside the pane removes it from the pivot table.
- Aggregating Data: The default aggregation (Sum or Count) can be changed.
- Right-click on any value in the column you want to change the aggregation for.
- Select Value Field Settings.
- In the Summarize values by list, choose a different calculation like Average, Max, Min, Product, Count Numbers, etc..
- Click OK. You can also access Value Field Settings by clicking the drop-down arrow next to the field in the Values area.
- You can combine different methods of aggregation by dragging the same field into the Values area multiple times. Each instance can then be summarized using a different calculation (e.g., one column showing Sum of Total Profit, another showing Average of Total Profit).
- Renaming Fields/Headings: You can change the default headings in the pivot table report area (like ‘Row Labels’ or ‘Sum of Total Profit’) by double-clicking the cell and entering a new custom name. Note that renaming a heading in the pivot table report updates the name in the Values area of the fields pane, but the original field name above remains unchanged.
- Number Formatting: To ensure formatting (like currency symbols and decimal places) stays with the numbers when the pivot table layout changes, apply it via the pivot table’s specific options, not just standard cell formatting from the Home tab.
- Right-click on a number within the column you want to format.
- Select Number Format. Alternatively, access this via Value Field Settings > Number Format.
- Choose the desired format (e.g., Accounting, Currency) and settings.
- Click OK. This applies the formatting to all numbers in that value field.
- Handling Empty Cells: By default, pivot tables show blank cells where there is no data for a combination of criteria. This can affect charts or make the table harder to read. You can replace blanks with a value like 0:
- Click inside the pivot table.
- Go to the PivotTable Analyze ribbon, in the PivotTable group, click Options.
- On the Layout & Format tab, under the Format group, check the box for For empty cells show: and enter the value you want to display (e.g., 0).
- Click OK.
Grouping Data
Grouping allows you to combine items in your pivot table.
- Automatic Grouping: Excel automatically groups dates when you drag a date field into rows or columns. It analyzes the data and creates fields for years, quarters, and months if applicable. These automatically created fields (like ‘Years’ and ‘Quarters’) appear in the PivotTable Fields pane and can be used independently. You can expand/collapse these groups using the +/- buttons in the pivot table.
- Custom Grouping: You can create your own groups from non-date fields (e.g., grouping several Item Types into a ‘Food and Drink’ category).
- Select the items you want to group by holding down Ctrl and clicking each item.
- Go to the PivotTable Analyze ribbon, in the Group group, click Group Selection. Excel creates a new group (e.g., ‘Group1’) and a new field in the Rows/Columns area (e.g., ‘Item Type2’).
- You can rename the group label in the pivot table (using F2 or double-clicking and changing the custom name in Value Field Settings) and rename the new group field in the fields pane (using Field Settings).
- Ungrouping: To reverse automatic or custom grouping, select an item within the group and click Ungroup in the Group group on the PivotTable Analyze ribbon.
- Inserting Blank Lines: To improve readability, especially with grouping, you can insert blank rows between groups. Go to the Design ribbon, in the Layout group, click Blank Rows, and select Insert Blank Line after Each Item. To remove them, choose Remove Blank Line after Each Grouped Item.
Layout Options
You can customize the overall appearance and structure of your pivot table report. These options are found on the PivotTable Design ribbon, in the Layout group.
- Subtotals:You can choose not to show subtotals at all.
- You can show them at the bottom of each group (often preferred) or at the top of each group (the default).
- Grand Totals:You can turn grand totals off for both rows and columns.
- You can turn them on for both rows and columns, only for rows, or only for columns. Turning them off is common when creating charts to avoid including totals.
- Report Layout: This changes how the fields are displayed in the report area.
- Compact Form: Optimizes for readability and uses space efficiently. It places subtotals at the top of groups and keeps related fields in the same column. This is the most compact view.
- Outline Form: Moves the innermost row field to a new column, creating a hierarchical structure where each field is in its own column. Subtotals appear at the top by default, but you can change their position.
- Tabular Form: Similar to Outline form, but adds grid lines within the pivot table, making it look more like a regular Excel table.
- Repeat Item Labels: In Outline or Tabular forms, you can choose to repeat the labels for outer row fields on every line instead of only showing them once. This can make the table easier to read in some cases or is necessary for certain chart types like map charts. You can turn this off if desired.
These options allow you to tailor the pivot table’s appearance to best suit your analysis and presentation needs.
Cleaning Data for Excel Pivot Tables
Data cleaning is a crucial process to undertake before analyzing large datasets, particularly when planning to use tools like pivot tables in Excel. It involves tidying up data sets, making them consistent, formatting them correctly, and presenting the data in a way that allows for easy and accurate analysis. Skipping this step, especially when importing data from external sources or databases, can lead to inaccurate analysis because data doesn’t always import in the expected format, potentially including columns out of place, strange formatting, blank rows, or duplicate entries.
Here are some of the key data cleaning techniques discussed in the sources:
- Removing Blank Rows Blank rows make data harder to read and can cause issues in pivot tables by being picked up as a “blank” entry. Manually deleting them row by row is tedious for large datasets. A quicker method involves selecting the data range, using “Go To Special” to select “Blanks,” and then using the “Delete Sheet Rows” command. Removing blank rows ensures the pivot table is accurate.
- Removing Duplicate Entries Duplicate rows, particularly where every column’s information is exactly the same, can sometimes occur when importing data and can cause problems for pivot tables. Excel’s “Remove Duplicates” utility can easily find and remove these exact duplicates. You can specify which columns to check for duplicates, but typically, you check all columns to find completely duplicated rows.
- Removing Unwanted Formatting Imported data may contain inconsistent formatting like background shading, bold text, or italics, which results in an inconsistent-looking worksheet. This formatting often isn’t desired. The “Clear Formats” option, found under the “Clear” button in the Home tab’s editing group, can quickly remove all applied formatting, including background shading, bold, italics, and number formatting, providing a clean slate. Other “Clear” options exist for different purposes, such as clearing only contents, comments/notes, or hyperlinks.
- Applying Desired Formatting After clearing unwanted formatting, applying consistent and appropriate formatting is important to make your data easier to read. This is referred to as number formatting but can be applied to any column, not just those containing numbers. The “Number group” on the Home tab provides standard options like General, Number, Currency, Accounting, and Date. Dates in Excel are stored as numbers (days since January 1, 1900), so applying a Date format (like Short Date or Long Date) is necessary to display them correctly. For numeric data, you can control decimal places using dedicated buttons or the “Format Cells” dialog box (Ctrl + 1). For monetary values, Currency and Accounting formats add symbols; Accounting format is often preferred as it aligns currency symbols and decimal points, enhancing readability for lists of numbers.
- Tidying Up Text Using Formulas Inconsistencies in text, such as case variations (uppercase, lowercase, proper case) or erroneous spaces (leading, trailing, multiple spaces between words), can negatively impact analysis. Excel provides text functions to standardize these:
- UPPER(), LOWER(), and PROPER() functions are used to change the case of text.
- TRIM() removes leading/trailing spaces and extra spaces between words.
- CLEAN() removes non-printing characters, which might appear as small square boxes, and can also remove manual line breaks within cells. These functions are typically used in a “helper column” next to the original data. Multiple functions can be combined in a single formula in a helper column to perform several cleaning steps at once, saving time.
- Using Paste Special to Convert Formulas to Values When cleaning data using formulas in a helper column, the formulas refer to the original data column. If the original column is simply deleted, the helper column will result in #REF! errors because the references are broken. To avoid this, the cleaned data in the helper column must be converted from formulas to static values. This is achieved by copying the helper column and then using the “Paste Special” > “Paste Values” option to paste only the resulting values over the original column (or a new location), discarding the underlying formulas. Once the values are pasted, the helper column can be safely deleted.
- Splitting and Combining Data Sometimes data is combined in a single cell that needs to be separated (e.g., “Order Date Order ID”), or data in separate cells needs to be combined.
- “Text to Columns” is a wizard that splits a single column of text into multiple columns based on a specified delimiter (like a comma, space, or other character) or a fixed width.
- “Flash Fill” is a faster tool (available since Excel 2013) that can split or combine data by recognizing patterns based on one or two examples provided by the user. It can be accessed via a button on the Data tab or the Ctrl + E shortcut.
- The CONCAT() function (or CONCATENATE() in older versions) joins text from multiple cells. Custom text or delimiters can be included in the joined result by enclosing them in quote marks within the function.
- Finding and Replacing Data To standardize inconsistent text entries (e.g., replacing “Democratic Republic of the Congo” with “DRC” or “United States of America” with “USA”), you can use the “Find and Replace” dialog box (Ctrl + F, then select the Replace tab). You specify what to find and what to replace it with, choosing whether or not to match the case. The SUBSTITUTE() formula can also perform find and replace using a formula, requiring the “Paste Special” > “Paste Values” trick afterward.
- Running a Spell Check Spelling errors can cause problems in pivot tables because the table will treat variations of the same word as completely separate items. Running a spell check (Review tab > Proofing group, or F7) helps ensure consistency in text entries. You can choose the dictionary language and add correctly spelled but unrecognized words to the dictionary.
Once data is cleaned, it is highly recommended to put it into an Excel Table before creating a pivot table. Excel Tables offer several advantages, including automatic formatting, built-in filter and sort buttons, and importantly, auto-expand capabilities. This means that if new data is added to the table, it is automatically included in the data source for any associated pivot tables or charts, which can then be updated by simply clicking the refresh button. Data can be converted into an Excel Table using the “Format as Table” option on the Home tab or the Ctrl + T keyboard shortcut. Tables can be given meaningful names for easier identification.
In summary, thorough data cleaning is essential for accurate and effective analysis using pivot tables, addressing issues like inconsistencies, errors, and formatting problems through various Excel tools and functions.
Excel Data Analysis with Pivot Tables
Based on the sources, data analysis is the process of summarizing large amounts of data to make sense of them. In a data-driven world where information is collected from various sources, simply looking at a large spreadsheet might not highlight key metrics, issues, successes, failures, or trends. Data analysis aims to take this data and present it in a way that allows for clearer understanding and better business decisions.
Excel provides powerful tools for data analysis, particularly Pivot Tables.
Key aspects of Data Analysis discussed in the sources:
- The Role of Pivot Tables Pivot tables are described as an interactive and dynamic way to quickly summarize large amounts of data. Unlike static Excel tables where analysis is limited primarily to sorting and filtering, pivot tables allow you to pivot fields around and view data in all different ways. This dynamism makes it much more efficient to analyze data compared to manually using filters. Pivot tables help analyze large datasets in a clear and effective way. They facilitate asking questions about the data, such as finding top performers or seeing counts of high-priority orders. Pivot charts can be created from pivot table data to offer visual analysis options, as most people find it easier to analyze and interpret data visually. This can extend to creating interactive dashboards with filters for deeper analysis.
- The Critical Need for Data Cleaning Before Analysis A central theme is that data cleaning is essential prior to analyzing data with a pivot table. Skipping this step, especially when importing data from external sources or databases, can lead to inaccurate analysis. Data doesn’t always import in the desired format, and inconsistencies or errors can cause problems for pivot tables. Cleaning ensures the data is tidied up, consistent, correctly formatted, and presented in a way that allows the pivot table to easily analyze it and produce accurate results. The sources highlight cleaning steps like removing blank rows, removing duplicate entries, clearing unwanted formatting, applying desired formatting, tidying text using formulas (case, spaces), splitting and combining data, finding and replacing data, and running a spell check. All these steps contribute to a “clean looking data set ready for analysis”.
- Structuring Analysis with Pivot Table Fields To perform analysis with a pivot table, you use the Pivot Table Fields pane, which lists the column headings from your source data. These fields are dragged into four areas: Filters, Columns, Rows, and Values. These areas determine the layout of the pivot table and control the type of analysis being done. Placing fields in different areas changes how the data is summarized and viewed.
- Aggregating Data for Analysis The Values area is typically where numeric fields are placed. By default, Excel usually performs a sum calculation for numeric values and a count for text or date fields dropped into this area. However, you can change how the data is summarized using the Value Field Settings. This allows you to choose from various aggregation methods, including Sum, Count, Average, Max, Min, Product, and more. You can even combine different aggregation methods (like sum and average) for the same data by dragging the field into the Values area multiple times and setting a different calculation for each instance. This ability to calculate averages, mins, or maxes “on the fly” expands the analysis beyond what was present in the raw source data.
- Grouping Data for Deeper Analysis Grouping data is another way to analyze it. Excel automatically groups certain fields, like dates, into categories like years, quarters, and months. This allows you to see the data summarized at different levels (e.g., total profit by year, then by month within each year). You can also create your own custom groups for non-date fields to categorize data according to your analysis needs (e.g., grouping different item types into “food and drink” or “other”). Grouping allows for analyzing data in “multiple dimensions” by adding more fields to the Rows or Columns areas.
- Handling Empty Cells and Layout How empty cells are displayed affects the accuracy of analysis, especially in pivot charts. Replacing blank cells with zeros in the Pivot Table Options ensures that items with no data are still represented, showing a zero value rather than being excluded from the analysis or charts. Additionally, the report layout options (compact, outline, tabular) and the choice to display or hide subtotals and grand totals affect the readability and presentation of the analyzed results.
In summary, data analysis in Excel, as presented in the sources, relies heavily on the dynamic capabilities of Pivot Tables, which allow for summarizing, slicing, dicing, and aggregating data in various ways. However, the foundation of accurate analysis is thorough data cleaning, ensuring the data is reliable and free from inconsistencies before being used in a pivot table. Using Excel Tables is also recommended as it makes managing and updating the data source for analysis more efficient.
Grouping Data in Excel Pivot Tables
Based on the sources, grouping data in Excel pivot tables is a way to summarize data by multiple fields and organize the display of that data. It allows you to analyze information at different levels or categorize data according to specific needs.
Here are key aspects of grouping data discussed in the sources:
- Automatic Grouping Excel will automatically apply grouping when you summarize data by more than one field in areas like the Rows or Columns of a pivot table.
- Date Grouping A common example of automatic grouping occurs when you drag a date field into an area like Rows. Excel looks at your source data and automatically groups the dates by categories such as years, quarters, and months. These levels appear as separate fields (e.g., “Years,” “Quarters,” “Order Date”) in the Pivot Table Fields pane. You can then use these fields independently to summarize data at different granularities, for instance, viewing total profit by year, and then expanding to see the breakdown by month within each year. If you don’t need a specific level, like quarters, you can simply remove that field from the Rows area. The “Group Field” option on the Pivot Table Analyze ribbon shows the date ranges and the levels (months, quarters, years) that Excel has pulled from the data.
- Custom Grouping You can create your own custom groups for fields that are not dates. This allows you to categorize data based on your analytical requirements. For example, you could select several ‘item type’ categories like ‘baby food’, ‘beverages’, ‘cereal’, ‘fruits’, ‘meat’, ‘snacks’, and ‘vegetables’ and group them together under a new name like “Food and Drink”. The remaining items could be grouped under “Other”.
- Creating Custom Groups To create a custom group, you select the specific items in the pivot table report that you want to include in the group. Then, you go to the Pivot Table Analyze ribbon and select the Group Selection button. Excel will create a new group (initially named generically, like “Group1”). You can rename this group directly in the pivot table report. Excel also creates a new field in the Pivot Table Fields pane corresponding to this custom group (e.g., “Item Type2” if you grouped based on ‘Item Type’). It is recommended to rename this new field as well (e.g., “Food and Drink”) for consistency. This can be done by clicking the drop-down arrow for the field in the Rows area and selecting “Field Settings,” or by right-clicking the field name in the Rows area and selecting “Field Settings”.
- Expanding and Collapsing Groups When grouping is applied, items in the pivot table report often display with little plus and minus symbols next to them. These symbols allow you to collapse or expand the details within a group, letting you focus on summary levels or drill down into specifics. You can toggle the display of these buttons on or off from the Pivot Table Analyze ribbon in the Show group.
- Multi-Dimensional Analysis Grouping contributes significantly to creating multi-dimensional pivot tables. By adding more fields and grouping them in the Rows or Columns areas, you can analyze your data by multiple factors simultaneously (e.g., analyzing profit by region, item type, and sales channel).
- Ungrouping Data If you need to revert a group, you can select an item within the group in the pivot table and click the Ungroup button on the Pivot Table Analyze ribbon.
- Grouping and Layout The report layout options can interact with grouping. For example, the Compact Form layout maintains the grouping structure. Adding blank rows using the “Blank Rows” option on the Design ribbon will insert a blank line after each grouped item, which can help emphasize groups and improve readability.
Excel Number Formatting Explained
Based on the sources and our conversation, number formatting is a crucial aspect of data cleaning and analysis in Excel, particularly to improve readability and consistency of your data. It involves ensuring that values in your cells are displayed in a way that accurately reflects their type and makes them easy to interpret.
Here’s a breakdown of the key points about number formatting discussed:
- Purpose of Number Formatting:
- To make your data a lot easier to read.
- To ensure consistency in how numbers are displayed, such as the number of decimal places and the presence of currency symbols.
- A currency symbol, for example, always makes monetary values a lot easier to read.
- Applying Formatting in Standard Worksheets:
- Formatting is applied using the Home tab in the Number group.
- A drop-down menu provides common formatting options (e.g., General, Number, Currency, Accounting, Short Date, Long Date).
- You can access more detailed formatting options by clicking “More Number Formats” at the bottom of the drop-down or by using the Ctrl+1 keyboard shortcut to open the “Format Cells” dialog box.
- The appropriate format depends on the type of information in the column.
- Examples discussed include:
- Applying Text formatting to columns containing text.
- Applying Date formatting to columns containing dates. Excel stores dates as numbers (days since January 1, 1900), and date formatting is needed to display them as calendar dates. If not formatted as a date, you might see the underlying numeric value. “Short date” and “long date” are common options. Custom date formats are also available via “More number formats” but are considered advanced.
- Applying Number formatting to columns like “Units Sold,” where you might need to control the number of decimal places (e.g., reducing to zero using the Increase/Decrease Decimal buttons or “Format Cells”).
- Applying Currency or Accounting formatting to monetary columns like “Unit Price,” “Total Revenue,” or “Total Profit” to add a currency symbol and control decimal places. The key difference is that Accounting format aligns the currency symbols and decimal points in a column, which is often considered easier to read, especially in long lists of numbers, whereas Currency format places the symbol right next to the value and doesn’t align decimals. The sources suggest Accounting format is frequently used.
- Formatting and Data Cleaning Steps:
- When initially cleaning data, steps like using “Clear Formats” can remove all formatting, including desirable number formatting. Therefore, you might need to reapply the correct formatting after this step.
- Helper columns created for text cleaning formulas (like UPPER, TRIM, CLEAN, SUBSTITUTE) might inherit the formatting of surrounding columns, sometimes defaulting to “Text”. To see formula results correctly, these columns might need to be changed back to “General” format before applying the formula.
- Identifying numbers stored as text is important. Indicators include the number being aligned to the left side of the cell and a little green triangle in the corner. You can convert these using the warning symbol option “Convert to Number” or by using the VALUE formula.
- Number Formatting in Pivot Tables:
- When you build a pivot table, the numbers in the values area are initially unformatted and inconsistent.
- It is NOT recommended to apply number formatting directly to the cells in a pivot table using the Home ribbon. This is because pivot tables are dynamic; the fields and their locations can change when you rearrange or “pivot” the data. Formatting applied to a static cell will not move with the number it was applied to if the layout changes.
- The correct method for applying number formatting in a pivot table is to apply it to the number itself, which ensures it moves with the data regardless of the layout.
- This is done by right-clicking on a number within the pivot table and selecting “Number Format”.
- Alternatively, you can access this through the Value Field Settings for the specific field in the Values area, and then clicking the “Number Format” button at the bottom.
- Both methods open the familiar “Format Cells” dialog box, allowing you to choose formats like Accounting or Currency.
- Custom number formatting is also available through this pivot table method.
- If you configure your pivot table to show zero for empty cells, these zeros will also display with the number formatting applied to that values field (e.g., showing “$ -“).
In essence, applying consistent and appropriate number formatting is a vital step, first during general data cleaning and preparation, and then specifically within pivot tables using the recommended methods to maintain accuracy and readability as you analyze your data.

By Amjad Izhar
Contact: amjad.izhar@gmail.com
https://amjadizhar.blog
Affiliate Disclosure: This blog may contain affiliate links, which means I may earn a small commission if you click on the link and make a purchase. This comes at no additional cost to you. I only recommend products or services that I believe will add value to my readers. Your support helps keep this blog running and allows me to continue providing you with quality content. Thank you for your support!
