excel 宏 数据透视表

If you want to create a pivot table from data on different worksheets, you can use a Multiple Consolidation Ranges pivot table. However, that creates a pivot table with limited features and functionality. Last year, Excel MVP Kirill Lapin (aka KL) shared his brilliant code to create a Union query and build a fully functional pivot table from data on different worksheets.

如果要根据不同工作表上的数据创建数据透视表,则可以使用“ 多个合并范围”数据透视表 。 但是,这将创建具有有限特征和功能的数据透视表。 去年,Excel MVP Kirill Lapin(又名KL)分享了他出色的代码,以创建Union查询并根据不同工作表上的数据构建功能全面的数据透视表 。

Now, Kirill is back to share two more pivot table macros, and I'm sure you'll be impressed by both of them. In today's example, he's written a macro to create a pivot table from multiple Excel files.

现在,Kirill又回来分享了另外两个数据透视表宏,我敢肯定,这两个宏都会给您留下深刻的印象。 在今天的示例中,他编写了一个宏,以从多个Excel文件创建数据透视表。

This is based on a solution that Kirill posted in one of Russian-speaking Excel forums for generating a standard pivot table from multiple workbooks (as opposed to worksheets in the same workbook).

这是基于Kirill在讲俄语的Excel论坛之一中发布的一种解决方案的,该解决方案用于从多个工作簿(而不是同一工作簿中的工作表)生成标准数据透视表。

报告工作簿 (The Report Workbook)

The main file is named Report.xls, and it contains Kirill's pivot table code, and a button that runs the macro. When you open the file, enable the macros, then click the Create Pivot button.

主文件名为Report.xls,它包含Kirill的数据透视表代码和运行该宏的按钮。 当您打开文件时,启用宏,然后单击“创建数据透视”按钮。

数据文件 (The Data Files)

When you run Kirill's macro, it prompts you to select one or more data files, all stored in the same folder. In this example, the files for Alberta, Ontrio and Yukon are selected.

运行Kirill的宏时,它会提示您选择一个或多个数据文件,所有文件都存储在同一文件夹中。 在此示例中,选择了Alberta,Ontrio和Yukon的文件。

All of the data files must have the same structure, and the macro works with the data stored on Sheet1 in each file. In the screen shot below you can see Sheet1 in the Alberta and Ontario files, which have identical column headings.

所有数据文件都必须具有相同的结构,并且该宏可以处理每个文件中存储在Sheet1中的数据。 在下面的屏幕快照中,您可以在Alberta和Ontario文件中看到Sheet1,它们具有相同的列标题。

数据透视表 (The Pivot Table)

After you select the files and click Open, the macro creates a pivot table based on the data from Sheet1 in each of the selected files. Because the pivot table is based on a Union query, and not built from Multiple Consolidation Ranges, it's a fully functioning pivot table, and you can pivot, group and filter the data, as usual.

选择文件并单击“打开”后,宏将基于每个选定文件中Sheet1的数据创建数据透视表。 由于数据透视表基于联合查询,而不是根据多个合并范围构建的,因此它是功能齐全的数据透视表,您可以照常对数据进行数据透视,分组和过滤。

You can also refresh the pivot table, to show the latest data in the source files, as long as those files stay in their original location.

您还可以刷新数据透视表,以在源文件中显示最新数据,只要这些文件停留在其原始位置即可。

联合查询 (The Union Query)

Kirill's macro creates a Union query to combine the data from all the selected files. If you open Microsoft Query, you can see the SQL string for the Union query, and all the data from the selected workbooks.

Kirill的宏创建了一个联合查询,以合并所有选定文件中的数据。 如果您打开Microsoft Query,则可以看到Union查询SQL字符串以及所选工作簿中的所有数据。

下载样本文件 (Download the Sample File)

To see Kirill's pivot table code, you can download the Pivot Workbooks example. The zipped folder that contains the Report.xls file, and the five sample data files. Unzip the folder, and keep all the files in the same folder. When you open the Report.xls file, enable macros to run the code.

要查看Kirill的数据透视表代码,可以下载Pivot Workbooks示例 。 包含Report.xls文件和五个示例数据文件的压缩文件夹。 解压缩该文件夹,并将所有文件保留在同一文件夹中。 当您打开Report.xls文件时,启用宏以运行代码。

数据透视表宏#2 (Pivot Table Macro #2)

Come back on Wednesday to see Kirill's second pivot table macro. It's another creative twist on creating a pivot table from data in different workbooks. ______________

周三返回,查看Kirill的第二个数据透视表宏。 这是根据不同工作簿中的数据创建数据透视表的另一种创造性的转折。 ______________

翻译自: https://contexturesblog.com/archives/2010/08/30/macro-creates-excel-pivot-table-from-multiple-files/

excel 宏 数据透视表


http://www.taodudu.cc/news/show-5682064.html

