Update 'old list' from 'new list'; Match entries; Copy data across

GTS

Board Regular
Joined
Aug 31, 2009
Messages
108
Office Version
  1. 365
Platform
  1. Windows
I've tried searching and I've come close, but not yet close enough to figure this out with my current Excel VBA abilities.

On a weekly basis, we run a job report. It is outputted to Excel from our ERP system. (I'll call this the "new list".) I have developed a second report in Excel which uses some core data from the ERP derived report. (I'll call this the "old list".) My challenge is to update the old list with the info from the new list. It can be done manually, but I'm hoping to (mostly) automate it.

The data is highly structured. I'll explain that below. First, an example of the "old list" and "new list". This represents Col A on 2 different worksheets.

Old List..............New List<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
CustID5 .............CustID5<o:p></o:p>
111........... ........111<o:p></o:p>
111-02...............111-02<o:p></o:p>
111-05...............111-05<o:p></o:p>
111-08...............111-06 ** new entry<o:p></o:p>
111-11...............111-08<o:p></o:p>
111-20...............111-11<o:p></o:p>
111-25...............111-20<o:p></o:p>
BB-111...............111-25<o:p></o:p>
EE-111................BB-111<o:p></o:p>
RR-111................EE-111<o:p></o:p>
blank...................RR-111<o:p></o:p>
blank...................SS-111 ** new entry<o:p></o:p>
CustID2..............blank<o:p></o:p>
120....................blank<o:p></o:p>
120-01................CustID2<o:p></o:p>
120-07................120<o:p></o:p>
120-13................120-01<o:p></o:p>
AA-120...............120-07<o:p></o:p>
RR-120................120-13<o:p></o:p>
SS-120................AA-120<o:p></o:p>
blank...................RR-120<o:p></o:p>
blank...................RR-120-01 **new entry<o:p></o:p>
CustID10 ...........SS-120<o:p></o:p>
132......................blank<o:p></o:p>
132-02.................blank<o:p></o:p>
blank...................CustID10<o:p></o:p>
blank...................132<o:p></o:p>
..........................132-02<o:p></o:p>
..........................blank<o:p></o:p>
..........................blank<o:p></o:p>
..........................CustID6 ** new entry (project)<o:p></o:p>
..........................137<o:p></o:p>
..........................137-01<o:p></o:p>
..........................137-05<o:p></o:p>
...........................NN-137<o:p></o:p>
Each CustIDx represents a project.
Within each project, there is a list of jobs.
Over time, it is possible for some new jobs to be added (within a project).
Over time, it is possible for new projects to be added.

Projects will eventually be removed from the list (both of them).
I'm ok if I have to do that part manually.
There should never be a case where a job # exists in the old list, but is not in the new list. If by chance this happens, it can be ignored.

The lists are alphanumerically sorted 'except' for the CustIDx which is inserted (in what would otherwise be another blank cell) between the projects. The CustIDx are purely alpha. Job # are alphanumeric. They always have a number component as a minimum.

As I said, these lists are Col A (on 2 different worksheets).
(I can give the worsheets fixed names / # if that helps.)
Col B to G contain data that I want to update.
I want to copy B-G from the new list into the matching entry on the old list.
If a job # exists in the new list but not in the old list, I want to insert it in the old list and again, copy B-G across. Insert means a full row. I have a lot more going on to the right of Col G.
Oh... I also need to copy Col B-G across for the first <blank> row (of every pair). Actually, both rows could be copied... that's fine. The second <blank> is just a blank row.

The old list does not start on a fixed row.
I can give the list(s) a set heading though if that helps.

Whew... Feels like I'm asking a lot. However, I did come across a macro that was doing something similar and was only about a dozen lines long. Unfortunately, it was beyond my ability to modify it.

Thanks for reading. I'm looking forward to any help that I can get.

GTS
 
Last edited by a moderator:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Anyone?

I'll try to condense my challenge to the bare minimum.

2 lists. Old List and New List.
New List is the "master".
Read cell from Col A in New List.
Look for match in Col A in Old List.
If match found, copy row from Col B to G from New List to Old List.
If match not found, insert blank row in Old List.
... Copy row Col A to G from New List to blank row in Old List.
... (I want to do this in 2 steps for a reason).

Any help appreciated. Thanks.

GTS
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,693
Members
452,938
Latest member
babeneker

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