search
HomeTopicsexcelExcel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

This article will give you a summary of pivot table data refresh, and introduce three methods of dynamically refreshing data: VBA automatically refreshes pivot tables, super tables, and existing connections. There is always one of these refresh methods that suits you, and the operation is super simple. You can complete dynamic refresh with just a few clicks of a button. Remember to bookmark it!

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Pivot table is a commonly used skill in EXCEL, which can help us quickly statistically analyze large amounts of data. And as the layout changes, the pivot table will immediately recalculate the data according to the new arrangement, which is very practical in daily work. However, if the data source is added, the PivotTable cannot be updated synchronously. So today I will introduce to you several ways to dynamically refresh data in Excel pivot tables.

As shown in the figure, this data source lists sales in different cities.

excel vb刷新透视表

1. Basic refresh of pivot table

1. Select any cell in the table area and click under the Insert tab "Pivot table".

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

2. In the "Create Pivot Table" window, all contiguous areas are automatically selected in the table area. In order to facilitate viewing, put the Pivot Table location in the same work under the table. Click OK.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

#3. Now put "City" into the row label and "Sales" into the value range. For the convenience of comparison, subsequent creation is done in the same way.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Complete as follows:

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

4. Next, add the following data in the last row of the table. At this time, the total value is: The original 255418 became 258418.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

5. Select the Pivot Table, and the Pivot Table tool will appear above the menu bar. Click under the "Analysis" tab "refresh".

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

But the pivot table has not changed.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

#6. This situation is because the new row is not added to the data source area of ​​the pivot table, so the data source needs to be modified. Select the PivotTable and click "Change Data Source" under the "Analysis" tab below the PivotTable tool.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Then re-select the area in the table area of ​​the "Change PivotTable Data Source" window and select the new rows. The area is changed to "Sheet1!$A$1:$D$71".

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Just click refresh again.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Through this example, we found that if the data increases, the pivot table needs to change the data source to update, but in actual work, if Due to frequent data changes, is there any way to quickly refresh the Excel pivot table?

2. Excel pivot table dynamically refreshes data

1) VBA automatically refreshes the pivot table

1. Select the job Columns A to D of the table data, add a pivot table and put it in the same worksheet.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing DataThe settings are completed as follows:

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data2. Click Insert under the "Development Tools" tab, in the ActiveX control Command button, creates a button on the worksheet.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

If the form does not have the Development Tools tab, click File-Options, in the "Customize Ribbon" on the left side of the "EXCEL Options" window, select "Main Tab" Development Tools" is added to the custom ribbon on the right.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

#3. Right-click the button you just added in the worksheet and select "View Code". Enter the following code in the VBA window that pops up.

Private Sub
CommandButton1_Click()
ActiveSheet.PivotTables("数据透视表9").PivotCache.Refresh
End Sub

PivotTable 9 in the code is the name of the PivotTable.

4. Then click "Design Mode" on the Development Tools tab to cancel the design mode of the button. The button can be clicked normally.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

5. Add a row of data at the end of the worksheet data source as follows. After adding, the total value is 258418

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

6 .Then click the button to refresh, and the pivot table will be updated in real time.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Summary: This method includes other blank areas when selecting the data source, and it can be dynamically updated if data is added later. And adding a button through VBA makes the refresh operation more convenient. However, the problem is that once invalid data appears in other selected areas, the PivotTable will also include it.

2) Existing connections refresh the PivotTable

1. Click "Existing Connections" under the Data tab. Click "Browse More" in the pop-up window.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

2. Find the workbook in the "Select Data Source" window and click to open

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

In the "Select Table" window, find the worksheet where the data is placed and click "OK".

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

3. In the "Import Data" window, select the data to display in a pivot table. In order to facilitate viewing the effect, place it here on the existing worksheet. .

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Complete as follows:

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

4. Also add data in the last row as follows. After adding, the total value becomes 258418

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

5. Select the PivotTable, click the "Analysis" tab under the PivotTable tool, and click "Refresh". The pivot table will automatically refresh the data.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Summary: This method turns the EXCEL worksheet into a connection and inserts the pivot table through the connection. The advantage is that changes in the worksheet can be updated in time, but again, when we choose this method, the worksheet cannot put other data, and the pivot table should be built on other worksheets as much as possible to avoid errors.

