Comparing Two Data Sets

jones273

New Member
Joined
Nov 10, 2014
Messages
1
Hi all!

I am working with two different data tables. Data Set A has 2 columns and Data Set B has 4 columns. The 2 columns in Data Set A are the same information as the first 2 columns in Data Set B. I am looking for some guidance as to how create a macro that finds exact matches between A & B. More specifically, if BOTH columns of a row (A1 & B1) in Data Set A are found in Data Set B, I want a new table created with all four cells from the matching row in Data Set B.

EX.

Below is a line from both columns of Data Set A (A1 & A2) and all four columns from what would be considered a match in Data Set B.


[TABLE="width: 128"]
<tbody>[TR]
[TD="width: 64, align: right"][/TD]
[TD="width: 64"][TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"]A1[/TD]
[TD="align: center"]A2[/TD]
[TD="align: center"][/TD]
[TD="align: center"]B1[/TD]
[TD="align: center"]B2[/TD]
[TD="align: center"]B3[/TD]
[TD="align: center"]B4[/TD]
[/TR]
[TR]
[TD="align: center"]767[/TD]
[TD="align: center"]MSY[/TD]
[TD="align: center"][/TD]
[TD="align: center"]767[/TD]
[TD="align: center"]MSY[/TD]
[TD="align: center"]1-11-2014[/TD]
[TD="align: center"]1-12-2014[/TD]
[/TR]
</tbody>[/TABLE]

[/TD]
[/TR]
</tbody>[/TABLE]

Thanks for your help and let me know if you need more information!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Create a third column of Data in Data set A it will use this formula ...fill it down
=CONCATENATE(A1,B1)

Add this formula to the fifth column in Data set B.........fill it down

=IF(ISNA(VLOOKUP(CONCATENATE(A1,B1),Sheet2!C:C,1,0)),"","X")
Change the "Sheet2" to the name of Data set A

Then filter Data Set B by Column 5 for all "X"

Copy-paste-special to a new work book to create your new dataset.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top