ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compare worksheets to copy and paste data based on matching criter (https://www.excelbanter.com/excel-programming/419491-compare-worksheets-copy-paste-data-based-matching-criter.html)

Monomeeth

Compare worksheets to copy and paste data based on matching criter
 
Okay, what I have is one workbook with two worksheets.

The first worksheet has data in the following columns:

A B C D
AGS NAME DATE User ID

The second worksheet has data in the following columns:

A B C D E F G
User ID Name Level Team ESS SAP Start

What I need is a macro to compare the two worksheets to identify the rows in
the second worksheet that contain a User ID which also exists in the first
worksheet. When a match is found, I want the macro to copy the data which is
in Column A and Column C of worksheet 1 into the corresponding rows in
worksheet 2 in Columns H and I.

Any help would be greatly appreciated!

Thanks,

Joe.
--
If you can measure it, you can improve it!

Sheeloo[_3_]

Compare worksheets to copy and paste data based on matching criter
 
You can use VLLOKUP for this..
Move or Copy the UserId column as the first Col in Sheet 1
Then enter this in H1 of Sheet 2
=Vlookup(A1,Sheet2!A:D,2,False)
and this in I1 of Sheet 2
=Vlookup(A1,Sheet2!A:D,3,False)
Copy both down to the end...

For those Ids which are not there in Sheet 1 you will get #N/A which you can
suppress by
=ISNA(Vlookup(A1,Sheet2!A:D,2,False),"",Vlookup(A1 ,Sheet2!A:D,2,False))
and
=ISNA(=Vlookup(A1,Sheet2!A:D,3,False),"",=Vlookup( A1,Sheet2!A:D,3,False))

"Monomeeth" wrote:

Okay, what I have is one workbook with two worksheets.

The first worksheet has data in the following columns:

A B C D
AGS NAME DATE User ID

The second worksheet has data in the following columns:

A B C D E F G
User ID Name Level Team ESS SAP Start

What I need is a macro to compare the two worksheets to identify the rows in
the second worksheet that contain a User ID which also exists in the first
worksheet. When a match is found, I want the macro to copy the data which is
in Column A and Column C of worksheet 1 into the corresponding rows in
worksheet 2 in Columns H and I.

Any help would be greatly appreciated!

Thanks,

Joe.
--
If you can measure it, you can improve it!



All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com