count rows and add equal rows when matched

donlincolnmre2

Board Regular
Joined
Dec 23, 2006
Messages
142
Hello

I’m looking for a macro to MOVE only PHONE NUMBERS from the row below (CHILD RECORD which appears several times in some cases) to the row above (MASTER RECORD)

The top row (or the first occurrence of the record) contains the master record and it has columns range of from A to BB

The child records rows have lots less columns.

The macro should count how many times the CHILD Record appear and copy the MASTER RECORD that many time and then MOVE the PHONE NUMBERS from the CHILD record into the MASTER RECORD (only the PHONE NUMBERS)

The address appears in COLUMN F and the PHONE NUMBERS in COLUMN J

The only way I can think of is to focus on COLUMN F and compare row by row and look for equal address match, once found then count how many time it appeared and then copy the master that many time (entire row) and then MOVE the numbers from child record in to master.

If there is no duplicate address for the record then it should just delete the entire row.

e.g. 762 morita only appeared once so that one should be deleted

7619 kengard the 1st record is the master record so the number should be MOVED from the row below

761 TERMINAL the CHILD RECORD appeard 6 times, so the master record (the entire row) should have a total of 6 copies and then MOVE the phone number from the CHILD RECORD.


Any help would be greatly appreciated


Thanks.


Here is the DUMMY DATA.
=====================

Data shows 5 columns
Column F=address
Column g=city state zip
Column h=state
Column I=zip
Column j=phone numbers



762 MORITA DR CORONA CA 92879 744-A2
7619 KENGARD AVE WHITTIER CA 90606 677-A7
7619 KENGARD AVE Whittier, Ca 90606-2440 CA 591000 5623258331
761 TERMINAL ST Los Angeles, Ca 90021-1121 CA 90605 707-G2
761 TERMINAL ST Los Angeles, Ca 90021-1121 CA 374381 2136238560
761 TERMINAL ST Los Angeles, Ca 90021-1121 CA 374381 2136247415
761 TERMINAL ST Los Angeles, Ca 90021-1100 CA 374381 2134880271
761 TERMINAL ST Los Angeles, Ca 90021-1100 CA 374381 2135720121
761 TERMINAL ST Los Angeles, Ca 90021-1100 CA 374381 2136231810
761 TERMINAL ST Los Angeles, Ca 90021-1100 CA 374381 2136275045
7607 S HALLDALE AVE LOS ANGELES CA 90047 703-J1
7607 S HALLDALE AVE Los Angeles, Ca 90047-2516 CA 450000 3237511636
7606 YANKEY ST DOWNEY CA 90242 705-H6
7605 TEA BERRY WAY SACRAMENTO CA 95828 338-F3
7605 NORTHEAST CIR CITRUS HEIGHTS CA 95610 259-H6
7604 WINDSONG PL RANCHO CUCAMONGA CA 91730 573-B7
7601 LEHIGH PL WESTMINSTER CA 92683 827-J4
7601 LEHIGH PL Westminster, Ca 92683-6200 CA 517000 7148943591
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
In the above message, 2 sheets of data was merged together and then sorted on the address column, if its easier to keep them separate than that would be okay too, the MASTER SHEETS have lots of column while the CHILD have only 8 or so columns.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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