3) Super table implements Excel pivot table refresh

1. Select any cell in the worksheet area, hold down Ctrl T, the table data in the following window The source will automatically select the worksheet area. The first row of the table here is the title, so check "Table contains title".

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

#2. Insert a pivot table based on this super table. Select any cell in the table range and insert a PivotTable report in the same worksheet. The table area will be set to the name of the supertable: Table 5.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

# Also put "City" in the row label and "Sales" in the value area. Complete as follows:

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

3. Add the following data in the last row of the table. After adding, the total value is 258418

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

4. Select the pivot table and click "Analyze" under the pivot table tool. ” tab and click “Refresh”. This achieves dynamic updating.

Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data

Super table is a function added since Excel2007. It solves the problem that the first two methods cannot intelligently select the data source area. Super table can automatically increase or decrease the data source area, which is its biggest advantage as a dynamic data source.

The methods have been introduced. Each of the above three methods has its own advantages and disadvantages. I hope you can choose flexibly according to the actual needs of your work. If you think it’s good, give me a like!

Related learning recommendations: excel tutorial

The above is the detailed content of Excel Pivot Table Learning: Three Methods of Dynamically Refreshing Data. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:部落窝教育. If there is any infringement, please contact admin@php.cn delete
MEDIAN formula in Excel - practical examplesMEDIAN formula in Excel - practical examplesApr 11, 2025 pm 12:08 PM

This tutorial explains how to calculate the median of numerical data in Excel using the MEDIAN function. The median, a key measure of central tendency, identifies the middle value in a dataset, offering a more robust representation of central tenden

Google Spreadsheet COUNTIF function with formula examplesGoogle Spreadsheet COUNTIF function with formula examplesApr 11, 2025 pm 12:03 PM

Master Google Sheets COUNTIF: A Comprehensive Guide This guide explores the versatile COUNTIF function in Google Sheets, demonstrating its applications beyond simple cell counting. We'll cover various scenarios, from exact and partial matches to han

Excel shared workbook: How to share Excel file for multiple usersExcel shared workbook: How to share Excel file for multiple usersApr 11, 2025 am 11:58 AM

This tutorial provides a comprehensive guide to sharing Excel workbooks, covering various methods, access control, and conflict resolution. Modern Excel versions (2010, 2013, 2016, and later) simplify collaborative editing, eliminating the need to m

How to convert Excel to JPG - save .xls or .xlsx as image fileHow to convert Excel to JPG - save .xls or .xlsx as image fileApr 11, 2025 am 11:31 AM

This tutorial explores various methods for converting .xls files to .jpg images, encompassing both built-in Windows tools and free online converters. Need to create a presentation, share spreadsheet data securely, or design a document? Converting yo

Excel names and named ranges: how to define and use in formulasExcel names and named ranges: how to define and use in formulasApr 11, 2025 am 11:13 AM

This tutorial clarifies the function of Excel names and demonstrates how to define names for cells, ranges, constants, or formulas. It also covers editing, filtering, and deleting defined names. Excel names, while incredibly useful, are often overlo

Standard deviation Excel: functions and formula examplesStandard deviation Excel: functions and formula examplesApr 11, 2025 am 11:01 AM

This tutorial clarifies the distinction between standard deviation and standard error of the mean, guiding you on the optimal Excel functions for standard deviation calculations. In descriptive statistics, the mean and standard deviation are intrinsi

Square root in Excel: SQRT function and other waysSquare root in Excel: SQRT function and other waysApr 11, 2025 am 10:34 AM

This Excel tutorial demonstrates how to calculate square roots and nth roots. Finding the square root is a common mathematical operation, and Excel offers several methods. Methods for Calculating Square Roots in Excel: Using the SQRT Function: The

Google Sheets basics: Learn how to work with Google SpreadsheetsGoogle Sheets basics: Learn how to work with Google SpreadsheetsApr 11, 2025 am 10:23 AM

Unlock the Power of Google Sheets: A Beginner's Guide This tutorial introduces the fundamentals of Google Sheets, a powerful and versatile alternative to MS Excel. Learn how to effortlessly manage spreadsheets, leverage key features, and collaborate

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment