Copy and Paste and Loop - Consolidate 2 worksheets

ShuStar

Board Regular
Joined
Sep 9, 2015
Messages
89
Office Version
  1. 2010
Platform
  1. Windows
Hi all,

Effectively merging two sheets onto a new sheet where ID is the common identifier between them.

I am trying to create a macro which will copy a row from Tab 1 and paste it into Consolidated Tab, then go into Tab2 and find the rows that match the ID and paste the respective columns into Consolidated Tab.

It should be a loop and do this for all the Rows in Tab 1 . If it can’t find a match to copy over from Tab 2, it should just say “No Match to Raw Data” or "No Match" or something of that sort.

So three sheets being used in total:
*Tab 1 – Raw Data2 where ID is the key
*Tab 2 – Matrix sheet where ID matches to Raw Data2
*Consolidated sheet - where end output should be (ie the consolidation of data from RawData and Matrix)



Example:

In Tab 1 (Raw Data2 sheet) Start from A3 – take this and the respective columns and paste into Consolidated Sheet. ie ID 12345
1597342853792.png





Then find all the IDs 12345 in Tab 2 (Matrix sheet) and copy these over to Consolidated sheet
1597342872552.png



Consolidated Sheet should now look like below (left purple side is from Raw Data and right side is from Matrix):
1597342901805.png




End Output: Now do the same for all the remaining rows IDs in Tab 1 (Raw Data 2 sheet), where final output should look something like:
1597342953408.png




Note: no colour coding or formatting is needed in the macro, I just did this to try make easier to highlight what it is that I am trying to achieve.

A copy of the workbook can be found here Mapping Filter Doc

Would be ever so grateful for anyones support here. Thank you Gurus.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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