EXCEL, how to compare data differences in two tables (using pivot table)

Table of contents

1 Question: Need to compare the content differences of the following two tables

1.1 Raw data and problems

1.2 Summary in advance

2 Using the EXCEL formula method

2.1 New auxiliary column: auxiliary index

2.2 Specific formula + use with conditional formatting

3 PivotTable Method

3.1 New auxiliary column: auxiliary index 

3.2 You need to open the PivotTable Wizard first

3.3 Basic steps of pivot table comparison

3.3.1 Using the PivotTable Wizard

3.3.2 Must: Customize the page fields, in fact, define the names of two regional tables, otherwise the regional table names will default to "item 1, item 2" and it is not easy to modify

  3.3.3 Select two areas respectively

 3.3.4 Output to a new worksheet or select a cell in the sheet as the upper left corner area

3.3.5 Generated basic pivot table

3.3.5 Transformation of the generated basic pivot table

3.3.6 It is meaningless to cancel the classification and summary data

 3.3.7 The effect of the final pivot table comparison

​edit

 3.3.8 If you want to add the difference, the final effect


1 Question: Need to compare the content differences of the following two tables

1.1 Raw data and problems

  • Table 1: Temporary Designation A or AA
  • Table 1: Temporary Designation B or BB
  • These two tables have the same basic content, and the column names are almost the same, but new columns may be added
  • Row objects are basically the same thing
  • so it is possible to compare

 

1.2 Summary in advance

  • Method 1: Write a formula to judge
  • Method 2: Compare with pivot table

2 Using the EXCEL formula method

2.1 New auxiliary column: auxiliary index

  • B3&C3
  • Because some data may have multiple indexes, here is an example of 2, and more
  • Adding auxiliary columns can simply combine multiple indexes into a unique index identification column

2.2 Specific formula + use with conditional formatting

  • =IF(ISNA(VLOOKUP($D3,B!$C:$Z,MATCH(E$2,B!$1:$1,0)-2,FALSE)), "There is no such data in table B",IF(ISNA (VLOOKUP($D3,A!$C:$Z,MATCH(E$2,A!$1:$1,0)-2,FALSE)), "There is no such data in table A",IF(VLOOKUP($D3, B!$C:$Z,MATCH(E$2,B!$1:$1,0)-2,FALSE)=VLOOKUP($D3,A!$C:$Z,MATCH(E$2,A!$1:$1 ,0)-2,FALSE), "same", "different")))
  • In order to determine whether there is data corresponding to this column attribute in table B ISNA(VLOOKUP($D3,B!$C:$Z,MATCH(E$2,B!$1:$1,0)-2,FALSE)), "B There is no such data in the table"
  • In order to determine whether there is data corresponding to this column attribute in table A IF(ISNA(VLOOKUP($D3,A!$C:$Z,MATCH(E$2,A!$1:$1,0)-2,FALSE)), "There is no such data in table A"
  • Compare the values ​​of this column attribute in the previous two tables VLOOKUP($D3,B!$C:$Z,MATCH(E$2,B!$1:$1,0)-2,FALSE)=VLOOKUP($D3, A!$C:$Z,MATCH(E$2,A!$1:$1,0)-2,FALSE), "same", "different"
  • With conditional formatting, it will be more obvious

3 PivotTable Method

  • Pivot tables are generally used for summarization, but they can also be used for comparison

3.1 New auxiliary column: auxiliary index 

  • Also need to be an auxiliary index column

3.2 You need to open the PivotTable Wizard first

  • Because multiple tables are involved, you need to open the PivotTable Wizard from the file--options first

3.3 Basic steps of pivot table comparison

3.3.1 Using the PivotTable Wizard

  • Use the PivotTable Wizard because multiple ranges of data need to be considered
  • You can also not use the pivot table wizard, but then you need to manually merge two tables into one table, which is cumbersome and not intuitive. I choose a pivot table with multiple data areas

3.3.2 Must: Customize the page fields, in fact, define the names of two regional tables, otherwise the regional table names will default to "item 1, item 2" and it is not easy to modify

  3.3.3 Select two areas respectively

  • add area 1
  • Set the number of fields to 1 (no need to set multiple fields!)
  • Set the name of field 1
  • Add area 2 --- If you can't select it, remember to select it from the up arrow ⬆
  • Set the number of fields to 2
  • Set the name of field 2

 3.3.4 Output to a new worksheet or select a cell in the sheet as the upper left corner area

 

3.3.5 Generated basic pivot table

  • OK,
  • List,
  • value, data
  • Page: That is, the area of ​​​​different data tables, which can be table names or other

3.3.5 Transformation of the generated basic pivot table

  • First move the page into the row, and finally
  • Move the pages into columns first, and finally

3.3.6 It is meaningless to cancel the classification and summary data

 3.3.7 The effect of the final pivot table comparison

 3.3.8 If you want to add the difference, the final effect

  • set difference
  • You need to select first, the page name—that is, the position of the table name, and then select the calculation item to set
  • Modify the field name: difference'
  • Modify the formula: BB-AA

 

 

 

Guess you like

Origin blog.csdn.net/xuemanqianshan/article/details/131959707