Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,805
Default 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!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
compare data from different worksheets and return matching results spmu Excel Discussion (Misc queries) 1 July 11th 09 06:11 AM
Split data from 1 workbook into multiple workbooks based on criter bUncE Excel Worksheet Functions 0 October 29th 07 03:26 PM
Compare 2 sheets and copy matching data Sarah[_5_] Excel Programming 3 July 18th 07 04:47 PM
Formula Help - Copy data from one sheet to another based on criter aaghd Excel Worksheet Functions 5 December 27th 06 10:39 PM
How do I compare data in two worksheets to find matching cells? Gary Excel Discussion (Misc queries) 4 March 2nd 06 09:04 PM


All times are GMT +1. The time now is 03:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"