Open In App

How to Remove Old Row and Column Items from the Pivot Table in Excel?

Last Updated: 21 Mar, 2022

G

Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

Pivot table is one of the most efficient tools in excel for data analysis. If you are using pivot tables frequently, then you will find even after deleting the old data from the data source, it remains in the filter drop-down of the pivot table. We will learn, how to remove the old row and column items from the pivot table in excel. 

Reason for not removal of the old data

To better understand, why the data is not removed in the pivot table, even after removing it from the source data, you need to understand the architecture of the pivot table. Internally, the pivot tables have a pivot cache, where the copy of the source data is held. This is done to faster the data retrieving process from the source to the pivot table.

Whenever you refresh the pivot table, it gets updated from the pivot cache and not the source data. So, the pivot cache has its properties and default behavior. One of the default behavior, of pivot cache, is that it does not delete the old rows or columns from the filter drop-down. It is a default setting which can be changed very easily. 

Removing Old rows and columns from the Pivot table 

Given a table students and their marks. A pivot table is also made from the given table. It represents the students and their total marks obtained. 

Marks-of-the-students

Step 1: Deleting the sixth row from the given table i.e. the student name Shubham

Deleting-the-sixth-row-from-the-given-table

Step 2: The Student named Shubham got deleted from the table and the total rows remaining are eight. You can also see that the Shubham is not deleted from the pivot table. This specifies that the pivot table is not updated instantaneously.

Shubham-got-deleted-from-the-table

Step 3: To update the pivot table, right-click inside any cell of the pivot table. For example, right-click inside cell C6, cell value Arushi. A drop-down appears. Click on the refresh button.

Right-click-to-get-inside-pivot-table

Step 4: The student named Shubham got removed from the pivot table. Hence, the table is updated. Now, we have resolved one problem. 

Shubham-got-removed-from-the-pivot-table

Step 5: Click on the filter button, in the pivot table of cell G5. A drop-down appears. You can see, even after refreshing the pivot table, the student named Shubham still appears in the drop-down filter menu. This is not correct. 

Click-on-the-filter-button

Step 6: To resolve this problem, right-click inside any cell of the pivot table. For example, right-click inside cell C6, cell value Arushi. Click on the PivotTable Options

Clic-on-the-PivotTable-Options

Step 7: PivotTable Options dialogue box appears. 

PivotTable-Options-dialogue-box-appears

Step 8: Go to the Data tab. Under, Retain items deleted from the data source section, go to Number of items to retain per field.

Go-to-Number-of-items-to-retain-per-field

Step 9: Click on the drop-down and select None. Click Ok.   

Select-None-and-click-Ok

Step 10: Right-click inside any cell of the pivot table. For example, right-click inside cell C6, cell value Arushi. A drop-down appears. Click on the refresh button.

Right-click-inside-any-cell-of-the-pivot-table

Step 11: Click on the filter button, in the pivot table of cell G5. A drop-down appears. The Student named Shubham is removed from the filter drop-down. Hence, the problem is resolved. 

Click-on-the-filter-button

Removing Old rows and Columns in Pivot table using VBA Macro

You can do the same thing with VBA Macro. Write the following code in the VBA code editor and run it. It will change the Number of items to retain per field from Automatic to None. In the below example, there are two for loops. The outer loops state the condition to traverse all the worksheets in the entire workbook. The inner loop states to traverse to all the pivot tables in a worksheet. The statement pivottables.PivotCache.MissingItemsLimit = xlMissingItemsNone changes the Number of items to retain per field from Automatic to None

Removing-Old-rows-and-Columns-in-Pivot-table-using-VBA-Macro

Run the above code written. Consider the same data set, as seen in the first method. Check whether the  Number of items to retain per field is set to None or not. Following are the steps: 

Step 1: Right-click inside any cell of the pivot table. For example, right-click inside cell C6, cell value Arushi. A drop-down appears. Click on the refresh button.

Right-click-inside-any-cell-of-the-pivot-table

Step 2: PivotTable Options dialogue box appears.  Go to the Data tab. Under, Retain items deleted from the data source section, go to Number of items to retain per field. We can see it is set to None

PivotTable-Options-dialogue-box-appears



G

News
Improve
Discuss
Do you want to advertise with us?Click here to know more

How to Create Pivot Chart from Pivot Table in Excel using Java?

