Forum

Need a macro to com...
 
Notifications
Clear all

Need a macro to compare two sheet data

5 Posts
3 Users
0 Reactions
73 Views
(@kismad)
Posts: 2
New Member
Topic starter
 

Hi,

I'm new to VBA. I've attached the document here. I need a macro to compare the sheet 2 Item number data's with sheet 1 to find the duplicates.

After finding the duplicate it has to calculate the total count in the Duplicate count cell as a Order.

Waiting for Positive response.

Thanks in advance

Regards,
Kishore

 
Posted : 24/08/2019 3:02 am
(@catalinb)
Posts: 1937
Member Admin
 

item Number 1 has a value of 2 in the Duplicate Count column, but that number can be found only once in Sheet2, can you clarify?

Is the vba solution really necessary? A simple formula will return that answer more easily:

=SUMPRODUCT((Sheet2!A:A=A2)*1)

 
Posted : 25/08/2019 11:49 pm
(@david_ng)
Posts: 310
Reputable Member
 

Or using countif formula,  simple way out 

 

=COUNTIF(Sheet2!$A$2:$A$19,A2)

=COUNTIF(Sheet2!$A$2:$A$19,A3)
=COUNTIF(Sheet2!$A$2:$A$19,A4)
=COUNTIF(Sheet2!$A$2:$A$19,A5)
=COUNTIF(Sheet2!$A$2:$A$19,A6)
=COUNTIF(Sheet2!$A$2:$A$19,A7)
=COUNTIF(Sheet2!$A$2:$A$19,A8)
=COUNTIF(Sheet2!$A$2:$A$19,A9)
=COUNTIF(Sheet2!$A$2:$A$19,A10)
=COUNTIF(Sheet2!$A$2:$A$19,A11)
 
Posted : 26/08/2019 10:01 pm
(@kismad)
Posts: 2
New Member
Topic starter
 

Thanks for the response folks.

By using the formula how can I count the total duplicates ?

It will help me to find only duplicates in 0 and 1. I need to rank it finally which as score more duplicates.

Is there any way we can do it in VB?

Helps are really appreciate  

 
Posted : 28/08/2019 2:04 am
(@david_ng)
Posts: 310
Reputable Member
 

Pls refer attach if can help.

 
Posted : 29/08/2019 11:33 pm
Share: