PC Review


Reply
Thread Tools Rate Thread

Compare worksheets to copy and paste data based on matching criter

 
 
Monomeeth
Guest
Posts: n/a
 
      4th Nov 2008
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 With Quote
 
 
 
 
Sheeloo
Guest
Posts: n/a
 
      4th Nov 2008
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,2,False)
and this in I1 of Sheet 2
=Vlookup(A1,Sheet2!A,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,2,False),"",Vlookup(A1,Sheet2!A,2,False))
and
=ISNA(=Vlookup(A1,Sheet2!A,3,False),"",=Vlookup(A1,Sheet2!A,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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
fill several sheets with data from other workbooks matching criter leveleyed Microsoft Excel Programming 0 25th Mar 2010 02:14 AM
compare data from different worksheets and return matching results spmu Microsoft Excel Misc 1 11th Jul 2009 06:11 AM
Compare 2 sheets and copy matching data Sarah Microsoft Excel Programming 3 18th Jul 2007 04:47 PM
How do I compare data in two worksheets to find matching cells? =?Utf-8?B?R2FyeQ==?= Microsoft Excel Misc 4 2nd Mar 2006 09:04 PM
Compare Worksheets and Copy/Paste Data Tom Bock Microsoft Excel Worksheet Functions 4 11th Mar 2004 11:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 PM.