Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
Hello all,
Please consider this sample database ...
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:
I would be most grateful for any suggestions, direction or resources to assist in overcoming this challenge. Thank you for all in advance.
Please consider this sample database ...
Excel Workbook | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | |||
1 | REC_ID | DATE | CONTRACT # | AMMNT | TYPE | EVENT | CUSTOMER | CITY | ADDRESS | FAC_CONCATENATE | TYPE | UNIT | CLASS | STARTS | ENDS | DUP_FLAG | ||
2 | 7/6/2015 | 70843 | Memphis | 21 Brighton St. | 7084321 Brighton St. | A | 6:00 PM | 8:30 PM | ||||||||||
3 | 7/6/2015 | 70843 | Memphis | 34 Weston Ave. | 7084334 Weston Ave. | A | 6:00 PM | 8:30 PM | ||||||||||
4 | 7/6/2015 | 70843 | Memphis | 355 Eastern Ave. | 70843355 Eastern Ave. | A | 6:00 PM | 8:30 PM | ||||||||||
5 | 7/6/2015 | 176288 | Memphis | 15 Main St. | 17628815 Main St. | B | 6:30 PM | 7:15 PM | ||||||||||
6 | 7/6/2015 | 176288 | Memphis | 65 Main St. | 17628865 Main St. | B | 5:30 PM | 7:15 PM | ||||||||||
7 | 7/6/2015 | 176288 | Memphis | 133 Main St. | 176288133 Main St. | B | 6:30 PM | 7:15 PM | ||||||||||
8 | 7/6/2015 | 176288 | Memphis | 566 Main St. | 176288566 Main St. | B | 6:30 PM | 7:15 PM | ||||||||||
9 | 7/6/2015 | 71067 | Memphis | 23 Greenfield Ave. | 7106723 Greenfield Ave. | B | 6:30 PM | 8:00 PM | ||||||||||
10 | 7/6/2015 | 71067 | Memphis | 1988 Wilson Ave. | 710671988 Wilson Ave. | B | 6:30 PM | 8:00 PM | ||||||||||
11 | 7/6/2015 | 71067 | Memphis | 12 Glen Forrest Blvd. | 7106712 Glen Forrest Blvd. | B | 6:30 PM | 8:00 PM | ||||||||||
12 | 7/6/2015 | 71067 | Memphis | 265 Lexington Crt. | 71067265 Lexington Crt. | A | 6:30 PM | 9:30 PM | ||||||||||
13 | 7/6/2015 | 71067 | Memphis | 97 Oriole Blvd. | 7106797 Oriole Blvd. | A | 6:30 PM | 9:30 PM | ||||||||||
14 | 7/6/2015 | 71539 | Memphis | 2001 Millenium Dr. | 715392001 Millenium Dr. | A | 7:00 PM | 9:00 PM | ||||||||||
15 | 7/6/2015 | 71539 | Memphis | 1 Old Oak Dr. | 715391 Old Oak Dr. | A | 7:00 PM | 9:00 PM | ||||||||||
16 | 7/6/2015 | 176288 | Memphis | 15 Main St. | 17628815 Main St. | B | 7:15 PM | 8:00 PM | ||||||||||
17 | 7/6/2015 | 176288 | Memphis | 65 Main St. | 17628865 Main St. | B | 7:15 PM | 8:00 PM | ||||||||||
18 | 7/6/2015 | 176288 | Memphis | 133 Main St. | 176288133 Main St. | B | 7:15 PM | 8:00 PM | ||||||||||
19 | 7/6/2015 | 176288 | Memphis | 566 Main St. | 176288566 Main St. | B | 7:15 PM | 8:00 PM | ||||||||||
20 | 7/6/2015 | 71182 | Memphis | 66 Fairway Rd. | 7118266 Fairway Rd. | A | 9:00 PM | 11:00 PM | ||||||||||
21 | 7/6/2015 | 71694 | Memphis | 2001 Millenium Dr. | 716942001 Millenium Dr. | A | 9:00 PM | 11:00 PM | ||||||||||
22 | 7/6/2015 | 71933 | Memphis | 1 Old Oak Dr. | 719331 Old Oak Dr. | A | 9:00 PM | 11:00 PM | ||||||||||
23 | 7/6/2015 | 71506 | Dallas | 988 Marsland Dr. | 71506988 Marsland Dr. | B | 5:30 PM | 8:30 PM | ||||||||||
24 | 7/6/2015 | 71134 | Los Angeles | 5 Spruce St. | 711345 Spruce St. | B | 9:30 AM | 11:30 AM | ||||||||||
25 | 7/6/2015 | 176288 | Memphis | 15 Main St. | 17628815 Main St. | B | 8:15 PM | 9:15 PM | ||||||||||
26 | 7/6/2015 | 176288 | Memphis | 65 Main St. | 17628865 Main St. | B | 8:00 PM | 9:15 PM | ||||||||||
27 | 7/6/2015 | 176288 | Memphis | 133 Main St. | 176288133 Main St. | B | 8:00 PM | 9:15 PM | ||||||||||
28 | 7/6/2015 | 176288 | Memphis | 566 Main St. | 176288566 Main St. | B | 8:00 PM | 9:15 PM | ||||||||||
29 | 7/6/2015 | 176288 | Memphis | 65 Main St. | 17628865 Main St. | B | 9:15 PM | 11:00 PM | ||||||||||
30 | 7/6/2015 | 176288 | Memphis | 566 Main St. | 176288566 Main St. | B | 8:00 PM | 11: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 | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | |||
1 | REC_ID | DATE | CONTRACT # | AMMNT | TYPE | EVENT | CUSTOMER | CITY | ADDRESS | FAC_CONCATENATE | TYPE | UNIT | CLASS | STARTS | ENDS | DUP_FLAG | ||
2 | 7/6/2015 | 176288 | Memphis | 15 Main St. | 17628815 Main St. | B | 6:30 PM | 9:15 PM | ||||||||||
3 | 7/6/2015 | 176288 | Memphis | 65 Main St. | 17628865 Main St. | B | 5:30 PM | 11:00 PM | ||||||||||
4 | 7/6/2015 | 176288 | Memphis | 133 Main St. | 176288133 Main St. | B | 6:30 PM | 9:15 PM | ||||||||||
5 | 7/6/2015 | 176288 | Memphis | 566 Main St. | 176288566 Main St. | B | 6:30 PM | 11: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.