简体   繁体   English

通过数据透视表将多个电子表格中的数据共同映射

[英]Comapring data from several spreadsheets via pivot tables

I am working on simplifying a daily task and I wanted to pick up your brain. 我正在努力简化日常工作,我想振作起来。 I have three different data sources (two from my company and the third from the costumer) with products, dates, category and volume. 我有三个不同的数据源(两个来自我的公司,第三个来自客户),其中包含产品,日期,类别和数量。 So far I have converted what I could and left out irrelevant data and combined two of the data into one pivot table (internal data) and the other one in a separate pivot table (external data download). 到目前为止,我已经进行了尽可能的转换,并删除了无关的数据,并将其中的两个数据合并到一个数据透视表(内部数据)中,将另一个数据合并到单独的数据透视表中(外部数据下载)。 My task is to compare the data and make sure that the internal data is exactly the same as external and if there is a difference investigate and change. 我的任务是比较数据,并确保内部数据与外部数据完全相同,如果有差异,请进行调查和更改。 I have been comparing the two pivot tables manually with a ruler. 我一直在用尺子手动比较两个数据透视表。 The data changes daily and sometimes it is a long task. 数据每天都在变化,有时这是一个漫长的任务。 From reading up on the forum I found ways to compare values with formulas but I have values as well as text and dates and don't know how to incorporate it all. 通过在论坛上阅读,我发现了将值与公式进行比较的方法,但是我拥有值以及文本和日期,并且不知道如何将其全部合并。 Any thoughts will be really appreciated? 有什么想法会很感激吗?

I'm assuming that you have some identifier to tell that this product and that are the same since you're using pivot table. 我假设您有一些标识符可以告诉您该产品,并且由于您使用数据透视表而相同。

Something you can use will be vlookup . 您可以使用的东西将是vlookup

The syntax is =vlookup(lookup_value, range, column_index, false) 语法为=vlookup(lookup_value, range, column_index, false)

Insert the number of columns for each item you will compare in a sheet where you have the internal data. 将要比较的每个项目的列数插入具有内部数据的工作表中。 If you're comparing dates, category and volume, this makes 6 columns you'll add and you can name them 'ext date , ext cat and ext vol`. 如果要比较日期,类别和数量,将添加6列,并将其命名为“ ext date , ext cat and ext vol”。

Sheet to make comparison (let's called it Comparison ): 进行比较的工作表(我们称之为Comparison ):

    A        B        C        D        E        F        G        H        I        J
 +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
1|Product |Int date|Int Cat |Int Vol |Ext date|Ext Cat |Ext Vol |Dif date|Dif Cat |Dif Vol |
 +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
2|Item1   |01/01/12|Cat1    |23      |vlookup1|vlookup2|        |        |        |        |
 |        |        |        |        |        |        |        |        |        |        |

Sheet where the external data is found (let's called it External ): 在其中找到外部数据的工作表(我们称其为External ):

    A        B        C        D      
 +--------+--------+--------+--------+
1|Product |Ext date|Ext Cat |Ext Vol |
 +--------+--------+--------+--------+
2|Item1   |01/01/12|Cat1    |23      |
 |        |        |        |        |

In the cell E2 of the sheet Comparison , you'll put: 在表格Comparison的单元格E2中,您将:

=vlookup(A2, External!A:B, 2, false)

And the result will be 01/01/2012 结果将是01/01/2012

What the code does is looks for Item1 in column A of External and returns the value in the second column (that's the purpose of the 2 in the formula) in the row it found Item1 . 代码要做的是在“ External A列中查找Item1 ,并在找到Item1的行中返回第二列中的值(这是公式中2的目的)。 You can specify any range ( A:B in this formula) as long as the first column contains the value you're looking for, and the value you want to return in one of the columns included in the range. 您可以指定任何范围(此公式中的A:B ),只要第一列包含您要查找的值以及要包含在范围中的一列中的返回值即可。 For instance, you could have written =vlookup(A2, External!A:D, 2, false) and it would return the same value since the index 2 is within that range, it won't work with =vlookup(A2, External!A:D, 5, false) since D is the 4th column, if that makes sense? 例如,您可能编写了=vlookup(A2, External!A:D, 2, false)并且由于索引2在该范围内,它将返回相同的值,它将无法与=vlookup(A2, External!A:D, 5, false)因为D是第4列,是否有意义?

In the cell F2 of the sheet Comparison , you'll put: 在表格Comparison的单元格F2中,您将:

=vlookup(A2, External!A:C, 3, false)

And in cell G2 在单元格G2

=vlookup(A2, External!A:D, 4, false)

false in the formula means exact match. 公式中的false表示完全匹配。 You can also use 0 instead; 您也可以使用0代替; it's the same thing. 这是同一件事。

Then you can put =B2=E2 in the cell H2 to get the comparison between the dates, or any other formula you are already using which might be more suitable. 然后,可以将=B2=E2放在单元格H2以获取日期之间的比较,或者您已经使用的任何其他公式可能更合适。

I hope it helps! 希望对您有所帮助! :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM