简体   繁体   中英

How can I compare two sets of data having two columns in excel? Picture below will elaborate

Below are two sets of data. Each has two columns. I want that that the similar data comes in front of each other.

截屏

This is a manual solution with formulas and sorting.

Imagine the following data in columns A to E:

在此处输入图片说明

Enter the following formulas into columns G to K

  • Column G: =IFERROR(IF(VLOOKUP(D:D,A:B,2,FALSE)=E:E,1,2),3)
  • Column H: =IF(G:G<3,D:D,"")
  • Column I: =IFERROR(VLOOKUP(H:H,A:B,2,FALSE),"")
  • Column J: =D:D
  • Column K: =IFERROR(VLOOKUP(J:J,D:E,2,FALSE),"")

The column G sort by now shows:

  • 1 if part and quantity matched
  • 2 if only part matched
  • 3 if nothing matched

So if you now select data from A3:K10 and sort by column G (sort by) then it will result in this:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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