相关文章:

  • excel数据透视_取消透视Excel数据的快速方法
  • C#使用NPOI实现Excel数据透视
  • 简单实现POI操作Excel生成数据透视图
  • 比较Excel数据透视图中的年度数据
  • 80行python代码查询你想要的英雄信息
  • pyecharts制图笔记
  • 手机必备epub阅读软件
  • 2016.03.20
  • 酷狗音乐html5韩国,韩国SHOFAR MUSIC独家入驻酷狗 脸红的思春期掀收听热
  • 年底了是时候学新技术了「GitHub 热点速览 v.21.52」
  • 你的电脑适合升级 Win11 吗?「GitHub 热点速览 v.21.26」
  • 《暗黑破坏神2》重置版 采访记录(一)
  • 远程文件拷贝(fastcopy为例)
  • 一个复制也能玩出花来
  • 鼠标灵敏度怎么调?Mac系统调整鼠标灵敏度教程
  • C#修改系统的鼠标移动速度
  • win7玩游戏时不能全屏该怎么解决
  • openni.utils.InitializationError: OpenNI2 could not be loaded:
  • java使用bytebuddy动态生成带泛型的DTO
  • 编码解码与文件操作
  • TGY_Windows 8.1 x64 企业版(集成Office2013)
  • 理解volatile关键字
  • 酷狗小试页面和简写代码
  • 由酷狗官网界面改造成的焦点新闻插件
  • 仿酷狗官网新闻焦点图插件
  • 一个90后做游戏的女生自白
  • 十年前的java游戏_十年前那些你玩过的手机游戏,现在都去哪儿了?
  • 最新游戏上线(女生版)
  • java打飞机小游戏(跟着网上视频写到)
  • 创意低俗?摸腿游戏

excel 宏 数据透视表_宏从多个文件创建Excel数据透视表相关推荐

  1. 数据统计 测试方法_统计测试:了解如何为数据选择最佳测试!

    数据统计 测试方法 This post is not meant for seasoned statisticians. This is geared towards data scientists ...

  2. 深度学习数据集中数据差异大_使用差异隐私来利用大数据并保留隐私

    深度学习数据集中数据差异大 The modern world runs on "big data," the massive data sets used by governmen ...

  3. 从一张表里选择一列加入到另一张表_【附中奖名单】| Excel妙招,数据透视表也能轻松做好排序!...

    在进入本篇干货分享之前,先公示最近留言评论的获奖名单. 获奖名单及奖品公示 2019年9月27日,本公众号发布了<精进Excel I 基础表设计的基本原则>,根据文章里的活动说明,我们对留 ...

  4. 根据excel列动态创建mysql表_根据数据库字段动态生成excel模版下载,上传模版获取数据存入数据库(poi 反射)...

    环境:mysql5.7.28 java8 Spring boot 2.2.4 mybatis-plus3.10 动态:根据需求,用户可以选择对应的字段生成excle模版 下载 poi 反射:poi是e ...

  5. python比较excel表格内容并提取_利用python提取多张excel表数据并汇总到同一张新表中...

    接上篇文章<如何用python实现excel中的vlookup功能?>,上篇说到,最近我在做一个小项目,也是用python操作excel解决财务审计工作上的一些问题,以便提高工作效率及其准 ...

  6. excel mysql 参数查询语句_如何用SQL语句查询Excel数据?

    如何用SQL语句查询Excel数据? Q:如何用SQL语句查询Excel数据? A:下列语句可在SQL SERVER中查询Excel工作表中的数据. 2007和2010版本: SELECT*FROMO ...

  7. activeform表单中的旧数据怎么显示_三分钟为你细数 Vue el-form 表单校验的坑点

    背景 Vue 的 el-form 提供了表单校验功能,通过 :rules 属性设置校验规则,并通过 el-form-item 的 prop 属性绑定校验规则.通过封装,让前端校验更方便.具体使用过程中 ...

  8. excel表格锁定怎么解锁_让用户锁定或解锁Excel工作簿

    excel表格锁定怎么解锁 Some people like an Excel workbook that's locked down, so they can't accidentally mess ...

  9. excel乘法公式怎么输入_这4个变态的Excel函数公式,却好用的很!初级会计100%用的上!...

    免费赠书 2020年第3天,院长给大家准备了这套Excel财务书籍,包括财务单据和统计表.制作会计账务表单.会计记账.员工工资管理.月末账务处理.会计报表.财务分析......附赠8小时视频课程+90 ...

最新文章

  1. remoting和webservice的区别
  2. Spark SQL 源代码分析系列
  3. UVA11624大火蔓延的迷宫
  4. 转 linux常用查看硬件设备信息命令
  5. 经典C语言程序100例之八三
  6. 再看Kafka Lag
  7. opencv rect画旋转矩形_在opencv c中绘制旋转的矩形
  8. 剩余 大小 查看内存_JVM的内存分配策略以及进入分代的条件
  9. Hive(一)——基础操作
  10. 面试中常见智力题汇总
  11. mac终端命令大全介绍
  12. 数论 day 2 试题解析
  13. 百度收购YY:第三次直播大战开启
  14. python免费自学爬虫_看这里!免费python网络爬虫一站通
  15. kinect java_Kinect for Java
  16. A Framework for Multi-stage Bonus Allocation in meal delivery Platform
  17. 登链钱包(一款功能强大的以太坊钱包)完全开源
  18. 计算机房的网络化管理,学校计算机房的设计与管理
  19. win10备份为wim_泰哥一键备份还原下载-泰哥ghostv1.0.1.14 官方版
  20. Android的语言设置(一)

热门文章

  1. 电视机顶盒web开发总结,避免踩坑。
  2. vins中imu融合_小觅智能 | VINS 学习笔记(持续更新中)
  3. 最美手机开售 魅族魅蓝X曜石黑1699元
  4. Excel表格中的通配符,有你意想不到的功能。
  5. 这个清明,我的爱情也随之而去
  6. JS数组删除指定下标元素 JS删除对象指定元素
  7. java 泛型的接口_Java 泛型接口
  8. 1000瓶毒药里面只有1瓶是有毒的,毒发时间为24个小时,问需要最少需要多少只老鼠才能在24小时后试出那瓶有毒。
  9. 机器学习各种模型评价指标:准确率(Precision)、召回率(Recall)、F值(F-Measure)、ROC曲线、PR曲线
  10. DPDK 交叉编译基本流程