Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
sweetnet
 
Posts: n/a
Default Help me, compare 2 sheet and extract the match data into the new sheet.


Hai,

Im not a good excel user and i have a problem here, please any one.

i got sheet1 with 2 columns like this:

code | item
100 | book2
222 | paper1
101 | book1
333 | pen1

then i got sheet2 with 2 columns like this:

code | item
100 | book2
102 | book3
101 | book1

so i want to extract all possible item and code from sheet1 that match
the code in sheet2. I need to extract the match code and item into new
sheet3.

So for example after we extract the above data i will get sheet3 just
like this:

code | item
100 | book2
101 | book1

Can anyone please help me in this matter? any suggestion with VBA
programming or anything is accepted.

Please.

Thanks.


--
sweetnet
------------------------------------------------------------------------
sweetnet's Profile: http://www.excelforum.com/member.php...o&userid=31809
View this thread: http://www.excelforum.com/showthread...hreadid=515318

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dsuperc
 
Posts: n/a
Default Help me, compare 2 sheet and extract the match data into the new s

Try this code
The Following VBA procedure should do the trick for you.

Objective: Compare Values in Old Sheet With New Sheet. When differences are
found record the Number ... and what sheet it is and isn't on ... in a sheet
called "Differences".

NOTE :
1) You must make sure you have the 3 sheets name properly
2) Start Code by calling "FindSheetDiff"



Public Sub FindSheetDiff()
Call FindAndRecDiff("Old", "New")
Call FindAndRecDiff("New", "Old")
End Sub


Private Sub FindAndRecDiff(SourceSh, TargetSh)
With ThisWorkbook.Sheets(SourceSh)
For Each C In .Columns("A:A").SpecialCells(xlCellTypeConstants, 3)
With ThisWorkbook.Sheets(TargetSh).Range("A:A")
If .Find(C.Value, LookIn:=xlValues) Is Nothing Then

With ThisWorkbook.Sheets("Difference")
NxRw = .Cells(65536, 1).End(xlUp).Row + 1
..Cells(NxRw, 1).Value = C.Value
..Cells(NxRw, 2).Value = "In " & SourceSh & " But not in " & TargetSh
End With

End If
End With
Next C
End With
End Sub

"sweetnet" wrote:


Hai,

Im not a good excel user and i have a problem here, please any one.

i got sheet1 with 2 columns like this:

code | item
100 | book2
222 | paper1
101 | book1
333 | pen1

then i got sheet2 with 2 columns like this:

code | item
100 | book2
102 | book3
101 | book1

so i want to extract all possible item and code from sheet1 that match
the code in sheet2. I need to extract the match code and item into new
sheet3.

So for example after we extract the above data i will get sheet3 just
like this:

code | item
100 | book2
101 | book1

Can anyone please help me in this matter? any suggestion with VBA
programming or anything is accepted.

Please.

Thanks.


--
sweetnet
------------------------------------------------------------------------
sweetnet's Profile: http://www.excelforum.com/member.php...o&userid=31809
View this thread: http://www.excelforum.com/showthread...hreadid=515318


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
How to extract data from a wooksheet in a closed workbook kuansheng Excel Worksheet Functions 2 February 15th 06 03:46 AM
Compare 2 Sheets and Extract Unique Info to a 3rd Sheet kilo1990 Excel Discussion (Misc queries) 7 December 19th 05 10:36 PM
Extract data from one Worksheet to another extract data fr. one worksheet to anothe Excel Worksheet Functions 1 August 15th 05 07:11 PM
formula to extract specific data if match occurs jerry Excel Worksheet Functions 2 February 24th 05 11:06 AM
Automatic cell increment with data from sheet 1 to sheet 2 Big G Excel Worksheet Functions 2 December 20th 04 05:59 PM


All times are GMT +1. The time now is 08:46 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"