Merging Semi-Duplicate Records & Deleting Duplicates

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello all,

Please consider this sample database ...

Excel Workbook
ABCDEFGHIJKLMNOP
1REC_IDDATECONTRACT #AMMNTTYPEEVENTCUSTOMERCITYADDRESSFAC_CONCATENATETYPEUNITCLASSSTARTSENDSDUP_FLAG
27/6/201570843Memphis21 Brighton St.7084321 Brighton St.A6:00 PM8:30 PM
37/6/201570843Memphis34 Weston Ave.7084334 Weston Ave.A6:00 PM8:30 PM
47/6/201570843Memphis355 Eastern Ave.70843355 Eastern Ave.A6:00 PM8:30 PM
57/6/2015176288Memphis15 Main St.17628815 Main St.B6:30 PM7:15 PM
67/6/2015176288Memphis65 Main St.17628865 Main St.B5:30 PM7:15 PM
77/6/2015176288Memphis133 Main St.176288133 Main St.B6:30 PM7:15 PM
87/6/2015176288Memphis566 Main St.176288566 Main St.B6:30 PM7:15 PM
97/6/201571067Memphis23 Greenfield Ave.7106723 Greenfield Ave.B6:30 PM8:00 PM
107/6/201571067Memphis1988 Wilson Ave.710671988 Wilson Ave.B6:30 PM8:00 PM
117/6/201571067Memphis12 Glen Forrest Blvd.7106712 Glen Forrest Blvd.B6:30 PM8:00 PM
127/6/201571067Memphis265 Lexington Crt.71067265 Lexington Crt.A6:30 PM9:30 PM
137/6/201571067Memphis97 Oriole Blvd.7106797 Oriole Blvd.A6:30 PM9:30 PM
147/6/201571539Memphis2001 Millenium Dr.715392001 Millenium Dr.A7:00 PM9:00 PM
157/6/201571539Memphis1 Old Oak Dr.715391 Old Oak Dr.A7:00 PM9:00 PM
167/6/2015176288Memphis15 Main St.17628815 Main St.B7:15 PM8:00 PM
177/6/2015176288Memphis65 Main St.17628865 Main St.B7:15 PM8:00 PM
187/6/2015176288Memphis133 Main St.176288133 Main St.B7:15 PM8:00 PM
197/6/2015176288Memphis566 Main St.176288566 Main St.B7:15 PM8:00 PM
207/6/201571182Memphis66 Fairway Rd.7118266 Fairway Rd.A9:00 PM11:00 PM
217/6/201571694Memphis2001 Millenium Dr.716942001 Millenium Dr.A9:00 PM11:00 PM
227/6/201571933Memphis1 Old Oak Dr.719331 Old Oak Dr.A9:00 PM11:00 PM
237/6/201571506Dallas988 Marsland Dr.71506988 Marsland Dr.B5:30 PM8:30 PM
247/6/201571134Los Angeles5 Spruce St.711345 Spruce St.B9:30 AM11:30 AM
257/6/2015176288Memphis15 Main St.17628815 Main St.B8:15 PM9:15 PM
267/6/2015176288Memphis65 Main St.17628865 Main St.B8:00 PM9:15 PM
277/6/2015176288Memphis133 Main St.176288133 Main St.B8:00 PM9:15 PM
287/6/2015176288Memphis566 Main St.176288566 Main St.B8:00 PM9:15 PM
297/6/2015176288Memphis65 Main St.17628865 Main St.B9:15 PM11:00 PM
307/6/2015176288Memphis566 Main St.176288566 Main St.B8:00 PM11:00 PM
CORE


I have been struggling to find and adapt code that will allow me to:
a) eliminate duplicate records (where values in columns C, N and O are equal)
b) merge semi-duplicate records into one (where values in column C are equal, but values in column O are within 15 minutes of the value in column N.)

The sample above does not have instances where situation A occurs, but basically, one of the two duplicates can be deleted.

There are four examples of scenario b:
Rows 5, 16 and 25 are semi-duplicates of each other with different times (column N and O)
Rows 6, 17, 26 and 29 are semi-duplicates of each other
Rows 7, 18, 27, and rows 8, 19, 28 and 30 are duplicate sets respectively.

I would like to merge each individual set into one record in which the start time is the lowest of the start time values in the set, and the end time is the highest value of the end times in the set. The data would be condensed as such:

Excel Workbook
ABCDEFGHIJKLMNOP
1REC_IDDATECONTRACT #AMMNTTYPEEVENTCUSTOMERCITYADDRESSFAC_CONCATENATETYPEUNITCLASSSTARTSENDSDUP_FLAG
27/6/2015176288Memphis15 Main St.17628815 Main St.B6:30 PM9:15 PM
37/6/2015176288Memphis65 Main St.17628865 Main St.B5:30 PM11:00 PM
47/6/2015176288Memphis133 Main St.176288133 Main St.B6:30 PM9:15 PM
57/6/2015176288Memphis566 Main St.176288566 Main St.B6:30 PM11:00 PM
CORE


I would be most grateful for any suggestions, direction or resources to assist in overcoming this challenge. Thank you for all in advance.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,221,553
Messages
6,160,468
Members
451,649
Latest member
fahad_ibnfurjan

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