Need help in coming up with a formula or VBA macro to find the duplicate records based on multiple conditions and highlight the duplicate records foun

bhandarx

New Member
Joined
Jul 8, 2014
Messages
15
Hi,

I am trying to come up with a formula or an excel VBA macro to identify the duplicate records present in an excel sheet based on multiple criterion and highlight the duplicate records found. I am using Excel 2010. Here is the sample data which I have and criterion to consider 2 records to be duplicates.

LogicAll of the conditions below must be met for it to be a duplicate.
ColumnConditionComments
NameSame
VerticalSame
CustomerSame or blankIf one record is blank and the other has a value they are not duplicates, If both are same or both are blank it is a duplicate.
commentsSame or blankIf one record is blank and the other has a value they are not duplicates, If both are same or both are blank it is a duplicate.
Additive FlagNOverlapping records must have N for additive flag. If one is N and the other is Y is it NOT a duplicate.
ID NumberDifferentID numbers of 2 matching records must be different to mark them as duplicates
SubjectsSame or PartialWould be duplicate if one is Maths and one is Maths/English
Start DateOverlapIf there is ANY overlap in the time periods of the records it is a duplicate (e.g. If the start date or end date overlaps it's a duplicate
End DateOverlapIf there is ANY overlap in the time periods of the records it is a duplicate

<tbody>
</tbody>

Can this be achieved in a single formula or it needs to be done as part of multiple steps in VBA macro? Please help


NAMEVERTICALID NUMBERSUBJECTSCOMMENTSCUSTOMERAdditive FlagStart DateEnd DateIs DuplicateRemarks
JohnVert195547MathsN11/1/20131/31/2014YDuplicates as all the conditions mentioned above are met.
TomVert295553EnglishN11/1/201310/31/2014NNot duplicate as the dates are not overlapping
JohnVert195535Maths\English\HistoryN12/1/20131/15/2014YDuplicates as all the conditions mentioned above are met.
DaveVert392249ChemistryN8/1/201310/31/2013NNot Duplicate
TomVert292250EnglishN11/1/201411/21/2014NNot duplicate as the dates are not overlapping

<tbody>
</tbody>


Best Regards,
Vas
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top