A Pivot Chart is used to analyze data of a table with very little effort (and no formulas) and it gives you the big picture of your raw data. It allows you to analyze data using various types of graphs and layouts. It is considered to be the best chart during a business presentation that involves huge data. To add a pivot chart to an Excel worksheet, you need to use the "WorksheetChartsCollection.add" method.  Before Creating a Pivot Chart, one first needs to go through how to Create Pivot Table in Excel using Java. Now let's discuss the steps to create a pivot chart in an Excel file in Java using Free Spire.XLS for Java API. How to Create a Pivot Table in Excel using JavaStep 1: Load the Excel fileWorkbook workbook = new Workbook() String workbookName = "Geeks_For_Geeks.xlsx"; workbook.loadFromFile(workbookName); Step 2: Get the first worksheetWorksheet sheet = workbook.getWorksheets().get(0); Step 3: Get the first pivot table in the worksheetIPivotTable pivotTable = sheet.getPivotTables().get(0); Step 4: Add a clustered column chart based on the pivot table to the second worksheetChart chart = workbook.getWorksheets().get(1).getCharts().add(ExcelChartType.ColumnClustered, pivotTa
Read More

I

How to Remove Pivot Table But Keep Data in Excel?

In this article, we will look into how to remove the Pivot Table but want to keep the data intact in Excel. To do so follow the below steps: Step 1: Select the Pivot table. To select the table, go to Analyze tabSelect the menu and choose the Entire Pivot Table. Step 2: Now copy the entire Pivot table data by Ctrl+C. Step 3: Select a cell in the worksheet where you want to paste the data. Step 4: Click Ctrl+V, to paste the data. Step 5: Click on the Ctrl dropdown. Choose the value(v) option from Paste options. Step 6: Now, again select the entire Pivot table. Step 7: Delete it using the Delete key on the keyboard. Step 8: Or you can also choose the Clear All command from the Home tab => Editing section => Clear dropdown. You will find your pivot table will be completely deleted from the worksheet. Thus, we can delete the pivot table without losing pivot table data.
Read More

I

How to Group and Ungroup Pivot Chart Data Items in Excel?

A pivot chart is the visual representation of a pivot table in Excel. Pivot charts and pivot tables are connected with each other. Pivot chart are much more flexible than normal chart because Pivot Chart is linked to a PivotTable. Filters, sorts, and data rearrangements applied to Pivot Table are reflected on the chart. Steps to create Pivot chart : Follow the below steps to create a Pivot chart: Select the table to create the pivot chart.Inside Insert tab, click Pivot chart.A dialog box will appear, select the table and the cell where you want the table and chart.Both Pivot chart and Table will be created, but no field is selected.Select the fields, you want in the chart.Chart will be formed.To Group data in the Chart: Follow the below steps to group data in the Chart: Select the rows or columns from the table, you want to group.Right-click and press group.The data will be grouped and the chart will show those rows together along with the Group name.To Ungroup data in the Chart : Follow the below steps to ungroup data in the chart: Select the group name.Right-click and press Ungroup.The data items in both the table and chart will be ungrouped.
Read More

How to Add and Use an Excel Pivot Table Calculated Field?

article_img
Excel pivot tables are one of its most helpful features. They are utilized to summarize or aggregate large quantities of data. The data can be summarized using the average, the count, or other statistical approaches. It summarizes a large amount of data into a few rows and columns. They make it simple to explore the data from various views and angles and are excellent for data exploration. When you create a Pivot table, you often need to add more data and calculations to your analysis. If you require a new data point that can be obtained by leveraging existing data points in the Pivot Table, you don't need to go back and add it to the source data. Instead, you can utilize a Pivot Table Calculated Field to accomplish this. Pivot Table Calculated Field The "Pivot Table calculated field" option allows you to insert more data or calculations in the pivot table. For our reports, we frequently need to include our own unique calculations that can relate to other fields in the data collection. Benefits of using a Pivot Table Calculated FieldIt is scalable since it will automatically account for any new data added to your Pivot Table. You can utilize a Calculate Field in your Pivot Table ju
Read More

How to Troubleshoot and Fix Excel Pivot Table Errors?

article_img
Power Pivot is an Excel add-in, a data modeling technology that helps the user to create data models, establish relationships, and create calculations. However, it is possible to encounter a few errors during the process. here in this article, we will discuss some of the Excel Pivot Table Errors that may occur and how we can fix them. Usually, Excel Pivot works smoothly and efficiently, however, it is inevitable to encounter some errors while working with the software. Here are some of the common errors that users might encounter during working with Excel PowerPivot. "Unable to load the Data Model" Error Sometimes, A simple data change, for example, adding the pivot table data to the Data Model may cause a pivot table refresh error. It’s not that common, however, sometimes users do face such issues. As we can see in the image below: Here, in the image, as we can see above the message is showing that the “PowerPivot is unable to load the Data Model”. Solution: The change from the UPPER case to the PROPER case or other similar changes in the source data headings may be the primary cause of this error resulting in the data model having a second instance of the field. As shown in t
Read More

C

Table and Chart Combinations in Excel Power Pivot

For data exploration, visualization, and reporting, Power Pivot offers a variety of Power PivotTable and Power PivotChart combinations. A Power PivotChart is a PivotChart that was made using the Power Pivot window and is based on the Data Model. Despite sharing certain functionality with Excel PivotChart, it offers additional features that give it greater strength. You will discover how to build the Table and Chart combinations from the Power Pivot window in this article. Creating a Pivot Chart and Table in Excel Step 1: Let's take a dataset as an example in order to understand the Pivot chart and table. This is the major dataset that will be used in this case. Step 2: Select the data. Navigate to the insert tab on the top of the ribbon then in the charts group select Pivot Chart and then PivotChart & Pivot Table. Step 3: Create a PivotTable dialog box appear. Here select a table or range and a select new worksheet and then click OK. Step 4: Now as you can see pivot table is created and the PivotTable Fields pane appears. Step 5: Now in the PivotTable Fields pane drag the month's field to the Axis area and the Sales field to the values area. Step 6: Now as you can see after sel
Read More

How to Create Pivot Table in Excel using Java?

A pivot table is needed to quickly analyze data of a table with very little effort (and no formulas) and sometimes not everyone has time to look at the data in the table and see what’s going on and use it to build good-looking reports for large data sets in an Excel worksheet. Let's discuss a step-by-step proper explanation to create a pivot table in an Excel file in Java using Free Spire.XLS for Java API. Requirements to Create Pivot Table in Excel using JavaFirstly, we need to add necessary dependencies to the Maven project including the Free Spire.XLS project before starting to write the code. How to Install Spire.XLS for JavaBy adding the following code to your project's pom.xml file, you can quickly import the JAR file into your program if you use Maven. XML <repositories> <repository> <id>com.e-iceblue</id> <name>e-iceblue</name> <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url> </repository> </repositories> <dependencies> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency> <dep
Read More

How to Flatten Data in Excel Pivot Table?

article_img
Flattening a pivot table in Excel can make data analysis and extraction much easier. In order to make the format more usable, it's possible to "flatten" the pivot table in Excel. To do this, click anyplace on the turn table to actuate the PivotTable Tools menu. Click Design, then Report Layout, and then, at that point, Show in Tabular Form. This will isolate the line names and make it simpler to investigate information.What Does Flattening Mean in Excel?Flattening a pivot table in Excel refers to transforming the data from a pivot table format, which can be complex and hierarchical, into a simple tabular format. This process separates row labels and creates a structure that is easier to work with for further analysis or export to data warehouses.Flatten is a table function that takes a VARIANT, OBJECT, or ARRAY column and produces a lateral view (for example an inline view that contains a relationship alluding to different tables that go before it in the FROM clause). FLATTEN can convert semi-structured data to a relational representation.Benefits of Flattening Data in ExcelImproved Data Analysis: Flattened data is easier to analyze, as all relevant information is available in a ta
Read More

C

How to Hide Zero Values in Pivot Table in Excel?

article_img
One of Microsoft Excel's most important features is the pivot table. You might be aware of this if you have worked with it. It provides us with a thorough view and insight into the dataset. You can do a lot with it. The pivot table might include zero values. In this lesson, you will learn how to hide zero values in the pivot table using relevant examples and visuals. Hide the rows in a pivot table that have zero values. After concealing the zero-value rows, your pivot table will seem neater and the data will be suppressed. How to Hide Zero Values in Pivot Table in Excel? ImplementationLet's take a dataset as an example to understand How to Hide Zero Values in a Pivot Table in Excel. This is the dataset that we are going to use in this scenario. The Excel table has some zero values, as you can see. First, you must transform an excel table into a pivot table. You may need to hide them at times to have a clear view of the pivot table. Methods for Hiding Zero-ValuesThere are three different methods for hiding zero values in an Excel pivot table. Table of Content How to Create a Filter Field to Hide Rows with Zero ValuesHow to Hide Pivot Table Zero Values Using Excel's Format Cells Comm
Read More

Pivot Table Slicers in Excel

article_img
Slicers are the visual representation of filters. By using a slicer, we can filter our data in the pivot table by just clicking on the type of data we want. Slicers are found in the Analyze tab of the pivot table tools. We have an option called Insert Slicer and on clicking it, we have to select the column on the basis of which we need to filter our data. What are Pivot Table Slicers?Pivot Table Slicers are Visual controls that help users filter data in a Pivot Table or Pivot Chart. They act as a user interface element. Slicers are useful when you have multiple fields(columns) in the pivot table and want to control the data displayed by selecting specific criteria. How to Insert a Pivot Table Slicer Follow the below steps to insert a Pivot table slicer: Step 1: Create a Pivot tableSelect the data you want to analyze and then create a Pivot table. Step 2: Design the Pivot TableDesign the Pivot table by dragging the relevant fields to the "Rows", "Columns", "Values", or "Filters" area of the PivotTable Fields pane. Step 3: Insert a SlicerWhen your Pivot Table is ready, go to the "Pivot Table Analyze" or "Options" tab in the Excel ribbon. Click on "Insert Slicer", and a dialog box wil
Read More
three90RightbarBannerImg